-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing testComplicatedBucketPath for avg bucket agg #87161
Fixing testComplicatedBucketPath for avg bucket agg #87161
Conversation
Pinging @elastic/es-analytics-geo (Team:Analytics) |
avgResult = searchAndReduce( | ||
indexSearcher, | ||
query, | ||
avgBuilder, | ||
10000, | ||
new MappedFieldType[] { fieldType, valueFieldType, keywordField } | ||
); | ||
histogramResult = searchAndReduce( | ||
indexSearcher, | ||
query, | ||
histo, | ||
10000, | ||
new MappedFieldType[] { fieldType, valueFieldType, keywordField } | ||
); | ||
internalTerms = searchAndReduce( | ||
indexSearcher, | ||
query, | ||
termsBuilder, | ||
10000, | ||
new MappedFieldType[] { fieldType, valueFieldType, keywordField } | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-reading the test, I realized that none of these were necessary. Cleaning up.
try (IndexReader indexReader = DirectoryReader.open(directory)) { | ||
IndexSearcher indexSearcher = newSearcher(indexReader, true, true); | ||
IndexSearcher indexSearcher = newIndexSearcher(indexReader); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the key change. I was using the newSearcher method from lucene tests which randomly wraps it as a parallel reader, which we don't support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The test was erroneously creating a test Lucene index reader directly. This means that sometimes the reader was wrapped as a Parallel (threaded) reader which we don't support yet.
This commit cleans up the test and uses AggregatorTestCase#newIndexSearcher directly.
closes #87155