# Using an array as parameter for update script

**URL:** https://discuss.elastic.co/t/using-an-array-as-parameter-for-update-script/269562
**Category:** Elasticsearch
**Created:** [April 8, 2021, 7:45am UTC](https://discuss.elastic.co/t/using-an-array-as-parameter-for-update-script/269562 "2021-04-08T07:45:48Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![yen\_l\_ng\_th](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yen_l_ng_th/32/65467_2.png) [@yen\_l\_ng\_th](https://discuss.elastic.co/u/yen_l_ng_th)
#### Post date: [April 8, 2021, 7:45am UTC](https://discuss.elastic.co/t/using-an-array-as-parameter-for-update-script/269562/1 "2021-04-08T07:45:48Z")

</div>

I am using ElasticSearch 6.8, I want to update many documents at the same time. So I use update by query

` {  
"index": "index",

```
  "type": "type"
  "body": {
    "query" : {
      "bool" :{
        "must" :{
          "terms" :{
            "id" :[828]
          }
        }
      }
    },
    "script" : {
      "inline" : "ctx._source['number_member'] = params.member[ctx._source['id']]"
      "lang": "painless"
      "params": {
        "member" : [
          828 =>2
        ]
      }
    }
  }
}`

```

But this params.member [ctx.\_source ['id']] cannot get a value.  
What I have to do. thanks

---

<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: [May 6, 2021, 7:46am UTC](https://discuss.elastic.co/t/using-an-array-as-parameter-for-update-script/269562/2 "2021-05-06T07:46:32Z")

</div>

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