mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-07-04 09:42:25 +00:00
Add environment variable to skip repository initialization.
Original Pull Request #2878 Closes #2876
This commit is contained in:
parent
aa27bbec27
commit
7f178238db
@ -82,10 +82,12 @@ public class SimpleElasticsearchRepository<T, ID> implements ElasticsearchReposi
|
|||||||
this.entityClass = this.entityInformation.getJavaType();
|
this.entityClass = this.entityInformation.getJavaType();
|
||||||
this.indexOperations = operations.indexOps(this.entityClass);
|
this.indexOperations = operations.indexOps(this.entityClass);
|
||||||
|
|
||||||
if (shouldCreateIndexAndMapping() && !indexOperations.exists()) {
|
if (!"true".equals(System.getenv("SPRING_DATA_ELASTICSEARCH_SKIP_REPOSITORY_INIT"))) {
|
||||||
indexOperations.createWithMapping();
|
if (shouldCreateIndexAndMapping() && !indexOperations.exists()) {
|
||||||
} else if (shouldAlwaysWriteMapping()) {
|
indexOperations.createWithMapping();
|
||||||
indexOperations.putMapping();
|
} else if (shouldAlwaysWriteMapping()) {
|
||||||
|
indexOperations.putMapping();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,9 @@ public class SimpleReactiveElasticsearchRepository<T, ID> implements ReactiveEla
|
|||||||
this.operations = operations;
|
this.operations = operations;
|
||||||
this.indexOperations = operations.indexOps(entityInformation.getJavaType());
|
this.indexOperations = operations.indexOps(entityInformation.getJavaType());
|
||||||
|
|
||||||
createIndexAndMappingIfNeeded();
|
if (!"true".equals(System.getenv("SPRING_DATA_ELASTICSEARCH_SKIP_REPOSITORY_INIT"))) {
|
||||||
|
createIndexAndMappingIfNeeded();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createIndexAndMappingIfNeeded() {
|
private void createIndexAndMappingIfNeeded() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user