Multiple indices, one alias..single document_id possible?

(Justin Cross) #1

Hi, when we have a single index elasticsearch updates the existing document if a new db row comes in from logstash jdbc for a document_id that already exists in elasticsearch, otherwise inserts. That is great but now we want that between multiple indices. We started creating a new index each day for purging reasons like this:


We want to know if it's possible to use the same alias for each index and have the alias be used when storing new documents into the indices. Our situation is that we want to update the existing document when a new oracle row comes in that matches the document_id of an existing index instead of making new document in the next days index.

For example , if search-05-25-2017 contains document_id 1, and it is now the 26th, we want to add to elasticsearch through the alias and it automatically update the document if it exists in any of the indices of that alias, otherwise insert into todays index. So if another row with id 1 comes in, we want it to update search-05-25-2017 instead of adding to today's index.

Is that possible?

(Christian Dahlqvist) #2

No, that is not possible. You can only index or update through an alias if it is only linked to a single underlying index. If you have a field in the database that dictates which index the record went to, e.g. creation date, you could build logic around this. Otherwise I can not think of any other way than search to find the record before updating or look it up somewhere else, e.g. in a separate index that this type of data.

(system) #3

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