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
Conversation
64851d1
to
42f403b
Compare
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
42f403b
to
bb1ee8a
Compare
Hi @cbuescher, I've created a changelog YAML for you. |
Pinging @elastic/es-search (Team:Search) |
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 @cbuescher, I left a couple of comments
server/src/main/java/org/elasticsearch/common/xcontent/support/XContentMapValues.java
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/search/fetch/subphase/FieldFetcherTests.java
Outdated
Show resolved
Hide resolved
@romseygeek thanks for the review, I made the changes to the tests you suggested. |
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.
Couple of nits, LGTM otherwise. Thanks!
server/src/main/java/org/elasticsearch/index/mapper/AbstractGeometryFieldMapper.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/search/fetch/subphase/FieldFetcherTests.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/search/fetch/subphase/FieldFetcherTests.java
Outdated
Show resolved
Hide resolved
…ieldFetcherTests.java Co-authored-by: Alan Woodward <romseygeek@gmail.com>
…ieldFetcherTests.java Co-authored-by: Alan Woodward <romseygeek@gmail.com>
@elasticmachine run elasticsearch-ci/bwc |
💚 Backport successful
|
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
) 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
Thank you @cbuescher. |
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
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