Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would suggest you to look at your requirements regarding boosting, since your current script doesn't make much sense. </p> <p>Also, have a look at the documentation for the elasticsearch <a href="http://www.elasticsearch.org/guide/reference/query-dsl/" rel="nofollow">query DSL</a>. It provides either compound queries and simple ones, which you can combine together. As the error says, you can't put a filter inside a custom score query. You can either use a <a href="http://www.elasticsearch.org/guide/reference/query-dsl/filtered-query/" rel="nofollow">filtered query</a> inside the custom score query:</p> <pre><code>{ "query": { "custom_score": { "query": { "filtered" : { "query" : { "match": { "xxx": { "query": "foobar" } } }, "filter" : { "and": [ { "query": { "match": { "yyyy": { "query": "barfoo" } } } } ] } } }, "script": "_score * doc['_score']" } } } </code></pre> <p>or use a top level <a href="http://www.elasticsearch.org/guide/reference/api/search/filter/" rel="nofollow">filter</a> like this:</p> <pre><code>{ "query": { "custom_score": { "query": { "match": { "xxx": { "query": "foobar" } } }, "script": "_score * doc['_score']" } }, "filter": { "and": [ { "query": { "match": { "yyyy": { "query": "barfoo" } } } } ] } } </code></pre> <p>The difference between the two options is that the top level filter is not considered if you make facets too in your search request, while if you put the filters within the query they are considered.</p> <p>One other thing to look at: you don't need an and filter if you have only a single clause. Also, it usually doesn't make sense to put a full-text search within a filter, since filters are cacheable and given that full-text searches are free and pretty much unpredictable it would be a waste to cache them.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload