Using term position to re-score

Hi
I'm trying to create a script to modify the score of my queries.
I want to access the position of a word in the results I am obtaining.
For example the word: "global" in the string name= "Global corporation". So I want to know that global is the position: 1
I'm doing it with painless :

"functions": [
{
"script_score": {
"script": "doc['nombre'].get('Global',_POSSITION)"
}
}
]

But I am obtaining compling errors with : Possition. (Global is the word I want to know the possition). This is just a try to see if I can obtain the position of a word . I have performed

GET index/doc/1/termvectors?field=nombre

And I can see that the position of the tokens are stored there.

How can I acess that value in my script?

Thanks!

1 Like

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