I'm trying to send a list of lookup-values as parameters to a function_score script.
I'm trying to supply the script with a map of ID's that it will use to lookup the current documentId and use whatever value exists in the map for some calculation.
This is somewhat what i'm trying to do, but of course it doesn't compile.
ES 5.3.2
{
"query": {
"function_score": {
"script_score": {
"script" : {
"params": {
"mapValues": {
"A": 1.5, //Custom value for document with ID=A
"B": 1.6, //Custom value for document with ID=B
"C": 1.7 //Custom value for document with ID=C
}
},
"inline": "def mapValue = params.mapValues.get(doc.Id); /* Do something */ "
}
}
}
}
}
I know I could just use two arras and a loop (one with ids and another with values), but that would require the array to be iterated for every document, which is not optimal for performance reasons.
Does painless support any type of complex objects as parameters?