-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add parsing for single bucket aggregations #24564
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
Add parsing for single bucket aggregations #24564
Conversation
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 weird and prevented the tests from working. We implement this method in InternalAggregation#getType() to return getWriteableName(), and InternalSampler and its subclass UnmappedSampler have different names there. If we used "sampler" for both classes in the XContent output as type prefix we wouldn't be able to distinguish the two when parsing. I wonder if this was added by mistake or for a reason, maybe you can double check 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.
I think the idea was that InternalSampler and UnmappedSampler should have the same type, so that we only parse into InternalSampler. Maybe we meant to call it "sampler" in both cases rather than mapped_sampler but I guess we don't need that.
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.
Why didn't we have this problem also in the ObjectParser version of this PR?
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.
I think we did, but I just found it. The fromXContent() tests are curerently skipped if the register the parser under "sampler" but then find "unmapped_sampler" or "mapped_sampler" in the xContent
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.
now I see what you meant yesterday saying that we have to parse meta here
e990186 to
be8e0f7
Compare
javanna
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 good to go when you resolved the last TODO
3b49c6d to
f4ad9b8
Compare
f4ad9b8 to
035f238
Compare
This adds parsing to all implementations of SingleBucketAggregations. They are mostly similar, so they share the common base class `ParsedSingleBucketAggregation` and the shared base test `InternalSingleBucketAggregationTestCase`.
This is an alternative approach to #24386 that doesn't rely on extending ObjectParsers capabilities and uses manual parsing instead.