-
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
Correctly handle mixed object paths in XContentMapValues #65539
Conversation
Pinging @elastic/es-search (Team:Search) |
I've marked this for 7.11 but we could conceivably backport it to 7.10.1 as well. |
@elasticmachine update branch |
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 took a look since the case this issue fixes also might be interesting for #65386 and the change here makes sense to me. LGTM, but maybe you want to wait for a second pair of eyes 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.
LGTM
Thanks @romseygeek for fixing this! I noticed there's a related but slightly different edge case:
Surprisingly, we allow documents to specify a field both in structured object and dot notation. When parsing, we index both values as if it were specified as an array. Your PR fixes the problem for |
I've pushed a test for your second case. |
…o bug/object-fields-fetch
When we have an object that looks like this: ``` { "foo" : { "cat": "meow" }, "foo.bar" : "baz" ``` where the inner objects of foo are defined both as json objects and via dot notation, then XContentMapValues.extractValue() will only descend through the json object and will not collect values from the dot notated paths. In these cases, the foo.bar values will not be returned in the fields section of a search response. This commit adds the ability to check both paths, ensuring that all relevant values get returned as part of fields. Fixes #65499
When we have an object that looks like this:
where the inner objects of
foo
are defined both as json objects and viadot notation, then XContentMapValues.extractValue() will only descend
through the json object and will not collect values from the dot notated paths.
In these cases, the
foo.bar
values will not be returned in thefields
section of a search response.
This commit adds the ability to check both paths, ensuring that all relevant
values get returned as part of
fields
.Fixes #65499