We use AWS Elasticsearch, which support Painless scripting from version 5. I need an access to term positions/offsets in my custom score script.
In old Groovy scripting it worked:
"query": {
"function_score": {
"query": {"match_phrase": {"text": "life"} },
"script_score": {
"script": {
"lang": "groovy",
"inline": "termInfo=_index['text'].get('life', _POSITIONS);"
}
},
"boost_mode": "multiply"
}
}
But it does not work with Painless. It returns 'compile error'.