I have the following query (below), but I can't figure out how to do that in the JS client.
I couldn't find both script_score (1) inside the query, but also script_fields (2) inside the body.
Is this supported in the client?
GET test-index/_search
{
"query": {
"function_score": {
"query": {
"range": {
"value": { "lte": 20 }
}
},
"script_score": { <-- (1)
"script": { "source": "doc['value'].value < 21 ? 1 : 0" }
}
}
},
"script_fields": { <-- (2)
"value_below_21": {
"script": { "inline": "return doc['value'].value < 21 ? 1 : 0" }
}
}
}