I want to add an alias to the index in elasticsearch template, but the alias is not always fixed. Its prepended by a client id. Due to the size of the data, we are creating monthly indexes for each client separately, and I want a single to query the data from all monthly indexes. However, because each client has different indexes, the alias has to prepended by clientId. How can I achieve this?
Eg: my indexes are:
client1_01_18_user_location/user_location, client1_02_18_user_location/user_location
and
client2_01_18_user_location/user_location, client2_02_18_user_location/user_location
The data for the month of January goes to 1st index, and for Feb goes to 2nd index in each client's case. I want an alias client1_ul or client2_ul to be created, based on, for which client the data is being inserted.
How do I achieve this?
PUT /client1_01_18_user_location/_alias/client1_ul. Is there some problem with this approach?