# Updating arrays on elastic App Search

**URL:** https://discuss.elastic.co/t/updating-arrays-on-elastic-app-search/280692
**Category:** Elastic Search
**Tags:** elastic-app-search
**Created:** [August 7, 2021, 12:54am UTC](https://discuss.elastic.co/t/updating-arrays-on-elastic-app-search/280692 "2021-08-07T00:54:38Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Tiago\_Zwierzykowski](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tiago_zwierzykowski/32/79281_2.png) [@Tiago\_Zwierzykowski](https://discuss.elastic.co/u/Tiago_Zwierzykowski)
#### Post date: [August 7, 2021, 12:54am UTC](https://discuss.elastic.co/t/updating-arrays-on-elastic-app-search/280692/1 "2021-08-07T00:54:38Z")

</div>

I would like to know how to update arrays on Elastic App Search.

{

"Id":1,  
"Keywords": { ["test1", "test2", "test3"] }

}

Like on the example above I would like to change the 3rd item on the array to "test4".

---

<div class="post-metadata">

### Author: ![constancecchen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/constancecchen/32/71762_2.png) [@constancecchen](https://discuss.elastic.co/u/constancecchen)
#### Post date: [August 9, 2021, 5:39pm UTC](https://discuss.elastic.co/t/updating-arrays-on-elastic-app-search/280692/2 "2021-08-09T17:39:10Z")

</div>

You'd update the field the same way you update any other non-array field. Simply POST to the document ID with the same schema field name with the updated value, and the document will be updated accordingly.

Creation:

```auto
{
  "id": "12345",
  "some_field": "old_value",
  "some_array": ["old_value"]
} 

```

Update:

```auto
{
  "id": "12345",
  "some_field": "new_value",
  "some_array": ["new_value"]
}

```

You can also PATCH if you only want to update a specific schema field instead of the entire document: [Documents API | Elastic App Search Documentation [7.14] | Elastic](https://www.elastic.co/guide/en/app-search/current/documents.html#documents-partial)

---

<div class="post-metadata">

### Author: ![Tiago\_Zwierzykowski](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tiago_zwierzykowski/32/79281_2.png) [@Tiago\_Zwierzykowski](https://discuss.elastic.co/u/Tiago_Zwierzykowski)
#### Post date: [August 11, 2021, 12:26am UTC](https://discuss.elastic.co/t/updating-arrays-on-elastic-app-search/280692/3 "2021-08-11T00:26:20Z")

</div>

What about when the array have more than 1 item?

{

"id" : 1,  
"some\_array" : ["test1", "test2", "test3"]

}

I just want to update the second item on the array  
"test2" to "test4"?

{

"id" : 1,  
"some\_array" : ["test1", "test4", "test3"]

}

How to do it?

---

<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: [September 8, 2021, 12:27am UTC](https://discuss.elastic.co/t/updating-arrays-on-elastic-app-search/280692/4 "2021-09-08T00:27:11Z")

</div>

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