Performances differences between 0.20.x and 0.90 with filtered queries


(Frederick Cheung) #1

Hi,

I'm in the process of planning an upgrade from ES 0.20.6 to ES 0.90.9 and
have run across 2 performance gotchas.

The first is that a plain filtered query with a match_all query and some
filters on numeric attributes of the documents against ES 0.90.9 using the
index build by ES 0.20.6 were about 2x slower than queries against ES
0.20.6. Rebuilding the index against ES 0.90.9 eliminated that performance
difference. Is this something to be expected?

The second concerns a pair of queries: a filtered query wrapping a custom
score query, and in the second case a custom score query wrapping a
filtered query. In both cases the actual filters, parameters to the custom
scoring function are the same (I've included the queries below)

In the first case (filtered query wrapping a custom score) ES 0.90.9 is
much slower (around 40ms) than ES 0.20.6 (5-6ms)

In the second case (custom score wrapping the filtered query) both ES
0.20.6 and 0.90.9 perform very similarly (5-6ms)

So ES 0.20.6 doesn't seem to care which way around I do the filtering
versus the custom scoring, whereas ES 0.90.9 seems to care very much. Is
this expected? Does elastic search run queries 'from the inside out' ?

Thanks,

Fred

query1:

{
"query": {
"filtered": {
"query": {
"custom_score": {
"script": "recommendationscorer",
"lang": "native",
"params": {
...
},
"query": {
"match_all": {}
}
}
},
"filter": {
"and": [{
"range": {
"scores.144": {
"gt": 0.5
}
}
}, {
"terms": {
"retailer_ids": [192]
}
}, {
"term": {
"garment_category_id": [1]
}
}]
}
}
},
"size": 8,
"min_score": 0.5,
"from": 0,
"fields": ["id"]
}

query2:
{
"query": {
"custom_score": {
"script": "recommendationscorer",
"lang": "native",
"params": {
...
},
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"and": [{
"range": {
"scores.144": {
"gt": 0.5
}
}
}, {
"terms": {
"retailer_ids": [192]
}
}, {
"term": {
"garment_category_id": [1]
}
}]
}
}
}
}
},
"size": 8,
"min_score": 0.5,
"from": 0,
"fields": ["id"]
}

--
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/d1a9a190-d011-419e-bf63-63e965f75b3e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #2