elasticsearch - Adding a condition to query -
i have query works grate. how ever need add 1 condition. want documents have field "marked" :"true"
this query.
{ "from": 0, "size": 100, "min_score": 0.6, "query": { "bool": { "should": [ { "multi_match" : { "fields" : ["_all"], "query" : " test " , "fuzziness" : "1.5" , "prefix_length" : "2" } } ], "must": { "bool": { "must": [ { "terms": { "language.id":["1"] }}, { "term": { "forbidden":"false" }} ] }}} }, "sort": [{ "_score": { "order": "desc"}} ] }
i have been trying ti add should clause after both must clauses. can put condition?
try
{ "query": { "bool": { "should": [ { "multi_match": { "fields": [ "_all" ], "query": " test ", "fuzziness": "1.5", "prefix_length": "2" } } ], "must": [ { "terms": { "language.id": [ "1" ] } }, { "term": { "forbidden": "false" } }, { "term": { "marked": "true" } } ] } } }
Comments
Post a Comment