use of org.springframework.data.elasticsearch.core.MultiGetItem in project spring-data-elasticsearch by spring-projects.
the class SimpleElasticsearchRepository method findAllById.
@Override
public Iterable<T> findAllById(Iterable<ID> ids) {
Assert.notNull(ids, "ids can't be null.");
List<T> result = new ArrayList<>();
Query idQuery = getIdQuery(ids);
if (isEmpty(idQuery.getIds())) {
return result;
}
List<MultiGetItem<T>> multiGetItems = execute(operations -> operations.multiGet(idQuery, entityClass, getIndexCoordinates()));
if (multiGetItems != null) {
multiGetItems.forEach(multiGetItem -> {
if (multiGetItem.hasItem()) {
result.add(multiGetItem.getItem());
}
});
}
return result;
}
Aggregations