mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-22 03:52:10 +00:00
Polishing.
This commit is contained in:
parent
7f178238db
commit
33973ec839
@ -83,11 +83,16 @@ public class SimpleElasticsearchRepository<T, ID> implements ElasticsearchReposi
|
||||
this.indexOperations = operations.indexOps(this.entityClass);
|
||||
|
||||
if (!"true".equals(System.getenv("SPRING_DATA_ELASTICSEARCH_SKIP_REPOSITORY_INIT"))) {
|
||||
if (shouldCreateIndexAndMapping() && !indexOperations.exists()) {
|
||||
indexOperations.createWithMapping();
|
||||
} else if (shouldAlwaysWriteMapping()) {
|
||||
indexOperations.putMapping();
|
||||
}
|
||||
createIndexAndMappingIfNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
public void createIndexAndMappingIfNeeded() {
|
||||
|
||||
if (shouldCreateIndexAndMapping() && !indexOperations.exists()) {
|
||||
indexOperations.createWithMapping();
|
||||
} else if (shouldAlwaysWriteMapping()) {
|
||||
indexOperations.putMapping();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class SimpleReactiveElasticsearchRepository<T, ID> implements ReactiveEla
|
||||
}
|
||||
}
|
||||
|
||||
private void createIndexAndMappingIfNeeded() {
|
||||
public void createIndexAndMappingIfNeeded() {
|
||||
|
||||
var blockingIndexOperations = blocking(indexOperations);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user