title: Painless new behaviour for nulls in version 7.x
body: <p>After the upgrade from version 6 to 7, we are experiencing a new behavior when processing aggregation. Now, whenever the Elastic comes across with a null value in a field while running a Painless script it breaks, by default.</p>
  
  <p>For example, the following simple if/else statement:</p>
  
  <pre><code>if(doc['MY_FIELD'].value &lt;= 9000) 
  {return 'Less than 9k' }
  else if(doc['MY_FIELD'].value &gt; 9000)
  { return ''More than 9k' }
  </code></pre>
  
  <p>Until version 6, we could run this code without any issue whatsoever. However now, if you try the same thing it fails when Elastic processes a single null value for the field.</p>
  
  <pre><code>  "lang" : "painless",
    "caused_by" : {
      "type" : "illegal_state_exception",
      "reason" : "A document doesn't have a value for a field! Use doc[&lt;field&gt;].size()==0 to check if a document is missing a field!"
  </code></pre>
  
  <p>That makes now mandatory to stuff this <code>"doc[&lt;field&gt;].size()==0"</code> checking everywhere.</p>
  
  <p>Is that a parameter to shut this new behavior off and resume the previous one?
  Thanks</p>