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
Check field scripts return serializable object #94877
base: main
Are you sure you want to change the base?
Check field scripts return serializable object #94877
Conversation
When a script field is used, the returned value must be serializable, sometimes with transport (if there is more than one node) and always with x-content. Currently returning a non-serializable value can result in errors later. This commit more aggressively checks the value returned from field scripts to ensure a more confusing error is not encountered.
Hi @rjernst, I've created a changelog YAML for you. |
💚 CLA has been signed |
d9b6bbd
to
5809075
Compare
Pinging @elastic/es-search (Team:Search) |
@romseygeek I opened this PR a while ago to generally stop objects returned by doc scripts from causing serialization errors. The PR has sat stalled because other failures (ie other classes that do not have either xcontent or transport available are returned by some test scripts). I just found your recent PR #95673 which changed the behavior to have the script fallback to My only difficult is finding a way to test this...ScriptFieldPhase does not have unit tests, and I don't see a way to make LeafReaderContext mockable, but maybe you have ideas on how to test it? |
When a script field is used, the returned value must be serializable, sometimes with transport (if there is more than one node) and always with x-content. Currently returning a non-serializable value can result in errors later. This commit more aggressively checks the value returned from field scripts to ensure a more confusing error is not encountered.