# Elastic Search ILM implementation - Upsert issue

**URL:** https://discuss.elastic.co/t/elastic-search-ilm-implementation-upsert-issue/295192
**Category:** Elasticsearch
**Tags:** ilm-index-lifecycle-management
**Created:** [January 24, 2022, 8:27am UTC](https://discuss.elastic.co/t/elastic-search-ilm-implementation-upsert-issue/295192 "2022-01-24T08:27:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![manikantavarma20](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@manikantavarma20](https://discuss.elastic.co/u/manikantavarma20)
#### Post date: [January 24, 2022, 8:27am UTC](https://discuss.elastic.co/t/elastic-search-ilm-implementation-upsert-issue/295192/1 "2022-01-24T08:27:28Z")

</div>

We have 2 indices - "event" and "event-001"  
"event-001" is created by using ILM

Both the indices have the same alias "event\_"  
It is used to fetch and update the data in the above 2 indices

Query:  
GET event\_/_alias  
Result:  
{  
"event-001" : {  
"aliases" : {  
"event_" : {  
"is\_write\_index" : true  
}  
}  
},  
"event" : {  
"aliases" : {  
"event\_" : { }  
}  
}  
}

Problem scenario:  
When there's a record in the "event" index with "_id" as ab1 and it is not present "event-001"  
I try to update the record using the alias index as below.  
Query:  
POST event_/\_update/ab1

{  
"doc": {  
"city": "vijayawada"  
},  
"doc\_as\_upsert": true  
}

Instead of updating in the "event" index, it is adding a new entry in the newly created "event-001" index.

How can I update an index where a record is present?

Can you please help on this.

---

<div class="post-metadata">

### Author: ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)
#### Post date: [January 24, 2022, 2:23pm UTC](https://discuss.elastic.co/t/elastic-search-ilm-implementation-upsert-issue/295192/2 "2022-01-24T14:23:31Z")

</div>

Using [ILM automatic rollover](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-rollover.html#ilm-automatic-rollover), [write\_index](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html#indices-aliases-api-request-body) is automaticaly set to the new index. You can use [Update by query API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html#docs-update-by-query-api-source) to update docs but upsert seems difficult.

---

<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: [February 21, 2022, 2:24pm UTC](https://discuss.elastic.co/t/elastic-search-ilm-implementation-upsert-issue/295192/3 "2022-02-21T14:24:06Z")

</div>

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