Polishing

This commit is contained in:
Peter-Josef Meisch 2023-01-26 19:07:21 +01:00
parent b0c2ce3084
commit cf9b106c31
No known key found for this signature in database
GPG Key ID: DE108246970C7708
4 changed files with 15 additions and 24 deletions

View File

@ -468,7 +468,7 @@ public class ElasticsearchTemplate extends AbstractElasticsearchTemplate {
@Override
public List<SearchHits<?>> multiSearch(List<? extends Query> queries, List<Class<?>> classes,
List<IndexCoordinates> indexes) {
List<IndexCoordinates> indexes) {
Assert.notNull(queries, "queries must not be null");
Assert.notNull(classes, "classes must not be null");
@ -652,9 +652,8 @@ public class ElasticsearchTemplate extends AbstractElasticsearchTemplate {
failedDocuments);
}
return bulkResponse.items().stream()
.map(item -> new IndexedObjectInformation(item.id(), item.index(), item.seqNo(), item.primaryTerm(),
item.version()))
return bulkResponse.items().stream().map(
item -> new IndexedObjectInformation(item.id(), item.index(), item.seqNo(), item.primaryTerm(), item.version()))
.collect(Collectors.toList());
}

View File

@ -381,8 +381,7 @@ public class ElasticsearchRestTemplate extends AbstractElasticsearchTemplate {
response.getPrimaryTerm(), //
response.getVersion());
} else {
return new IndexedObjectInformation(bulkItemResponse.getId(), bulkItemResponse.getIndex(), null, null,
null);
return new IndexedObjectInformation(bulkItemResponse.getId(), bulkItemResponse.getIndex(), null, null, null);
}
}).collect(Collectors.toList());
@ -561,7 +560,7 @@ public class ElasticsearchRestTemplate extends AbstractElasticsearchTemplate {
@Override
public List<SearchHits<?>> multiSearch(List<? extends Query> queries, List<Class<?>> classes,
List<IndexCoordinates> indexes) {
List<IndexCoordinates> indexes) {
Assert.notNull(queries, "queries must not be null");
Assert.notNull(classes, "classes must not be null");

View File

@ -140,8 +140,10 @@ public interface SearchOperations {
* @param classes the entity classes used for property mapping
* @param indexes the indexes to run the queries against
* @return list of SearchHits
* @since 5.1
*/
List<SearchHits<?>> multiSearch(List<? extends Query> queries, List<Class<?>> classes, List<IndexCoordinates> indexes);
List<SearchHits<?>> multiSearch(List<? extends Query> queries, List<Class<?>> classes,
List<IndexCoordinates> indexes);
/**
* Execute the criteria query against elasticsearch and return result as {@link SearchHits}
@ -232,19 +234,20 @@ public interface SearchOperations {
/**
* Opens a point in time (pit) in Elasticsearch.
*
* @param index the index name(s) to use
* @param keepAlive the duration the pit shoult be kept alive
* @param index the index name(s) to use
* @param keepAlive the duration the pit shoult be kept alive
* @return the pit identifier
* @since 5.0
*/
default String openPointInTime(IndexCoordinates index, Duration keepAlive) {
return openPointInTime(index, keepAlive, false);
}
/**
* Opens a point in time (pit) in Elasticsearch.
*
* @param index the index name(s) to use
* @param keepAlive the duration the pit shoult be kept alive
* @param index the index name(s) to use
* @param keepAlive the duration the pit shoult be kept alive
* @param ignoreUnavailable if {$literal true} the call will fail if any of the indices is missing or closed
* @return the pit identifier
* @since 5.0

View File

@ -29,16 +29,7 @@ import java.lang.Double;
import java.lang.Integer;
import java.lang.Long;
import java.lang.Object;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
@ -1784,8 +1775,7 @@ public abstract class ElasticsearchIntegrationTests {
List<SearchHits<?>> searchHitsList = operations.multiSearch(queries,
Lists.newArrayList(SampleEntity.class, Book.class),
List.of(IndexCoordinates.of(indexNameProvider.indexName()),
IndexCoordinates.of(bookIndex.getIndexName())));
List.of(IndexCoordinates.of(indexNameProvider.indexName()), IndexCoordinates.of(bookIndex.getIndexName())));
bookIndexOperations.delete();