If your application only requires a single index, you can use the SingleIndexElasticsearchService to create and delete the index:
When using the SingleIndexElasticsearchService and the DefaultElasticConfiguration, the index name and index alias are defined by
elasticsearch.properties:
Default configuration
elasticsearch.properties
#elasticsearch.index.alias=default
## Index name prefix (property 'elasticsearch.index.alias' will be used when empty)
#elasticsearch.index.name_prefix=
## Index name date format ('yyyyMMdd-HHmmss-SSS' will be used when empty)
#elasticsearch.index.name_date_format=yyyyMMdd-HHmmss-SSS
With the above settings an index with the name ‘default-yyyyMMdd-HHmmss-SSS’ and the alias ‘default’ is created.
Created index with alias in Cerebro
Application with multiple indices
If your application requires more than one index, you have to use the ElasticsearchServiceinstead of the SingleIndexElasticsearchService to create and delete the index.
To create and delete an index, the corresponding index alias must be passed:
For simple use cases the DefaultClientConfiguration and the DefaultQueryConfiguration can be imported. Some beans for the index and field configuration have
to be implemented additionally:
Configuration with customized index configuration for two indices
Created indices with alias for above settings in Cerebro