Plain filter and constant_score

Hi,

We are currently benchmarking our ES setup so I've got some new questions:

  1. We found out that, for the same query (filter actually), when put like
    this:

{
"filter": {...},
"fields": [...]
}

is consistently slower than this form:

{
"query": {
"constant_score": {
"filter": {...},
...
}
}
}.

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 in advance.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ad91095f-7e7b-4def-8570-73dbccaa7cb2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

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.

Thanks,
Matt Weber

On Mon, Dec 30, 2013 at 2:53 PM, Han JU ju.han.felix@gmail.com wrote:

Hi,

We are currently benchmarking our ES setup so I've got some new questions:

  1. We found out that, for the same query (filter actually), when put like
    this:

{
"filter": {...},
"fields": [...]
}

is consistently slower than this form:

{
"query": {
"constant_score": {
"filter": {...},
...
}
}
}.

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 in advance.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/ad91095f-7e7b-4def-8570-73dbccaa7cb2%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAJ3KEoBhOub8U5zc_DzsecE4LrsxF40PUBaDCvnwX%3DWrO4f50w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

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.

Thanks,
Matt Weber

On Mon, Dec 30, 2013 at 2:53 PM, Han JU <ju.han...@gmail.com <javascript:>

wrote:

Hi,

We are currently benchmarking our ES setup so I've got some new questions:

  1. We found out that, for the same query (filter actually), when put like
    this:

{
"filter": {...},
"fields": [...]
}

is consistently slower than this form:

{
"query": {
"constant_score": {
"filter": {...},
...
}
}
}.

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 in advance.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/ad91095f-7e7b-4def-8570-73dbccaa7cb2%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/050b2a38-4393-4fa5-a036-41fd29a797c9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.