Elastic search: request not registered for [or]

Can someone help me with this request? I get an error: "Request is not registered for [or]" I created this incorrectly? It should filter out all the results, where the area is 530, and the beginning is empty OR the area is 530, and the beginning is "06192013", and then, based on this, the document is enlarged with other filters.

{ "query": { "custom_filters_score": { "query": { "bool": { "must": [ {"field":{"sector":"sector1"}}, {"term":{"user_type":"ghost"}}, {"term":{"area":"530"}} ] }, "filter":{ "or": [ { "and": [ {"term":{"area":"530"}}, {"term":{"start":"06192013"}} ] }, { "and": [ {"term":{"area":"530"}}, {"term":{"start":"blank"}} ] } ] } }, "filters": [ {"filter":{"term":{"relevance" :5726}},"boost":"1000"}, {"filter":{"term":{"relevance2":5726}},"boost":"100"} ], "score_mode":"total" } } } 
+4
source share
1 answer

A filter object containing a filter or filter is inappropriate. I think you wanted to use a filtered query containing a bool query, and a filter or filter as follows:

 { "filtered" : { "bool": { "must": [ {"field":{"sector":"sector1"}}, {"term":{"user_type":"ghost"}}, {"term":{"area":"530"}} ] }, "filter" : { "or": [ { "and": [ {"term":{"area":"530"}}, {"term":{"start":"06192013"}} ] }, { "and": [ {"term":{"area":"530"}}, {"term":{"start":"blank"}} ] } ] } } } 
+5
source

Source: https://habr.com/ru/post/1485704/


All Articles