-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Describe the bug
In TermsQueryBuilder.java (line 611), the terms lookup fetch-size logic reads the setting key "indices.query.max_clause_count" instead of the correct "indices.query.bool.max_clause_count".
// Current (incorrect) β TermsQueryBuilder.java:611
int maxClauseCount = idxSettings.getAsInt("indices.query.max_clause_count", 1024);The correct setting key, as defined in SearchService.INDICES_MAX_CLAUSE_COUNT_SETTING, is:
// SearchService.java:398
"indices.query.bool.max_clause_count"Because "indices.query.max_clause_count" is never a registered setting, getAsInt always falls back to the hardcoded default of 1024, making any user/operator configuration of indices.query.bool.max_clause_count silently ignored when computing the terms lookup fetch size.
To reproduce
- Set the cluster setting
indices.query.bool.max_clause_countto a value other than 1024 (e.g., 4096). - Run a
termsquery with aterms_lookupthat would benefit from a larger fetch size. - Observe that the fetch size is still capped at 1024 regardless of the configured value.
Expected behavior
The terms lookup fetch-size calculation should read "indices.query.bool.max_clause_count" (or ideally use the typed SearchService.INDICES_MAX_CLAUSE_COUNT_SETTING constant) so that the operator-configured value is respected.
Suggested fix
// Option A: Use the typed Setting (preferred)
int maxClauseCount = SearchService.INDICES_MAX_CLAUSE_COUNT_SETTING.get(idxSettings);
// Option B: Use the correct string key
int maxClauseCount = idxSettings.getAsInt("indices.query.bool.max_clause_count", 1024);The test in TermQueryWithDocIdAndQueryTests.java:380 also uses the wrong key and should be updated to match.
OpenSearch version
main (HEAD)
Operating system
All
Additional context
The .bool. segment was likely dropped during development. The setting was made dynamically updateable in #13568 (2.16.0), but this code path was not updated to use the correct key.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status