title: Elasticsearch: Return empty value from script field
body: <p>I'm using Elasticsearch, and I have a script field written in Groovy. It needs to replace the value of <code>myField</code> for some values, but I want to let most of the values pass through unchanged. The script below works except for documents that don't have the field at all. How can I make the script field value empty?</p>
  
  <pre><code>if (some criteria) {
      return ...; // modified value
  }
  //  This returns 0 if myField doesn't exist
  return doc['myField'].value
  </code></pre>
  
  <p>I can check the empty condition, but I haven't found a way to return an empty value:</p>
  
  <pre><code>if (doc['myField'].empty)
      return ???
  </code></pre>