Skip to content

Conversation

@cbuescher
Copy link
Member

Similar to #24085 this adds parsing for InternalBucketMetricValue. This will be needed for
the high level rest client. I also added a new BucketMetricValue interface since InternalBucketMetricValue didn't implement an interface yet so the keys() method wouldn't be accessible on the client side without casting to a concrete implementation.
PR is against the current feature branch for aggregation parsing.

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.

I left a question on the new interface, LGTM otherwise

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was no interface before? That may complicate migration from transport client for users? or was SingleValue enough from the Java api?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My guess is transport client users that needed only value() or getValueAsString() would cast to NumericMetricsAggregation.SingleValue, if you needed keys() you would have to cast to InternalBucketMetricValue. I think it is a kind of oversight that there is no interface, other aggregations that are the output of pipeline aggregators (like InternalSimpleValue) have an interface.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets ask @colings86 if this interface was left out intentionally and whether we should add it on master/5.x so this works similar to e.g. InternalSimpleValue class / SimpleValue interface.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this interface must have been left out by accident. I think it makes sense to add it especially since there is an interface for SimpleValue

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @colings86, I will pull adding the interface out as a single PR against master branch then like Luca suggested.

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 opened #24188 for this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of course

@cbuescher cbuescher force-pushed the addParsing-BucketMetricValue branch from f121f13 to bd0b396 Compare April 19, 2017 13:12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if I'm asking something thats already been discussed but why are we adding this method given we already have value() below?

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 only added this because similar single value interfaces like Sum/Min/Max etc... implement double getValue() in addition to double value(), just to stay consistend. Happy to remove this from this interface, as you said we don't really need it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this interface must have been left out by accident. I think it makes sense to add it especially since there is an interface for SimpleValue

@cbuescher cbuescher force-pushed the addParsing-BucketMetricValue branch from bd0b396 to 526b23a Compare April 19, 2017 14:42
Copy link
Member

@tlrx tlrx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left very minor comments

// cannot differentiate between them. Also we cannot recreate the exact String representation
assertEquals(parsed.value(), Double.NEGATIVE_INFINITY, 0);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra line


public class ParsedBucketMetricValue extends ParsedSingleValueNumericMetricsAggregation implements BucketMetricValue {

private List<String> keys = new ArrayList<>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emptyList()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, thats better in this case. Thanks.

@cbuescher cbuescher merged commit 6e22a1e into elastic:feature/client_aggs_parsing Apr 20, 2017
javanna pushed a commit to javanna/elasticsearch that referenced this pull request May 23, 2017
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.

4 participants