Within painless scripts I use for script queries (in a filter context), sort scripts and script fields, I need to refer to the JSON structure of the source document, which is fairly complex and has several arrays of objects within its structure (stored as nested fields).
The queries I write are analytics-heavy so performance isn't the most important thing.
To refer to the document source, I'm able to refer to
params._source within painless when I'm writing a script field or a sort script. But this
params._source field is missing when I'm writing a script query.
Is there a way around this? I cannot do
path.to is a nested object, and I need to run a for loop through the objects in