# No field found in mapping while executing custom score script

**URL:** https://discuss.elastic.co/t/no-field-found-in-mapping-while-executing-custom-score-script/76087
**Category:** Elasticsearch
**Created:** [February 22, 2017, 5:36pm UTC](https://discuss.elastic.co/t/no-field-found-in-mapping-while-executing-custom-score-script/76087 "2017-02-22T17:36:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Shashank\_Shekhar](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@Shashank\_Shekhar](https://discuss.elastic.co/u/Shashank_Shekhar)
#### Post date: [February 22, 2017, 5:36pm UTC](https://discuss.elastic.co/t/no-field-found-in-mapping-while-executing-custom-score-script/76087/1 "2017-02-22T17:36:24Z")

</div>

I've been struggling with this issue for hours now. I am trying to implement custom score in my search using script score (groovy).

Mapping :

```
{
"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"
			}
		}
	}
}

```

(m\_skill is an array)

Query :

```
{"match_all":{}}

```

Score script :

```
return doc['m_skill'].values.star_wt.sum()

```

Error :

```
No field found for [m_skill] in mapping with types [peopleworld]

```

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?

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?

Any help will be much welcomed.

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [February 27, 2017, 9:15am UTC](https://discuss.elastic.co/t/no-field-found-in-mapping-while-executing-custom-score-script/76087/2 "2017-02-27T09:15:13Z")

</div>

Hey,

a full reproduction (including index creation, document creation, query with the full groovy scripts), would help here.

--Alex

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 27, 2017, 9:15am UTC](https://discuss.elastic.co/t/no-field-found-in-mapping-while-executing-custom-score-script/76087/3 "2017-03-27T09:15:45Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
