Query performance- filter aggregation with the same filter improve performance drastically

Can anyone explain why the left (pseudo) query runs above 5s the while the right part in 30ms?

The filters in the example below, are identical (aggs/ query filters).

isn't the aggregation part suppose to run on filtered data? (result value is the same)

Which Elasticsearch version are you running on?

Also please make sure that the request cache does not skew your calculations and try both queries with that cache disabled.

thanks @spinscale

version: 7.13.2
added request_cache=false to both ..

I think you are hitting a bug I caused in 7.13. This is the fix, coming in 7.14: https://github.com/elastic/elasticsearch/pull/74260

When we found the bug I scrambled to get an emergency "off switch" into the system for 7.13.2 so you can try it: https://github.com/elastic/elasticsearch/pull/73620

Sorry for the trouble!

We hit the same bug on version 7.13.2, it took us 2 weeks to understand where it's coming from and how to work around it. Due to high latency, it was crashing the cluster on specific reports that were generated by users.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.