NotFoundError

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')

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.

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

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

Well, what solution do you recommend?

Update By Query API | Elasticsearch Guide [8.15] | Elastic might work for you.

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.

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

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 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.

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

You can use the reindex API to copy data from one index to another.

ok

Thank you