java - Elasticsearch postfiler cancel filter -
in following query want filter query results size medium , color blue want aggregations ignore color blue applied.
{ "query":{ "bool" { "must": { "query_string": { "query": "foo" } }, "should": { // deferred } } }, "filter": { "term": {"size": "m"} }, "aggregations": { // deferred }, "post_filter":{ "term":{"color":"blue"} } } the problem whenever post_filter present size filter no longer has effect on query result. missing?
edit: elasticsearch version 1.5.1
your filter acting post_filter, i.e. gets overwritten subsequent post_filter.
you should either have post_filter covers both size , color (if want these excluded aggregation) or move size filter filtered query:
"query": { "filtered": { "query":{ "bool" { "must": { "query_string": { "query": "foo" } }, "should": { // deferred } } }, "filter" : { "term": {"size": "m"} } } }
Comments
Post a Comment