I'm trying to get some basic working by setting the _score of a document, using function scores and/or painless scripts. I plan to use the basic block to find the mechanism to build out my final use case. Sadly it already fails. My data looks like this:
{
"brand": "Apple",
"flavourScore": 1.1,
"price": 6.5
}
I have 9 items (3 Apples, 3 Bananas, 3 Tomatoes, differing in flavourScore and price). I've created 1 mapping for the index where they are in (couldn't post messages otherwise).
All documents have a _score of 1 by default. Mildly strange, but as I want to recompute the _score I don't care that much. I had tried a few examples found here and there, adapted them, but there is little in the form of debugging you can do. So I decided ny first test would be to just reset all the _score values to a different constant (as they are all 1 now as well). However.....nothing gets updated on ES64 (Docker image). Any clues why the GET on the _search endpoint for this index fails:
{
"query": {
"function_score": {
"query": {
"match_all": {}
},
"functions": [
{
"script_score": {
"script": {
"lang": "painless",
"inline": "_score = 0.18;"
}
}
}
],
"boost_mode": "replace"
}
},
"sort": [
"_score"
]
}
I'd expect all _score values to be 0.18 when I do a match_all query, but they stay 1.
Any insights, examples, clues are highly appreciated - especially as my next step will to have the script compute the value for _score
Thanks,
Maarten