Elasticsearch script query get parameter by field value
<p>I am trying to filter results with script query. 
I can access parameter values with hardcoded field value like this:</p>

<pre><code>"script": "doc['price'].value * params.1000 &gt; 4000",
      "params": {"1000": "1.75"}
</code></pre>

<p>But if I try to get field value with doc there is no filtering and I can see all results.</p>

<pre><code>    "script": "doc['price'].value * params.doc['rate'] &gt; 4000",
      "params": {"1000": "1.75"}
</code></pre>

<p>Is there any solution to dynamically get parameter value?</p>

<p>EDIT:</p>

<p>The Field 'rate' is just the ID. It is Integer but it is not value I need. The idea is to pass every time different value, via parameter, instead updating field 'rate' frequently. Hope This is better explanation...</p>

<p>example:</p>

<pre><code>"script": "doc['price'].value * params.doc['rate'] &gt; 4000",
  "params": {
              "1000": "1.75",
              "1001": "3.75",
              "1002": "5"
            }

if 
'price' == 10 &amp;&amp;
'rate' == 1002
result should be: 10 * 5 &gt; 4000  

if 
'price' == 10 &amp;&amp;
'rate' == 1001
result should be: 10 * 3.75 &gt; 4000

if 
'price' == 7 &amp;&amp;
'rate' == 1000
result should be: 7 * 1.75 &gt; 4000   
</code></pre>