title: Elasticsearch : No field found in mapping while executing custom score script
body: <p>I've been struggling with this issue for hours now. I am trying to implement custom score in my search using script score (groovy). </p>
  
  <p>Mapping : </p>
  
  <pre><code>{
  "properties": {
      "m_skill": {
          "properties": {
              "actual_period": {
                  "type": "long"
              },
              "area_display": {
                  "type": "string"
              },
              "c": {
                  "type": "double"
              },
              "capability": {
                  "type": "string"
              },
              "capability_display": {
                  "type": "string"
              },
              "order_wt": {
                  "type": "double"
              },
              "skillarea": {
                  "type": "string"
              },
              "star_wt": {
                  "type": "double"
              },
              "w": {
                  "type": "double"
              }
              }
          }
      },
      "personid": {
          "type": "string"
      },
      date_of_creation": {
          "type": "long"
      },
      "phone": {
          "properties": {
              "c": {
                  "type": "long"
              },
              "v": {
                  "type": "string"
              }
          }
      }
  }
  </code></pre>
  
  <p>(m_skill is an array)</p>
  
  <p>Query : </p>
  
  <pre><code>{"match_all":{}}
  </code></pre>
  
  <p>Score script : </p>
  
  <pre><code>return doc['m_skill'].values.star_wt.sum()
  </code></pre>
  
  <p>Error : </p>
  
  <pre><code>No field found for [m_skill] in mapping with types [peopleworld]
  </code></pre>
  
  <p>But I don't get any exception when I try the same with "date_of_creation".
  I found some people talking about the same issue but hardly any post has replies. Has anyone faced an issue like this. What am I doing wrong?</p>
  
  <p>Another question, my formula is way complex then I wrote above. In simple language, it is like when a user asks for a set of skills I pick documents having asked skills and depending on their star_wt I award them a score which is used to sort the final result set. Is it a good idea to implementing the same using elasticsearch custom score?</p>
  
  <p>Any help will be much welcomed.</p>