Skip to content

Conversation

@cbuescher
Copy link
Member

@cbuescher cbuescher commented May 9, 2017

This is an alternative approach to #24386 that doesn't rely on extending ObjectParsers capabilities and uses manual parsing instead.

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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

@cbuescher cbuescher force-pushed the addParsing-SingleBucket-v2 branch 2 times, most recently from e990186 to be8e0f7 Compare May 10, 2017 10:46
@cbuescher cbuescher changed the title WIP: Add parsing single bucket using manual parsing Add parsing for single bucket aggregations May 10, 2017
@cbuescher cbuescher removed the WIP label May 10, 2017
@cbuescher
Copy link
Member Author

@javanna @tlrx I squashed and tidied this up a bit, theres a small TODO in the tests that I still need to adress but I think the rest is good for a review.

@javanna javanna removed the v6.0.0 label May 10, 2017
Copy link
Member

@javanna javanna left a 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

@cbuescher cbuescher force-pushed the addParsing-SingleBucket-v2 branch 2 times, most recently from 3b49c6d to f4ad9b8 Compare May 10, 2017 16:55
@cbuescher cbuescher force-pushed the addParsing-SingleBucket-v2 branch from f4ad9b8 to 035f238 Compare May 11, 2017 09:38
@cbuescher cbuescher merged commit c4fc8ed into elastic:feature/client_aggs_parsing May 11, 2017
@cbuescher cbuescher added v6.0.0 and removed v6.0.0 labels May 15, 2017
javanna pushed a commit to javanna/elasticsearch that referenced this pull request May 23, 2017
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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants