elasticsearch
elasticsearch copied to clipboard
Don't modify source map when parsing composite runtime field
When calling RuntimeField.parseRuntimeFields()
for fields defined in the
search request, we need to wrap the Map containing field definitions in another
Map that supports value removal, so that we don't inadvertently remove the
definitions from the root request. CompositeRuntimeField was not doing this
extra wrapping, which meant that requests that went to multiple shards and
that therefore parsed the definitions multiple times would throw an error
complaining that the fields parameter was missing, because the root request
had been modified.
Pinging @elastic/es-search (Team:Search)
Hi @romseygeek, I've created a changelog YAML for you.
OK this doesn't quite work because we need to distinguish between parsing at mapping time or at search time within the composite field as well. I'm digging further...
Actually it looks as though it was a bug in serialization that wasn't caught before because the fields map was being emptied at parse time and so the unnecessary code to output it never actually got triggered. This is ready for review now @javanna
@elasticmachine update branch