# Scripts in elastic search gives error

**URL:** https://discuss.elastic.co/t/scripts-in-elastic-search-gives-error/109526
**Category:** Elasticsearch
**Created:** [November 29, 2017, 7:29am UTC](https://discuss.elastic.co/t/scripts-in-elastic-search-gives-error/109526 "2017-11-29T07:29:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![anilagrawal6991](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@anilagrawal6991](https://discuss.elastic.co/u/anilagrawal6991)
#### Post date: [November 29, 2017, 7:29am UTC](https://discuss.elastic.co/t/scripts-in-elastic-search-gives-error/109526/1 "2017-11-29T07:29:36Z")

</div>

hello,  
I am using ES 2.3 on my system and create index on ES using sense

PUT my\_index/my\_type/1  
{  
"my\_field": 5  
}

and now i using script to search data

GET my\_index/\_search  
{  
"script\_fields": {  
"my\_field": {  
"script": {  
"lang": "expression",  
"source": "doc['my\_field'] \* multiplier",  
"params": {  
"multiplier": 2  
}  
}  
}  
}  
}

but it gives me error

```
{

```

"error": {  
"root\_cause": [  
{  
"type": "script\_parse\_exception",  
"reason": "unexpected field [source]"  
}  
],  
"type": "search\_phase\_execution\_exception",  
"reason": "all shards failed",  
"phase": "query",  
"grouped": true,  
"failed\_shards": [  
{  
"shard": 0,  
"index": "my\_index",  
"node": "u0TrOlcjT0yyMYIEPl1nwQ",  
"reason": {  
"type": "script\_parse\_exception",  
"reason": "unexpected field [source]"  
}  
}  
]  
},  
"status": 500  
}

---

<div class="post-metadata">

### Author: ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)
#### Post date: [November 29, 2017, 4:47pm UTC](https://discuss.elastic.co/t/scripts-in-elastic-search-gives-error/109526/2 "2017-11-29T16:47:04Z")

</div>

The `source` key was added in 5.6. In 2.4, you need to use `inline`.

---

<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: [December 27, 2017, 4:47pm UTC](https://discuss.elastic.co/t/scripts-in-elastic-search-gives-error/109526/3 "2017-12-27T16:47:04Z")

</div>

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