use of org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter in project spring-data-elasticsearch by spring-projects.
the class ElasticsearchRestTemplate method multiGet.
@Override
public <T> List<MultiGetItem<T>> multiGet(Query query, Class<T> clazz, IndexCoordinates index) {
Assert.notNull(index, "index must not be null");
MultiGetRequest request = requestFactory.multiGetRequest(query, clazz, index);
MultiGetResponse result = execute(client -> client.mget(request, RequestOptions.DEFAULT));
DocumentCallback<T> callback = new ReadDocumentCallback<>(elasticsearchConverter, clazz, index);
return //
DocumentAdapters.from(result).stream().map(multiGetItem -> //
MultiGetItem.of(multiGetItem.isFailed() ? null : callback.doWith(multiGetItem.getItem()), //
multiGetItem.getFailure())).collect(Collectors.toList());
}
use of org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter in project spring-data-elasticsearch by spring-projects.
the class ElasticsearchStringQueryUnitTestBase method setupConverter.
protected ElasticsearchConverter setupConverter() {
MappingElasticsearchConverter converter = new MappingElasticsearchConverter(new SimpleElasticsearchMappingContext());
Collection<Converter<?, ?>> converters = new ArrayList<>();
converters.add(ElasticsearchStringQueryUnitTests.CarConverter.INSTANCE);
CustomConversions customConversions = new ElasticsearchCustomConversions(converters);
converter.setConversions(customConversions);
converter.afterPropertiesSet();
return converter;
}
Aggregations