Closed
Description
Mateusz Stefek opened DATAES-481 and commented
AbstractElasticSearchRepository
creates an index on startup, if it isn't already there. \
If there's an error in this index creation, an exception is swallowed and the error is simply reported into the logs.
This renders the application unusable when the Elasticsearch server is unavailable during the application startup. (IndexNotFoundException
is thrown by all the operations on the repository).
I would like to have an option to force the application to crash, if anything fails in this constructor.
public AbstractElasticsearchRepository(ElasticsearchEntityInformation<T, ID> metadata,
ElasticsearchOperations elasticsearchOperations) {
this(elasticsearchOperations);
Assert.notNull(metadata, "ElasticsearchEntityInformation must not be null!");
this.entityInformation = metadata;
setEntityClass(this.entityInformation.getJavaType());
try {
if (createIndexAndMapping()) {
createIndex();
putMapping();
}
} catch (ElasticsearchException exception) {
LOGGER.error("failed to load elasticsearch nodes : " + exception.getDetailedMessage());
}
}
Affects: 3.0.9 (Kay SR9)