I have no Java experience, and I have a problem with the ridiculous language elasticsearch script. (the name is painless, which he did not choose well).
For the following code, I get an error:
{"lang": "painless",
"inline": "float price = doc['newPrice'] > 0.0 ? doc['price'] / doc['newPrice'] : 0; _score * params.constant * price",
"params": {"constant": 1.2}}}}
Cannot apply operation [>] to types [org.elasticsearch.index.fielddata.ScriptDocValues.Doubles] and [Java.lang.Double].
I linked it as a float with (float) doc ['newPrice']> 0 with the same error.
Then i changed to "Double price = ((Double)doc['discountPrice'] > 0.0) ? doc['price'] / doc['discountPrice'] : 0; _score * params.constant * price",
And received:
'Cannot be included from [Double] to [double].
Can someone help me, tried many options with similar errors. Damn painless tongue ...
source
share