'Elasticsearch index not created when using @Settings annotation
I have a Document in my Spring application like this (note: I'm using Kotlin but I cant imagine it would be any different with Java):
@Document(indexName = "my_metric{@environment.getProperty('myStats.elasticsearch.indexSuffix')}")
// @Setting(settingPath = "elasticsearch/settings.json")
// @Mapping(mappingPath = "elasticsearch/mappings.json")
data class MyMetric(
@JsonProperty("Id") @Id val id: String,
......
......
)
As the code above stands it works as expected. The index gets created and everything is great. However, if I un-comment the @Setting or @Mapping I get the following exception:
ElasticsearchStatusException[Elasticsearch exception [type=index_not_found_exception, reason=no such index [my_metric]]]
Not sure why this is or how to fix? Definitely need it to continue creating the index at start-up if it doesn't exist. Looking forward to any ideas/suggestions.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
