Elasticsearch painless script error
<p>I have no Java experience and I have an issue with elasticsearch painless script language. (the name painless it's not well chosen).</p>

<p>For the following code I get the error:</p>

<pre><code>{"lang": "painless",
"inline": "float price = doc['newPrice'] &gt; 0.0 ? doc['price'] / doc['newPrice'] : 0; _score * params.constant * price",
"params": {"constant": 1.2}}}}
</code></pre>

<blockquote>
  <p>Cannot apply [>] operation to types
  [org.elasticsearch.index.fielddata.ScriptDocValues.Doubles] and
  [java.lang.Double].</p>
</blockquote>

<p>I tied to cast it as float with (float) doc['newPrice'] > 0 with the same error.</p>

<p>Then I changed to <code>"Double price = ((Double)doc['discountPrice'] &gt; 0.0) ? doc['price'] / doc['discountPrice'] : 0; _score * params.constant * price",</code></p>

<p>And received:</p>

<blockquote>
  <p>'Cannot cast from [Double] to [double].'</p>
</blockquote>

<p>Can somebody help me, tried lots of variations with similar kind of errors.
Damn painless language...</p>