kkonrad
kkonrad

Reputation: 1262

How to create alias during index creation in Spring Data Elasticsearch?

My class looks like that:

@Document(indexName = "a")
@Mapping(mappingPath = "mapping-a.json")
public class A {

    @Id
    private String id;

What I would like to do is to instead of just creating and using index a here I would like to create some index and use alias (with some config) for it. Like in ES documentation example from Elasticsearch documentation:

enter image description here

The only solution that I can think of is to just "manually" create index on startup, but I was hoping for some built in feature in Spring Data Elasticsearch.

Upvotes: 1

Views: 740

Answers (1)

Abacus
Abacus

Reputation: 19431

We don't support creating an alias on index creation yet, you'd like to open an issue in Jira for that.

Your case looks like you should create an index template (available since Spring Data Elasticsearch 4.1) for the index name pattern logs_2030* that defines the alias, no need to specify this on the entity class.

Upvotes: 1

Related Questions