Description
First of all, apologies if this was already asked. I have tried to fiend other issues detailing this problem, but I have only found #2112, which seems similar but not the same.
We have a big index which is only going to grow, so we want to reindex it to an alias which points to a set of indices with automatic rollover.
We would like to only interact with the indices using the alias, but we need to update and delete specific documents in any of the indices, which Elasticsearch does not allow through the alias due to possible _id conflicts. This means that in our application we will have to manually retrieve the _index from each SearchHit and then call ElasticsearchRestTemplate.update
or ElasticsearchRestTemplate.delete
with the appropriate index coordinates.
I was wondering if it would be possible to:
- use an annotation to map the value of _index inside the Document in a similar way to the
@Id
annotation (this means we would not need to get it manually from the SearchHits); - perform update, delete and save operations on the index mapped in the Document, if present (otherwise, the index used would be the indexName defined in the
@Document
annotation).
The second point would also apply to repositories.
We are evaluating the possibility of extending ElasticsearchRestTemplate to override methods and include the functionality described above.
Please let me know if this sounds as a reasonable suggestion!