Skip to content
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 fields API for geo_point fields inside other arrays #99868

Merged
merged 8 commits into from Sep 26, 2023

Conversation

cbuescher
Copy link
Member

@cbuescher cbuescher commented Sep 25, 2023

The fields API currently doesn't work for geopoint arrays inside outer objects
that again are expressed as multi-values arrays. The reason is that upon
extracting the leaf values from source (i.e via Source#extractValue) we
accumulate intermediate array structures as additinal lists in the source value
we then try to parse. For other field types, especially those that use
SourceValueFetcher, this doesn't matter because we have a list-flattening step
in SourceValueFetcher#fetchValues, but for geo_point types the parser cannot
deal with the additional list levels. This change modifies the source extraction
so that we avoid nesting to many list structures inside each other, which I
believe currently is wrong but is masked by the list deduplication mentioned
above.

Closes #99781

@cbuescher cbuescher added WIP and removed v8.11.0 labels Sep 25, 2023
@cbuescher cbuescher changed the title wip WIP: Fix bug in fields API for geo_point arrays inside parent field arrays Sep 25, 2023
The fields API currently doesn't work for geopoint arrays inside outer objects
that again are expressed as multi-values arrays. The reason is that upon
extracting the leaf values from source (i.e via Source#extractValue) we
accumulate intermediate array structures as additinal lists in the source value
we then try to parse. For other field types, especially those that use
SourceValueFetcher, this doesn't matter because we have a list-flattening step
in SourceValueFetcher#fetchValues, but for geo_point types the parser cannot
deal with the additional list levels. This change modifies the source extraction
so that we avoid nesting to many list structures inside each other, which I
believe currently is wrong but is masked by the list deduplication mentioned
above.

Closes elastic#99781
@cbuescher cbuescher changed the title WIP: Fix bug in fields API for geo_point arrays inside parent field arrays Fix fields API for geo_point fields inside other arrays Sep 25, 2023
@cbuescher cbuescher removed the WIP label Sep 25, 2023
@cbuescher cbuescher marked this pull request as ready for review September 25, 2023 17:48
@cbuescher cbuescher added :Search/Search Search-related issues that do not fall into other categories >bug v8.11.0 v8.10.3 labels Sep 25, 2023
@elasticsearchmachine elasticsearchmachine added the Team:Search Meta label for search team label Sep 25, 2023
@elasticsearchmachine
Copy link
Collaborator

Hi @cbuescher, I've created a changelog YAML for you.

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

Copy link
Contributor

@romseygeek romseygeek left a comment

Choose a reason for hiding this comment

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

Thanks @cbuescher, I left a couple of comments

@cbuescher
Copy link
Member Author

@romseygeek thanks for the review, I made the changes to the tests you suggested.

Copy link
Contributor

@romseygeek romseygeek left a comment

Choose a reason for hiding this comment

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

Couple of nits, LGTM otherwise. Thanks!

cbuescher and others added 4 commits September 26, 2023 15:52
…ieldFetcherTests.java

Co-authored-by: Alan Woodward <romseygeek@gmail.com>
…ieldFetcherTests.java

Co-authored-by: Alan Woodward <romseygeek@gmail.com>
@cbuescher
Copy link
Member Author

@elasticmachine run elasticsearch-ci/bwc

@cbuescher cbuescher added the auto-backport-and-merge Automatically create backport pull requests and merge when ready label Sep 26, 2023
@cbuescher cbuescher merged commit cc42ff6 into elastic:main Sep 26, 2023
12 checks passed
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.10

cbuescher added a commit to cbuescher/elasticsearch that referenced this pull request Sep 26, 2023
The fields API currently doesn't work for geopoint arrays inside outer objects
that again are expressed as multi-values arrays. The reason is that upon
extracting the leaf values from source (i.e via Source#extractValue) we
accumulate intermediate array structures as additinal lists in the source value
we then try to parse. For other field types, especially those that use
SourceValueFetcher, this doesn't matter because we have a list-flattening step
in SourceValueFetcher#fetchValues, but for geo_point types the parser cannot
deal with the additional list levels. This change modifies the source extraction
so that we avoid nesting to many list structures inside each other, which I
believe currently is wrong but is masked by the list deduplication mentioned
above.

Closes elastic#99781
elasticsearchmachine pushed a commit that referenced this pull request Sep 26, 2023
)

The fields API currently doesn't work for geopoint arrays inside outer objects
that again are expressed as multi-values arrays. The reason is that upon
extracting the leaf values from source (i.e via Source#extractValue) we
accumulate intermediate array structures as additinal lists in the source value
we then try to parse. For other field types, especially those that use
SourceValueFetcher, this doesn't matter because we have a list-flattening step
in SourceValueFetcher#fetchValues, but for geo_point types the parser cannot
deal with the additional list levels. This change modifies the source extraction
so that we avoid nesting to many list structures inside each other, which I
believe currently is wrong but is masked by the list deduplication mentioned
above.

Closes #99781
@andrewkcarter
Copy link

Thank you @cbuescher.

piergm pushed a commit to piergm/elasticsearch that referenced this pull request Oct 2, 2023
The fields API currently doesn't work for geopoint arrays inside outer objects
that again are expressed as multi-values arrays. The reason is that upon
extracting the leaf values from source (i.e via Source#extractValue) we
accumulate intermediate array structures as additinal lists in the source value
we then try to parse. For other field types, especially those that use
SourceValueFetcher, this doesn't matter because we have a list-flattening step
in SourceValueFetcher#fetchValues, but for geo_point types the parser cannot
deal with the additional list levels. This change modifies the source extraction
so that we avoid nesting to many list structures inside each other, which I
believe currently is wrong but is masked by the list deduplication mentioned
above.

Closes elastic#99781
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport-and-merge Automatically create backport pull requests and merge when ready >bug :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v8.10.3 v8.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fields option not returning values with an array of objects
4 participants