1

How to implement ElasticSearch new index creation after every fix number of days and if its possible then how to search over all the previous indexes? Currently we have only one index which has all the data. I looked at the RollOver API of ES, is this the correct way? But the problem seems when we want to search for some data in previous indexes, how this can be done? Any answers are appreciated, Thanks.

Amit
  • 30,756
  • 6
  • 57
  • 88
pramodi
  • 11
  • 2

1 Answers1

1

Yes, you are on the correct path, for searching into your old indices, you can link multiple indices to one alias, using alias API, and instead of searching for a single index, you need to search again the unified alias.

Refer to this official example on how to link multiple indices to the same alias(alias1 in the below example)

POST /_aliases

{
  "actions" : [
    { "add" : { "index" : "test1", "alias" : "alias1" } },
    { "add" : { "index" : "test2", "alias" : "alias1" } }
  ]
}
Amit
  • 30,756
  • 6
  • 57
  • 88
  • Can you please be more specific, to implement alias API in java, how to automate all the created indices? – pramodi Oct 28 '20 at 10:09
  • @pramodi for java code, would advise you to ask a new question where you show what your code and what issue you are facing with that, and somebody having exp. with that will reply, I need to work on the java code but as ES is REST API based and this answer explains the concept. – Amit Oct 28 '20 at 11:16
  • @pramodi did you get a chance to look at my previous comments?? – Amit Nov 19 '20 at 17:00