Can i use _score in sort with script?


(ganlinhao) #1

hi, i wanna use script in sort, but can i use _score like
GET /_search
{
"query" : {
"term" : { "user" : "kimchy" }
},
"sort" : {
"_script" : {
"type" : "number",
"script" : {
"lang": "painless",
"source": "_score/doc['field_name'].value"
},
"order" : "asc"
}
}
}