title: elasticsearch filter by length of a string field
body: <p>i am trying to get records the has in 'title' more then X characters.</p>
  
  <p>NOTE: not all records contains title field.</p>
  
  <p>i have tried:</p>
  
  <pre><code>GET books/_search
  {
      "filter" : {
            "script" : {
                "script" : "_source.title.length() &gt; 10"
            }
        }
  }
  </code></pre>
  
  <p>as a result, i get this error:</p>
  
  <pre><code>GroovyScriptExecutionException[NullPointerException[Cannot invoke method length() on null object
  </code></pre>
  
  <p>how can i solve it?</p>