# Error when accessing \_index in script\_score

**URL:** <https://discuss.elastic.co/t/error-when-accessing--index-in-script-score/63109>\
**Category:** Elasticsearch\
**Created:** [October 15, 2016, 2:18pm UTC](https://discuss.elastic.co/t/error-when-accessing--index-in-script-score/63109 "2016-10-15T14:18:28Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![YanhaoYang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yanhaoyang/32/13910_2.png) [@YanhaoYang](https://discuss.elastic.co/u/YanhaoYang)\
**Post date:** [December 15, 2016, 9:32am UTC](https://discuss.elastic.co/t/error-when-accessing--index-in-script-score/63109/2 "2016-12-15T09:32:02Z")

</div>

It seems `_index` is not supported in painless language. Change "lang" to "groovy", and the query will work. Also note that you need to turn on groovy inline script in ES 5.

---

_[View the full topic](https://discuss.elastic.co/t/error-when-accessing--index-in-script-score/63109)._
