mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-25 21:42:11 +00:00
DATAES-141 - Update ElasticsearchTemplate constructors to init properly the default implementations.
This commit is contained in:
parent
aa44da63f9
commit
727cb5eb09
@ -116,26 +116,34 @@ public class ElasticsearchTemplate implements ElasticsearchOperations, Applicati
|
|||||||
private String searchTimeout;
|
private String searchTimeout;
|
||||||
|
|
||||||
public ElasticsearchTemplate(Client client) {
|
public ElasticsearchTemplate(Client client) {
|
||||||
this(client, null, null);
|
this(client, new MappingElasticsearchConverter(new SimpleElasticsearchMappingContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElasticsearchTemplate(Client client, EntityMapper entityMapper) {
|
public ElasticsearchTemplate(Client client, EntityMapper entityMapper) {
|
||||||
this(client, null, new DefaultResultMapper(entityMapper));
|
this(client, new MappingElasticsearchConverter(new SimpleElasticsearchMappingContext()), entityMapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ElasticsearchTemplate(Client client, ElasticsearchConverter elasticsearchConverter, EntityMapper entityMapper) {
|
||||||
|
this(client, elasticsearchConverter, new DefaultResultMapper(elasticsearchConverter.getMappingContext(), entityMapper));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElasticsearchTemplate(Client client, ResultsMapper resultsMapper) {
|
public ElasticsearchTemplate(Client client, ResultsMapper resultsMapper) {
|
||||||
this(client, null, resultsMapper);
|
this(client, new MappingElasticsearchConverter(new SimpleElasticsearchMappingContext()), resultsMapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElasticsearchTemplate(Client client, ElasticsearchConverter elasticsearchConverter) {
|
public ElasticsearchTemplate(Client client, ElasticsearchConverter elasticsearchConverter) {
|
||||||
this(client, elasticsearchConverter, null);
|
this(client, elasticsearchConverter, new DefaultResultMapper(elasticsearchConverter.getMappingContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElasticsearchTemplate(Client client, ElasticsearchConverter elasticsearchConverter, ResultsMapper resultsMapper) {
|
public ElasticsearchTemplate(Client client, ElasticsearchConverter elasticsearchConverter, ResultsMapper resultsMapper) {
|
||||||
|
|
||||||
|
Assert.notNull(client, "Client must not be null!");
|
||||||
|
Assert.notNull(elasticsearchConverter, "ElasticsearchConverter must not be null!");
|
||||||
|
Assert.notNull(resultsMapper, "ResultsMapper must not be null!");
|
||||||
|
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.elasticsearchConverter = (elasticsearchConverter == null) ? new MappingElasticsearchConverter(
|
this.elasticsearchConverter = elasticsearchConverter;
|
||||||
new SimpleElasticsearchMappingContext()) : elasticsearchConverter;
|
this.resultsMapper = resultsMapper;
|
||||||
this.resultsMapper = (resultsMapper == null) ? new DefaultResultMapper(this.elasticsearchConverter.getMappingContext()) : resultsMapper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSearchTimeout(String searchTimeout) {
|
public void setSearchTimeout(String searchTimeout) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user