Scoring based on nested objects and function score


(vineeth mohan-2) #1

Hi ,

I have a document like below -
Here items made nested in the mapings.
{
"shopName" : "royal super market",
"geo": "1.234,2.121",
"items": [
{
"name": "rubber",
"relevancy": 20
},
{
"name": "pen",
"relevancy": 10
}
]
}
Here i want to query on shopName , filter based on certain items and then score document based on geo and matched item names relevancy field.
I was hoping to push everything to functions in function score query.
But i cant seem to find anyway to get relevancy field value inside functions function of function_score.
Script does not seem to be able to pick values from inside nested object ( that is without touching _source )

Let me know if there is any method to do this ?

Thanks
Vineeth


(Ramy) #2

It's not this what you are looking for?
https://www.elastic.co/guide/en/elasticsearch/guide/current/nested-sorting.html


(system) #3