You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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. (IndexNotFoundExceptionis 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)
The text was updated successfully, but these errors were encountered:
sothawo
changed the title
Allow AbstractElasticsearchRepository to throw an Exception when an index cannot be created [DATAES-481]
Repository initialization should throw an Exception when an index cannot be created [DATAES-481]
Jan 6, 2021
sothawo
changed the title
Repository initialization should throw an Exception when an index cannot be created [DATAES-481]
Repository initialization should throw an Exception when index cannot be created [DATAES-481]
Jan 6, 2021
Additional comment: I think we should definitely throw an exception. When creating an index or storing the mapping itself throw an exception, this happens when the entity is configured to have the index created automatically and the index does not exist yet (this last check was not yet in place when this ticket was created). I guess that just logging the exception still comes from the times when there was no check for existing indices, and trying to create an already existing index threw an exception.
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.
Affects: 3.0.9 (Kay SR9)
The text was updated successfully, but these errors were encountered: