title: elasticsearch script_score custom score function: how to replace missing values?
body: <p>I am looking at elasticsearch's documentation for how to create a script for a custom score function which uses fields that are not queried for scoring at <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html#function-script-score" rel="nofollow noreferrer">this</a> link.</p>
  
  <p>From what I can see you build a script function like so:</p>
  
  <pre><code>"script_score" : {
      "script" : {
        "lang": "painless",
        "inline": "_score * doc['my_numeric_field'].value"
      }
  }
  </code></pre>
  
  <p>but I am wondering what is the syntax for replacing <code>doc['my_numeric_field'].value</code> if it is missing?</p>