Does aggregations runs in parallel?

Hi everyone,

I have one query _search with four separated nested terms aggregation and filters in the aggregations, this query is retrieving data in about 2 seconds when a specific term is searched.

I splitted the four queries into four different requests in a _msearch, each one with an aggregation. The time has reduced to about 25% of the previous one with all aggregations in a single request _search.

Regarding it, my question is, does aggregations in elasticsearch runs in parallel in the _search endpoint?

My guess is that when running the aggregations in a _msearch it was done in parallel and that is the reason to be faster. Am I right?


1 Like

_search aggregates run sequentially. _msearch they do run in parallel and you can control how many can in concurrently using max_concurrent_searches

1 Like

Each query executes in a single thread against each shard, although querying of multiple shards is done in parallel. If you send 4 separate aggregation in parallel over in an _msearch query they run in parallel across all shards.

1 Like

Thanks @Christian_Dahlqvist !

Do you know any part of the documentation says so? I couldn't find it.

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