-
Notifications
You must be signed in to change notification settings - Fork 25k
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
nested/object field access in scripts should throw an appropriate error #23719
Comments
+1 makes sense to give a useful exception when trying to access nested/object fields. If you try to access a concrete field under nested today, it might succeed if include_in_parent/root are enabled. I think once include_in_parent/root are removed (see #12461) then we could throw an exception for concrete nested fields too. |
Hi, can I take this issue? |
I wonder if this statement is still valid for Elasticsearch 6.1.0:
In Elasticsearch 6.1.0, actually we can read and write nested objects in scripts, with no Proof of concept
It returns:
Notice that the second user's last name is correctly mutated. |
@MrOrz nested documents are always available via _source. This issue is about accessing them from docvalues within a scoring script for search. |
I see. Didn't notice the difference in subjects. |
In |
Hi Folks, I am thinking if we support this now? I came from this https://discuss.elastic.co/t/can-not-access-array-with-objects-in-painless/198226. |
@rjernst Is this still something we're going to fix at some point? |
Pinging @elastic/es-core-infra (Team:Core/Infra) |
When trying to access a nested or object field within a script, the behavior is different depending on the method called. When trying to retrieve the value of the field, an exception is thrown saying the field does not exist (when it fact it is simply not a field mapper). If you try to check if the doc contains the field, it simply returns false, again incorrectly since the field does exist, just not as a field mapper. I think we should throw an error in both these cases, but with a good message that indicates the field exists but is not accessible in scripts. Note that I'm not sure what happens when trying to access a concrete field that is parented by a nested field. I believe I have seen issues for it before where the field just comes back as no values. I think we should throw an error in this case as well.
The text was updated successfully, but these errors were encountered: