-
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
Apply workaround for synthetic source of object arrays inside nested objects #115275
Conversation
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
// Synthetic source is generated by a unique synthetic field loader for | ||
// every nested document meaning that there are no conflicts between different objects in an array | ||
// that are possible for plain objects and that need to be handles by a second parsing pass. | ||
// It is however possible that inside this nested object we'll eventually be in the array scope. | ||
cloned.inArrayScope = false; |
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.
Previously we completely disabled second parsing pass logic for nested objects. However since NameValue
contains current lucene doc it actually works as expected and ignored values are added to correct document.
Okay, there is a case when this does not work. |
I was wondering if this commit is related: e7108ae |
So the problem is (kind of) here elasticsearch/server/src/main/java/org/elasticsearch/index/mapper/DocumentParser.java Line 171 in bc57bb0
Even though we have a correct |
I mean, define "not work".. It's not perfect, but ordering and duplicates are preserved? |
If we put "void" in all nested documents except last one it will kind of work :D |
7343e2a
to
7854c52
Compare
Since my original fix did not work, i have changed this PR to apply a workaround of always storing object arrays inside nested objects. |
objectWithFallbackSyntheticSource = mode == Mapper.SourceKeepMode.ALL | ||
|| (mode == Mapper.SourceKeepMode.ARRAYS && objectMapper instanceof NestedObjectMapper == false) | ||
// Inside nested objects we always store object arrays as a workaround for #115261. | ||
|| context.inNestedScope(); |
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 it's more nuanced.. the check above bypasses storing array source for nested objects, as they exist for this exact reason.
Can we detect that there are deeply nested arrays and store source only for them? Maybe
|| (context.inNestedScope() && objectMapper instanceof NestedObjectMapper == false))
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.
That should work!
@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.
LGTM
💔 Backport failed
You can use sqren/backport to manually backport by running |
… objects (elastic#115275) (cherry picked from commit f04bf5c) # Conflicts: # rest-api-spec/build.gradle # rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.create/21_synthetic_source_stored.yml
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
…ested objects (#115275) (#115467) * Apply workaround for synthetic source of object arrays inside nested objects (#115275) (cherry picked from commit f04bf5c) # Conflicts: # rest-api-spec/build.gradle # rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.create/21_synthetic_source_stored.yml * Fix merge
This PR applies workaround for #115261.