[Concurrent Segment Search] Optimize Significant Terms Agg to not perform count query for each segment slice #8789
Labels
distributed framework
enhancement
Enhancement or improvement to existing feature or request
Search:Aggregations
This issue is a follow-up to #8703 and #8735
For Significant Terms queries, the
bg_count
is gathered by performing a query against the shard. For the top levelbg_count
we only perform a query if abackgroundFilter
is present:OpenSearch/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/SignificanceLookup.java
Line 100 in 8eea7b9
For the inner
bg_count
the query is performed regardless:OpenSearch/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/SignificanceLookup.java
Lines 193 to 216 in 8eea7b9
The top level
bg_count
will be the same for all buckets in the same shard, while the innerbg_count
will be the same for every bucket with the same key in the same shard. Since both of these are shard level counts, we do not need to perform the query for each bucket and can do some optimization here to save on queries.The text was updated successfully, but these errors were encountered: