-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fold some of sig_terms into terms #57361
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
Conversation
This merges the global-ordinals-based implementation for `significant_terms` into the global-ordinals-based implementation of `terms`, removing a bunch of copy and pasted code that is subtly different across the two implementations and replacing it with an explicit `ResultStrategy` with nice stuff like Javadoc. The actual behavior is mostly unchanged, though I was able to remove a redundant copy of bytes representing the string from the result construction phase of `significant_terms`.
|
Pinging @elastic/es-analytics-geo (:Analytics/Aggregations) |
not-napoleon
left a comment
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, Nice refactoring. Feels good to see these two coming more into sync.
| BytesRef apply(long ord) throws IOException; | ||
| } | ||
|
|
||
| public GlobalOrdinalsStringTermsAggregator(String name, AggregatorFactories factories, |
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.
Nit: Maybe run the formatter on this method declaration?
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.
👍
| boolean showTermDocCountError, | ||
| Map<String, Object> metadata) throws IOException { | ||
| super(name, factories, context, parent, order, format, bucketCountThresholds, collectionMode, showTermDocCountError, metadata); | ||
| this.resultStrategy = resultStrategy.apply(this); |
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.
Nit: Since the syntax backing this is somewhat rare in aggs, maybe toss a quick comment here that we need the reference to this in order to construct the closure? I figured it out, but did a double take when I first saw it.
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.
👍
| boolean showTermDocCountError, | ||
| Map<String, Object> metadata) throws IOException { | ||
| super(name, factories, valuesSource, order, format, bucketCountThresholds, null, | ||
| super(name, factories, a -> a.new StandardTermsResults(), valuesSource, order, format, bucketCountThresholds, null, |
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.
Nit: maybe update the javadoc to say this can only be used for StandardTerms?
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.
👍
|
Thanks @not-napoleon ! I've merged and will backport! |
This merges the global-ordinals-based implementation for `significant_terms` into the global-ordinals-based implementation of `terms`, removing a bunch of copy and pasted code that is subtly different across the two implementations and replacing it with an explicit `ResultStrategy` with nice stuff like Javadoc. The actual behavior is mostly unchanged, though I was able to remove a redundant copy of bytes representing the string from the result construction phase of `significant_terms`.
This merges the global-ordinals-based implementation for `significant_terms` into the global-ordinals-based implementation of `terms`, removing a bunch of copy and pasted code that is subtly different across the two implementations and replacing it with an explicit `ResultStrategy` with nice stuff like Javadoc. The actual behavior is mostly unchanged, though I was able to remove a redundant copy of bytes representing the string from the result construction phase of `significant_terms`. Co-authored-by: Elastic Machine <[email protected]>
When you run a `significant_terms` aggregation on a field and it *is* mapped but there aren't any values for it then the count of the documents that match the query on that shard still have to be added to the overall doc count. I broke that in elastic#57361. This fixes that. Closes elastic#57402
When you run a `significant_terms` aggregation on a field and it *is* mapped but there aren't any values for it then the count of the documents that match the query on that shard still have to be added to the overall doc count. I broke that in elastic#57361. This fixes that. Closes elastic#57402
This merges the global-ordinals-based implementation for
significant_termsinto the global-ordinals-based implementation ofterms, removing a bunch of copy and pasted code that is subtlydifferent across the two implementations and replacing it with an
explicit
ResultStrategywith nice stuff like Javadoc.The actual behavior is mostly unchanged, though I was able to remove a
redundant copy of bytes representing the string from the result
construction phase of
significant_terms.