forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add setting to disable aggs optimization (backport of elastic#73620)
Sometimes our fancy "run this agg as a Query" optimizations end up slower than running the aggregation in the old way. We know that and use heuristics to dissable the optimization in that case. But it turns out that the process of running the heuristics itself can be slow, depending on the query. Worse, changing the heuristics requires an upgrade, which means waiting. If the heurisics make a terrible choice folks need a quick way out. This adds such a way: a cluster level setting that contains a list of queries that are considered "too expensive" to try and optimize. If the top level query contains any of those queries we'll disable the "run as Query" optimization. The default for this settings is wildcard and term-in-set queries, which is fairly conservative. There are certainly wildcard and term-in-set queries that the optimization works well with, but there are other queries of that type that it works very badly with. So we're being careful. Better, you can modify this setting in a running cluster to disable the optimization if we find a new type of query that doesn't work well. Closes elastic#73426
- Loading branch information
Showing
13 changed files
with
207 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...src/yamlRestTest/resources/rest-api-spec/test/search.aggregation/22_terms_disable_opt.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
setup: | ||
- do: | ||
cluster.put_settings: | ||
body: | ||
persistent: | ||
search.aggs.rewrite_to_filter_by_filter: false | ||
|
||
--- | ||
teardown: | ||
- do: | ||
cluster.put_settings: | ||
body: | ||
persistent: | ||
search.aggs.rewrite_to_filter_by_filter: null | ||
|
||
--- | ||
does not use optimization: | ||
- skip: | ||
version: " - 7.13.99" | ||
reason: setting to disable optimization added in 7.14.0 to be backported to 7.13.2 | ||
- do: | ||
bulk: | ||
index: test | ||
refresh: true | ||
body: | | ||
{ "index": {} } | ||
{ "str": "sheep" } | ||
{ "index": {} } | ||
{ "str": "sheep" } | ||
{ "index": {} } | ||
{ "str": "cow" } | ||
{ "index": {} } | ||
{ "str": "pig" } | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
profile: true | ||
size: 0 | ||
aggs: | ||
str_terms: | ||
terms: | ||
field: str.keyword | ||
- match: { aggregations.str_terms.buckets.0.key: sheep } | ||
- match: { aggregations.str_terms.buckets.1.key: cow } | ||
- match: { aggregations.str_terms.buckets.2.key: pig } | ||
- match: { profile.shards.0.aggregations.0.type: GlobalOrdinalsStringTermsAggregator } | ||
- match: { profile.shards.0.aggregations.0.description: str_terms } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.