title: Elasticsearch - Script filter on array
body: <p>I'm a new bie in ES and I want to use script filter to get all match that the array has at least one element less than max and greater than min (max and min are param in the script).</p>
  
  <p>The document like:</p>
  
  <pre><code> {
    "number": "5",
    "array": {
      "key": [
        10,
        5,
        9,
        20
      ]
    }
  }
  </code></pre>
  
  <p>I tried the script but it does not work</p>
  
  <pre><code>{
    "script": {
      "lang": "groovy",
      "params": {
        "max": 64,
        "min": 6
      },
      "script": "for(element in doc['array.key'].values){element&gt;= min + doc['number'].value &amp;&amp;  element &lt;=max + doc['number'].value}"
    }
  }
  </code></pre>
  
  <p>There is no error message but the search result is wrong.Is there a way to iterate array field? </p>
  
  <p>Thank you all.</p>