# Update By Query leads to "lang cannot be specified for stored scripts"

**URL:** https://discuss.elastic.co/t/update-by-query-leads-to-lang-cannot-be-specified-for-stored-scripts/112686
**Category:** Elasticsearch
**Created:** [December 20, 2017, 5:09pm UTC](https://discuss.elastic.co/t/update-by-query-leads-to-lang-cannot-be-specified-for-stored-scripts/112686 "2017-12-20T17:09:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jughead](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jughead/32/25869_2.png) [@jughead](https://discuss.elastic.co/u/jughead)
#### Post date: [December 20, 2017, 5:09pm UTC](https://discuss.elastic.co/t/update-by-query-leads-to-lang-cannot-be-specified-for-stored-scripts/112686/1 "2017-12-20T17:09:04Z")

</div>

Version: Elasticsearch 6.0.0

```auto
POST _scripts/blablabla
{
  "script": {
    "source": "ctx._source.field2 = params.t.field2",
    "lang": "painless"
  }
}
PUT test/foo/1
{
  "user_id": 10,
  "field1": "value1",
  "field2": 12
}
POST test/foo/_update_by_query
{
  "query": {
    "bool": {
      "must": [{
       "term": { "user_id": 10 } 
      }]
    }
  },
  "script": {
    "id": "blablabla",
    "params": {
      "t": {
        "filed2": 13
      }
    }
  }
}

```

leads to

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "lang cannot be specified for stored scripts"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "lang cannot be specified for stored scripts"
  },
  "status": 400
}

```

Playing around lang value by removing/moving/setting to blank doesn't help.

---

<div class="post-metadata">

### Author: ![luiz.santos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luiz.santos/32/24664_2.png) [@luiz.santos](https://discuss.elastic.co/u/luiz.santos)
#### Post date: [December 29, 2017, 10:51am UTC](https://discuss.elastic.co/t/update-by-query-leads-to-lang-cannot-be-specified-for-stored-scripts/112686/2 "2017-12-29T10:51:08Z")

</div>

Hi @jughead,

Thank you for your report. I opened an issue for it:

> <https://github.com/elastic/elasticsearch/issues/28002>

Cheers,  
LG

---

<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: [January 26, 2018, 10:51am UTC](https://discuss.elastic.co/t/update-by-query-leads-to-lang-cannot-be-specified-for-stored-scripts/112686/3 "2018-01-26T10:51:15Z")

</div>

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