My question is why are their two script keys? Are there other keys that can be placed in the upper most script object to alter behaviour? Is this simply a legacy of removed functionality? This doesn't occur with scripted aggregations or scoring, only in queries, and I've not managed to find anything in the current documentation to offer insight as to why it might be this way.
It's a bit of legacy and unfortunate naming. The outer script is the name of the query. The inner script is the parameter to specify the script. If you use the default scripting language with inline scripts, and no parameters, then you can have the value of the key be a string, like this:
Note that it might be possible to rework the parsing of the inner script, to remove the extra layer, but extra care would need to be taken with backcompat. The confusion on naming is especially relevant given the new script score query that is being worked on, which may warrant some cleanup on the filter script query. /cc @mayya
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.