Automatic copying of document

I have two indices, let's say

  • index1
  • index2 (clone of index1)

I always write documents to index1.
Is there a way to automatically trigger a copy of the document from index1 to index2, every time I write a document into the index1?

That might be doable with this:

Not sure though as it's normally made to replicate to another cluster. Also it requires a platinum license or a trial.

What about solving that problem from the application which writes the data to elasticsearch?

Otherwise a snapshot and restore with rename?

Thanks David. Yes, application writing into both indices is easiest way to do this.
Actually, my original problem is that, I want to create two index pattern for the same data. I have two separate timestamps in my data and I want to visualize my data based on two different time filters. I couldn't do that. So I'm creating clone of the data and then using a second time filter field on the cloned data.

You should instead may be solve that problem.

I'd recommend using an alias like:

PUT /index1/_alias/index2

And then you can hopefully create 2 Index Patterns in Kibana:

  • One on index index1 using the first timestamp field
  • One on alias index2 using the second timestamp field

No need to copy indices in that case.

Thanks a lot David, "alias" is exactly what solves my problem

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