-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
fix MultiValuesSourceFieldConfig toXContent #36525
Conversation
Pinging @elastic/es-analytics-geo |
@polyfractal I was interested in adding actual tests for the aggregation as well since I couldn't find any. Do we have to/from xcontent tests somewhere for the weighted_avg aggregation? I tried my hand, but For example, here is a snippet of the generated xcontent:
There is an extra |
I assume I am missing some context, but I went ahead and added a second commit that demonstrates what I meant by my previous 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.
Thanks @talevy! Left a few comments, otherwise LGTM.
Should this target master, not just 6.x?
.../java/org/elasticsearch/search/aggregations/support/MultiValuesSourceAggregationBuilder.java
Show resolved
Hide resolved
|
||
@Override | ||
protected WeightedAvgAggregationBuilder doParseInstance(XContentParser parser) throws IOException { | ||
parser.nextToken(); |
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.
Should we snag the code from BaseAggregatorTestCase#parse()
so that we have a similar set of assertions here?
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.
oh woah, yeah, I'll lift that...
thanks for the pointer, was looking for something like that to re-use
@@ -78,7 +79,7 @@ private MultiValuesSourceFieldConfig(String fieldName, Object missing, Script sc | |||
} | |||
|
|||
public MultiValuesSourceFieldConfig(StreamInput in) throws IOException { | |||
this.fieldName = in.readString(); | |||
this.fieldName = in.readOptionalString(); |
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 that if we want to change this, we might need to wrap this in version checks? readOptionalString()
encodes an extra byte for the boolean
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.
good catch. yes.
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.
OK. maybe we can do this in a separate PR. I think Docs need clean up too. We claim that field
is required, but it can be replaced with script
.
I see this as a bug, but want to attack this separately since the original issue was only with 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.
++ makes sense to me
This commit turns MultiValuesSourceFieldConfig into a proper ToXContentObject for easy testing and verification of its to/from XContent methods. Closes elastic#36474.
Hey @polyfractal, I know you approved this, but I've reverted the serialization changes, mind taking another look? As I said previously. the bug in the serialization is not the concern 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.
👍 looks good! ++ to doing the serialization stuff in a followup PR (agree it's a bug and the docs should be updated to match)
thanks for the review @polyfractal! |
This commit turns MultiValuesSourceFieldConfig into a proper ToXContentObject for easy testing and verification of its to/from XContent methods. Closes #36474.
This commit turns MultiValuesSourceFieldConfig into a proper ToXContentObject for easy testing and verification of its to/from XContent methods. Closes #36474.
* elastic/master: Remove deprecated `useDisMax` from MultiMatchQuery (elastic#36488) HLRC: Add get users action (elastic#36332) fix MultiValuesSourceFieldConfig toXContent (elastic#36525) Add ILM-specific security privileges (elastic#36493) Remove usages of `MockTcpTransport` from zen tests (elastic#36579)
This is also broken on the 6.4 branch, would it be possible to back port the fix there as well? |
This commit turns MultiValuesSourceFieldConfig into a proper
ToXContentObject for easy testing and verification of its
to/from XContent methods.
Closes #36474.