All filter and fields part are identical, but the performance is different,
especially when caches are warm, filters wrapped in a constant_score are
nearly 10x faster than when they are put directly.
So what happens behind this? How ElasticSearch interpret filters that are
put directly (not wrapped in any outer structure)?
The "outer" filter is basically a post filter, ie. filtering happens after
all the documents have been collected via the query. This should not
really be used unless you are trying to do something like multi-select
faceting where you don't want facet counts to be affected by the filter.
You should be using a filtered query [1] or as you discovered a constant
score query if you only want to execute a filter.
BTW, in elasticsearch 1.0, this outer filter has been renamed to
"post_filter" to avoid some of the confusion.
All filter and fields part are identical, but the performance is
different, especially when caches are warm, filters wrapped in a
constant_score are nearly 10x faster than when they are put directly.
So what happens behind this? How Elasticsearch interpret filters that are
put directly (not wrapped in any outer structure)?
Thanks Matt.
It seems that we've done terrible things ... effectively post_filter is a
better name.
在 2013年12月31日星期二UTC+1上午12时16分43秒,Matt Weber写道:
The "outer" filter is basically a post filter, ie. filtering happens after
all the documents have been collected via the query. This should not
really be used unless you are trying to do something like multi-select
faceting where you don't want facet counts to be affected by the filter.
You should be using a filtered query [1] or as you discovered a constant
score query if you only want to execute a filter.
BTW, in elasticsearch 1.0, this outer filter has been renamed to
"post_filter" to avoid some of the confusion.
All filter and fields part are identical, but the performance is
different, especially when caches are warm, filters wrapped in a
constant_score are nearly 10x faster than when they are put directly.
So what happens behind this? How Elasticsearch interpret filters that are
put directly (not wrapped in any outer structure)?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.