# NotFoundError

**URL:** <https://discuss.elastic.co/t/notfounderror/365150>\
**Category:** Elasticsearch\
**Created:** [August 19, 2024, 2:48pm UTC](https://discuss.elastic.co/t/notfounderror/365150 "2024-08-19T14:48:36Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [August 19, 2024, 2:48pm UTC](https://discuss.elastic.co/t/notfounderror/365150/1 "2024-08-19T14:48:36Z")

</div>

Hi,

I have alias in which a number of index are associated  
When I want to update documents using alias it returns this error to me

From Update Method-\>  
NotFoundError(404, 'document missing exception', '[ks5N 44B1PKbfTI3X1IX]: document missing')

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [August 19, 2024, 3:00pm UTC](https://discuss.elastic.co/t/notfounderror/365150/2 "2024-08-19T15:00:18Z")

</div>

You can only index into or update through an alias if it is associated with a single index. If it links to multiple indices it is read-only.

---

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [August 19, 2024, 3:08pm UTC](https://discuss.elastic.co/t/notfounderror/365150/3 "2024-08-19T15:08:41Z")

</div>

But I need that because I have data very much when I store it in one index, the index reaches a certain limit and stops absorbing the data, so I did this method through the index template so that when the index reaches 22 m, it creates a new index and the data is entered to it via alias

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [August 19, 2024, 3:10pm UTC](https://discuss.elastic.co/t/notfounderror/365150/4 "2024-08-19T15:10:12Z")

</div>

It is not possible so you will unfortunately neeed to find a different solution.

---

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [August 19, 2024, 3:13pm UTC](https://discuss.elastic.co/t/notfounderror/365150/5 "2024-08-19T15:13:26Z")

</div>

Well, what solution do you recommend?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 19, 2024, 3:24pm UTC](https://discuss.elastic.co/t/notfounderror/365150/6 "2024-08-19T15:24:13Z")

</div>

[Update By Query API | Elasticsearch Guide [8.15] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html) might work for you.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [August 19, 2024, 3:24pm UTC](https://discuss.elastic.co/t/notfounderror/365150/7 "2024-08-19T15:24:32Z")

</div>

I do not know your use case or constraints so it is hard to tell, but I can give some suggestions. The easiest way to handle updates is to have a single index with a sufficient number of primary shards to handle the expected growth. If you want to have multiple distinct indices you may need to query for the index before updating unless you somehow can know client side which index the document was indexed into.

Update-by-query, as suggested by David, can work if your update rate is reasonably low. It basically bundles the seraching and update into a single API call and can update multiple documents if needed.

---

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [August 19, 2024, 3:33pm UTC](https://discuss.elastic.co/t/notfounderror/365150/8 "2024-08-19T15:33:56Z")

</div>

Thank you  
Can I modify the number of shards for an index that has data in it

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [August 19, 2024, 3:40pm UTC](https://discuss.elastic.co/t/notfounderror/365150/9 "2024-08-19T15:40:48Z")

</div>

No, you can not change the number of primary shards of an existing index. What you however can do is the following:

- Stop indexing and updating of the index.
- Use the [split index APi](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-split-index.html) to create a new index based on the existing one with a higher number of primary shards.
- Switch to using this new index for indexing and updating. If you want to keep the index name you can delete the initial index and then create an alias with the initial index name that just points to the new index.

---

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [August 19, 2024, 3:46pm UTC](https://discuss.elastic.co/t/notfounderror/365150/10 "2024-08-19T15:46:31Z")

</div>

OK  
What about the data in the old catalogue?  
Can I transfer data from alias to the new index?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [August 19, 2024, 3:59pm UTC](https://discuss.elastic.co/t/notfounderror/365150/11 "2024-08-19T15:59:34Z")

</div>

You can use the [reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html) to copy data from one index to another.

---

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [August 19, 2024, 6:35pm UTC](https://discuss.elastic.co/t/notfounderror/365150/12 "2024-08-19T18:35:49Z")

</div>

ok

Thank you
