Parameters in inline script


(Leo Li) #1

Hi, does below query ever work in Elasticsearch 5.x?

"inline": "doc['my_field'] * multiplier",
"params": {
"multiplier": 2
}

Whenever I use parameters in query I always got compile errors. The query is from documentation:
https://www.elastic.co/guide/en/elasticsearch/reference/5.1/modules-scripting-using.html#reload-scripts


(Leo Li) #2

It turns out the Elasticsearch documentation is wrong, you should add "params." in front of the variables in order to access its values.
https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-script-fields.html


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.