mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-23 04:22:12 +00:00
Polishing.
This commit is contained in:
parent
496b8d62a4
commit
c96423d5ba
@ -51,15 +51,7 @@ import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverte
|
|||||||
import org.springframework.data.elasticsearch.core.document.Document;
|
import org.springframework.data.elasticsearch.core.document.Document;
|
||||||
import org.springframework.data.elasticsearch.core.document.SearchDocumentResponse;
|
import org.springframework.data.elasticsearch.core.document.SearchDocumentResponse;
|
||||||
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
||||||
import org.springframework.data.elasticsearch.core.query.BaseQueryBuilder;
|
import org.springframework.data.elasticsearch.core.query.*;
|
||||||
import org.springframework.data.elasticsearch.core.query.BulkOptions;
|
|
||||||
import org.springframework.data.elasticsearch.core.query.ByQueryResponse;
|
|
||||||
import org.springframework.data.elasticsearch.core.query.DeleteQuery;
|
|
||||||
import org.springframework.data.elasticsearch.core.query.IndexQuery;
|
|
||||||
import org.springframework.data.elasticsearch.core.query.MoreLikeThisQuery;
|
|
||||||
import org.springframework.data.elasticsearch.core.query.Query;
|
|
||||||
import org.springframework.data.elasticsearch.core.query.SearchTemplateQuery;
|
|
||||||
import org.springframework.data.elasticsearch.core.query.UpdateQuery;
|
|
||||||
import org.springframework.data.elasticsearch.core.query.UpdateResponse;
|
import org.springframework.data.elasticsearch.core.query.UpdateResponse;
|
||||||
import org.springframework.data.elasticsearch.core.reindex.ReindexRequest;
|
import org.springframework.data.elasticsearch.core.reindex.ReindexRequest;
|
||||||
import org.springframework.data.elasticsearch.core.reindex.ReindexResponse;
|
import org.springframework.data.elasticsearch.core.reindex.ReindexResponse;
|
||||||
@ -517,18 +509,19 @@ public class ElasticsearchTemplate extends AbstractElasticsearchTemplate {
|
|||||||
|
|
||||||
private List<SearchHits<?>> multiSearch(List<MultiSearchQueryParameter> multiSearchQueryParameters,
|
private List<SearchHits<?>> multiSearch(List<MultiSearchQueryParameter> multiSearchQueryParameters,
|
||||||
boolean isSearchTemplateQuery) {
|
boolean isSearchTemplateQuery) {
|
||||||
return isSearchTemplateQuery ?
|
return isSearchTemplateQuery ? doMultiTemplateSearch(multiSearchQueryParameters.stream()
|
||||||
doMultiTemplateSearch(multiSearchQueryParameters.stream()
|
|
||||||
.map(p -> new MultiSearchTemplateQueryParameter((SearchTemplateQuery) p.query, p.clazz, p.index))
|
.map(p -> new MultiSearchTemplateQueryParameter((SearchTemplateQuery) p.query, p.clazz, p.index))
|
||||||
.toList())
|
.toList())
|
||||||
: doMultiSearch(multiSearchQueryParameters);
|
: doMultiSearch(multiSearchQueryParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<SearchHits<?>> doMultiTemplateSearch(List<MultiSearchTemplateQueryParameter> mSearchTemplateQueryParameters) {
|
private List<SearchHits<?>> doMultiTemplateSearch(
|
||||||
|
List<MultiSearchTemplateQueryParameter> mSearchTemplateQueryParameters) {
|
||||||
MsearchTemplateRequest request = requestConverter.searchMsearchTemplateRequest(mSearchTemplateQueryParameters,
|
MsearchTemplateRequest request = requestConverter.searchMsearchTemplateRequest(mSearchTemplateQueryParameters,
|
||||||
routingResolver.getRouting());
|
routingResolver.getRouting());
|
||||||
|
|
||||||
MsearchTemplateResponse<EntityAsMap> response = execute(client -> client.msearchTemplate(request, EntityAsMap.class));
|
MsearchTemplateResponse<EntityAsMap> response = execute(
|
||||||
|
client -> client.msearchTemplate(request, EntityAsMap.class));
|
||||||
List<MultiSearchResponseItem<EntityAsMap>> responseItems = response.responses();
|
List<MultiSearchResponseItem<EntityAsMap>> responseItems = response.responses();
|
||||||
|
|
||||||
Assert.isTrue(mSearchTemplateQueryParameters.size() == responseItems.size(),
|
Assert.isTrue(mSearchTemplateQueryParameters.size() == responseItems.size(),
|
||||||
|
@ -25,7 +25,6 @@ import co.elastic.clients.elasticsearch.core.search.ResponseBody;
|
|||||||
import co.elastic.clients.json.JsonpMapper;
|
import co.elastic.clients.json.JsonpMapper;
|
||||||
import co.elastic.clients.transport.Version;
|
import co.elastic.clients.transport.Version;
|
||||||
import co.elastic.clients.transport.endpoints.BooleanResponse;
|
import co.elastic.clients.transport.endpoints.BooleanResponse;
|
||||||
import org.springframework.data.elasticsearch.core.query.DeleteQuery;
|
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
import reactor.util.function.Tuple2;
|
import reactor.util.function.Tuple2;
|
||||||
@ -62,6 +61,7 @@ import org.springframework.data.elasticsearch.core.query.BaseQuery;
|
|||||||
import org.springframework.data.elasticsearch.core.query.BaseQueryBuilder;
|
import org.springframework.data.elasticsearch.core.query.BaseQueryBuilder;
|
||||||
import org.springframework.data.elasticsearch.core.query.BulkOptions;
|
import org.springframework.data.elasticsearch.core.query.BulkOptions;
|
||||||
import org.springframework.data.elasticsearch.core.query.ByQueryResponse;
|
import org.springframework.data.elasticsearch.core.query.ByQueryResponse;
|
||||||
|
import org.springframework.data.elasticsearch.core.query.DeleteQuery;
|
||||||
import org.springframework.data.elasticsearch.core.query.Query;
|
import org.springframework.data.elasticsearch.core.query.Query;
|
||||||
import org.springframework.data.elasticsearch.core.query.SearchTemplateQuery;
|
import org.springframework.data.elasticsearch.core.query.SearchTemplateQuery;
|
||||||
import org.springframework.data.elasticsearch.core.query.UpdateQuery;
|
import org.springframework.data.elasticsearch.core.query.UpdateQuery;
|
||||||
@ -437,8 +437,7 @@ public class ReactiveElasticsearchTemplate extends AbstractReactiveElasticsearch
|
|||||||
|
|
||||||
static private class PitSearchAfter {
|
static private class PitSearchAfter {
|
||||||
private final BaseQuery baseQuery;
|
private final BaseQuery baseQuery;
|
||||||
@Nullable
|
@Nullable private final Sort sort;
|
||||||
private final Sort sort;
|
|
||||||
private final String pit;
|
private final String pit;
|
||||||
|
|
||||||
PitSearchAfter(BaseQuery baseQuery, String pit) {
|
PitSearchAfter(BaseQuery baseQuery, String pit) {
|
||||||
|
@ -1022,8 +1022,7 @@ class RequestConverter {
|
|||||||
|
|
||||||
return sortField.field() + ":" + order;
|
return sortField.field() + ":" + order;
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList())
|
.collect(Collectors.toList()));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dqb.allowNoIndices(query.getAllowNoIndices())
|
dqb.allowNoIndices(query.getAllowNoIndices())
|
||||||
|
@ -509,6 +509,7 @@ final class TypeUtils {
|
|||||||
*
|
*
|
||||||
* @param operator spring-data-elasticsearch operator.
|
* @param operator spring-data-elasticsearch operator.
|
||||||
* @return an Elasticsearch Operator.
|
* @return an Elasticsearch Operator.
|
||||||
|
* @since 5.3
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
static Operator operator(@Nullable OperatorType operator) {
|
static Operator operator(@Nullable OperatorType operator) {
|
||||||
@ -520,6 +521,7 @@ final class TypeUtils {
|
|||||||
*
|
*
|
||||||
* @param conflicts spring-data-elasticsearch {@literal conflicts}.
|
* @param conflicts spring-data-elasticsearch {@literal conflicts}.
|
||||||
* @return an Elasticsearch {@literal conflicts}.
|
* @return an Elasticsearch {@literal conflicts}.
|
||||||
|
* @since 5.3
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
static Conflicts conflicts(@Nullable ConflictsType conflicts) {
|
static Conflicts conflicts(@Nullable ConflictsType conflicts) {
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.core;
|
package org.springframework.data.elasticsearch.core;
|
||||||
|
|
||||||
import org.springframework.data.elasticsearch.core.query.DeleteQuery;
|
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
import reactor.core.publisher.Sinks;
|
import reactor.core.publisher.Sinks;
|
||||||
@ -47,6 +46,7 @@ import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersiste
|
|||||||
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
||||||
import org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext;
|
import org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext;
|
||||||
import org.springframework.data.elasticsearch.core.query.ByQueryResponse;
|
import org.springframework.data.elasticsearch.core.query.ByQueryResponse;
|
||||||
|
import org.springframework.data.elasticsearch.core.query.DeleteQuery;
|
||||||
import org.springframework.data.elasticsearch.core.query.IndexQuery;
|
import org.springframework.data.elasticsearch.core.query.IndexQuery;
|
||||||
import org.springframework.data.elasticsearch.core.query.Query;
|
import org.springframework.data.elasticsearch.core.query.Query;
|
||||||
import org.springframework.data.elasticsearch.core.query.SeqNoPrimaryTerm;
|
import org.springframework.data.elasticsearch.core.query.SeqNoPrimaryTerm;
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.core;
|
package org.springframework.data.elasticsearch.core;
|
||||||
|
|
||||||
import org.springframework.data.elasticsearch.core.query.DeleteQuery;
|
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
@ -26,6 +25,7 @@ import java.util.List;
|
|||||||
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
||||||
import org.springframework.data.elasticsearch.core.query.BulkOptions;
|
import org.springframework.data.elasticsearch.core.query.BulkOptions;
|
||||||
import org.springframework.data.elasticsearch.core.query.ByQueryResponse;
|
import org.springframework.data.elasticsearch.core.query.ByQueryResponse;
|
||||||
|
import org.springframework.data.elasticsearch.core.query.DeleteQuery;
|
||||||
import org.springframework.data.elasticsearch.core.query.Query;
|
import org.springframework.data.elasticsearch.core.query.Query;
|
||||||
import org.springframework.data.elasticsearch.core.query.UpdateQuery;
|
import org.springframework.data.elasticsearch.core.query.UpdateQuery;
|
||||||
import org.springframework.data.elasticsearch.core.query.UpdateResponse;
|
import org.springframework.data.elasticsearch.core.query.UpdateResponse;
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.core.query;
|
package org.springframework.data.elasticsearch.core.query;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.data.elasticsearch.core.query.Query.SearchType;
|
import org.springframework.data.elasticsearch.core.query.Query.SearchType;
|
||||||
import org.springframework.data.elasticsearch.core.query.types.ConflictsType;
|
import org.springframework.data.elasticsearch.core.query.types.ConflictsType;
|
||||||
@ -22,196 +26,161 @@ import org.springframework.data.elasticsearch.core.query.types.OperatorType;
|
|||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import java.time.Duration;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a delete request.
|
* Defines a delete request.
|
||||||
*
|
*
|
||||||
* @author Aouichaoui Youssef
|
* @author Aouichaoui Youssef
|
||||||
* @see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html">docs</a>
|
* @see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html">docs</a>
|
||||||
|
* @since 5.3
|
||||||
*/
|
*/
|
||||||
public class DeleteQuery {
|
public class DeleteQuery {
|
||||||
// For Lucene query
|
// For Lucene query
|
||||||
/**
|
/**
|
||||||
* Query in the Lucene query string syntax.
|
* Query in the Lucene query string syntax.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final String q;
|
||||||
private final String q;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If true, wildcard and prefix queries are analyzed. Defaults to false.
|
* If true, wildcard and prefix queries are analyzed. Defaults to false. This parameter can only be used when the
|
||||||
* This parameter can only be used when the lucene query {@code q} parameter is specified.
|
* lucene query {@code q} parameter is specified.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final Boolean analyzeWildcard;
|
||||||
private final Boolean analyzeWildcard;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Analyzer to use for the query string.
|
* Analyzer to use for the query string. This parameter can only be used when the lucene query {@code q} parameter is
|
||||||
* This parameter can only be used when the lucene query {@code q} parameter is specified.
|
* specified.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final String analyzer;
|
||||||
private final String analyzer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default operator for a query string query: {@literal AND} or {@literal OR}. Defaults to {@literal OR}.
|
* The default operator for a query string query: {@literal AND} or {@literal OR}. Defaults to {@literal OR}. This
|
||||||
* This parameter can only be used when the lucene query {@code q} parameter is specified.
|
* parameter can only be used when the lucene query {@code q} parameter is specified.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final OperatorType defaultOperator;
|
||||||
private final OperatorType defaultOperator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Field to be used as the default when no field prefix is specified in the query string.
|
* Field to be used as the default when no field prefix is specified in the query string. This parameter can only be
|
||||||
* This parameter can only be used when the lucene query {@code q} parameter is specified.
|
* used when the lucene query {@code q} parameter is specified.
|
||||||
* <p>
|
* <p>
|
||||||
* e.g: {@code {"query":{"prefix":{"user.name":{"value":"es"}}}} }
|
* e.g: {@code {"query":{"prefix":{"user.name":{"value":"es"}}}} }
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final String df;
|
||||||
private final String df;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If a query contains errors related to the format of the data being entered, they will be disregarded unless specified otherwise.
|
* If a query contains errors related to the format of the data being entered, they will be disregarded unless
|
||||||
* By default, this feature is turned off.
|
* specified otherwise. By default, this feature is turned off.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final Boolean lenient;
|
||||||
private final Boolean lenient;
|
|
||||||
|
|
||||||
// For ES query
|
// For ES query
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An error will occur if the condition is {@code false} and any of the following are true: a wildcard expression,
|
* An error will occur if the condition is {@code false} and any of the following are true: a wildcard expression, an
|
||||||
* an index alias, or the {@literal _all value} only targets missing or closed indices.
|
* index alias, or the {@literal _all value} only targets missing or closed indices. By default, this is set to
|
||||||
* By default, this is set to {@code true}.
|
* {@code true}.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final Boolean allowNoIndices;
|
||||||
private final Boolean allowNoIndices;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the types of conflicts that occur when a query encounters version conflicts: abort or proceed.
|
* Define the types of conflicts that occur when a query encounters version conflicts: abort or proceed. Defaults to
|
||||||
* Defaults to abort.
|
* abort.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final ConflictsType conflicts;
|
||||||
private final ConflictsType conflicts;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of index that wildcard patterns can match.
|
* Type of index that wildcard patterns can match. Defaults to {@literal open}.
|
||||||
* Defaults to {@literal open}.
|
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final EnumSet<IndicesOptions.WildcardStates> expandWildcards;
|
||||||
private final EnumSet<IndicesOptions.WildcardStates> expandWildcards;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An error occurs if it is directed at an index that is missing or closed when it is {@code false}.
|
* An error occurs if it is directed at an index that is missing or closed when it is {@code false}. By default, this
|
||||||
* By default, this is set to {@code false}.
|
* is set to {@code false}.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final Boolean ignoreUnavailable;
|
||||||
private final Boolean ignoreUnavailable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum number of documents to process.
|
* Maximum number of documents to process. Defaults to all documents.
|
||||||
* Defaults to all documents.
|
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final Long maxDocs;
|
||||||
private final Long maxDocs;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies the node or shard the operation should be performed on.
|
* Specifies the node or shard the operation should be performed on.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final String preference;
|
||||||
private final String preference;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use the request cache when it is {@code true}.
|
* Use the request cache when it is {@code true}. By default, use the index-level setting.
|
||||||
* By default, use the index-level setting.
|
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final Boolean requestCache;
|
||||||
private final Boolean requestCache;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refreshes all shards involved in the deleting by query after the request completes when it is {@code true}.
|
* Refreshes all shards involved in the deleting by query after the request completes when it is {@code true}. By
|
||||||
* By default, this is set to {@code false}.
|
* default, this is set to {@code false}.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final Boolean refresh;
|
||||||
private final Boolean refresh;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Limited this request to a certain number of sub-requests per second.
|
* Limited this request to a certain number of sub-requests per second. By default, this is set to {@code -1} (no
|
||||||
* By default, this is set to {@code -1} (no throttle).
|
* throttle).
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final Float requestsPerSecond;
|
||||||
private final Float requestsPerSecond;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom value used to route operations to a specific shard.
|
* Custom value used to route operations to a specific shard.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final String routing;
|
||||||
private final String routing;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Period to retain the search context for scrolling.
|
* Period to retain the search context for scrolling.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final Duration scroll;
|
||||||
private final Duration scroll;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Size of the scroll request that powers the operation.
|
* Size of the scroll request that powers the operation. By default, this is set to {@code 1000}.
|
||||||
* By default, this is set to {@code 1000}.
|
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final Long scrollSize;
|
||||||
private final Long scrollSize;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the search operation.
|
* The type of the search operation.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final SearchType searchType;
|
||||||
private final SearchType searchType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Explicit timeout for each search request.
|
* Explicit timeout for each search request. By default, this is set to no timeout.
|
||||||
* By default, this is set to no timeout.
|
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final Duration searchTimeout;
|
||||||
private final Duration searchTimeout;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of slices this task should be divided into.
|
* The number of slices this task should be divided into. By default, this is set to {@code 1} meaning the task isn’t
|
||||||
* By default, this is set to {@code 1} meaning the task isn’t sliced into subtasks.
|
* sliced into subtasks.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final Integer slices;
|
||||||
private final Integer slices;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort search results in a specific order.
|
* Sort search results in a specific order.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final Sort sort;
|
||||||
private final Sort sort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specific {@code tag} of the request for logging and statistical purposes.
|
* Specific {@code tag} of the request for logging and statistical purposes.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final List<String> stats;
|
||||||
private final List<String> stats;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Maximum number of documents that can be collected for each shard.
|
* The Maximum number of documents that can be collected for each shard. If a query exceeds this limit, Elasticsearch
|
||||||
* If a query exceeds this limit, Elasticsearch will stop the query.
|
* will stop the query.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final Long terminateAfter;
|
||||||
private final Long terminateAfter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Period each deletion request waits for active shards.
|
* Period each deletion request waits for active shards. By default, this is set to {@code 1m} (one minute).
|
||||||
* By default, this is set to {@code 1m} (one minute).
|
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final Duration timeout;
|
||||||
private final Duration timeout;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the document version as part of a hit.
|
* Returns the document version as part of a hit.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final Boolean version;
|
||||||
private final Boolean version;
|
|
||||||
|
|
||||||
// Body
|
// Body
|
||||||
/**
|
/**
|
||||||
@ -392,60 +361,34 @@ public class DeleteQuery {
|
|||||||
|
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
// For Lucene query
|
// For Lucene query
|
||||||
@Nullable
|
@Nullable private String luceneQuery;
|
||||||
private String luceneQuery;
|
@Nullable private Boolean analyzeWildcard;
|
||||||
@Nullable
|
@Nullable private String analyzer;
|
||||||
private Boolean analyzeWildcard;
|
@Nullable private OperatorType defaultOperator;
|
||||||
@Nullable
|
@Nullable private String defaultField;
|
||||||
private String analyzer;
|
@Nullable private Boolean lenient;
|
||||||
@Nullable
|
|
||||||
private OperatorType defaultOperator;
|
|
||||||
@Nullable
|
|
||||||
private String defaultField;
|
|
||||||
@Nullable
|
|
||||||
private Boolean lenient;
|
|
||||||
|
|
||||||
// For ES query
|
// For ES query
|
||||||
@Nullable
|
@Nullable private Boolean allowNoIndices;
|
||||||
private Boolean allowNoIndices;
|
@Nullable private ConflictsType conflicts;
|
||||||
@Nullable
|
@Nullable private EnumSet<IndicesOptions.WildcardStates> expandWildcards;
|
||||||
private ConflictsType conflicts;
|
@Nullable private Boolean ignoreUnavailable;
|
||||||
@Nullable
|
@Nullable private Long maxDocs;
|
||||||
private EnumSet<IndicesOptions.WildcardStates> expandWildcards;
|
@Nullable private String preference;
|
||||||
@Nullable
|
@Nullable private Boolean requestCache;
|
||||||
private Boolean ignoreUnavailable;
|
@Nullable private Boolean refresh;
|
||||||
@Nullable
|
@Nullable private Float requestsPerSecond;
|
||||||
private Long maxDocs;
|
@Nullable private String routing;
|
||||||
@Nullable
|
@Nullable private Duration scrollTime;
|
||||||
private String preference;
|
@Nullable private Long scrollSize;
|
||||||
@Nullable
|
@Nullable private SearchType searchType;
|
||||||
private Boolean requestCache;
|
@Nullable private Duration searchTimeout;
|
||||||
@Nullable
|
@Nullable private Integer slices;
|
||||||
private Boolean refresh;
|
@Nullable private Sort sort;
|
||||||
@Nullable
|
@Nullable private List<String> stats;
|
||||||
private Float requestsPerSecond;
|
@Nullable private Long terminateAfter;
|
||||||
@Nullable
|
@Nullable private Duration timeout;
|
||||||
private String routing;
|
@Nullable private Boolean version;
|
||||||
@Nullable
|
|
||||||
private Duration scrollTime;
|
|
||||||
@Nullable
|
|
||||||
private Long scrollSize;
|
|
||||||
@Nullable
|
|
||||||
private SearchType searchType;
|
|
||||||
@Nullable
|
|
||||||
private Duration searchTimeout;
|
|
||||||
@Nullable
|
|
||||||
private Integer slices;
|
|
||||||
@Nullable
|
|
||||||
private Sort sort;
|
|
||||||
@Nullable
|
|
||||||
private List<String> stats;
|
|
||||||
@Nullable
|
|
||||||
private Long terminateAfter;
|
|
||||||
@Nullable
|
|
||||||
private Duration timeout;
|
|
||||||
@Nullable
|
|
||||||
private Boolean version;
|
|
||||||
|
|
||||||
// Body
|
// Body
|
||||||
private final Query query;
|
private final Query query;
|
||||||
@ -466,8 +409,8 @@ public class DeleteQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If true, wildcard and prefix queries are analyzed. Defaults to false.
|
* If true, wildcard and prefix queries are analyzed. Defaults to false. This parameter can only be used when the
|
||||||
* This parameter can only be used when the lucene query {@code q} parameter is specified.
|
* lucene query {@code q} parameter is specified.
|
||||||
*/
|
*/
|
||||||
public Builder withAnalyzeWildcard(@Nullable Boolean analyzeWildcard) {
|
public Builder withAnalyzeWildcard(@Nullable Boolean analyzeWildcard) {
|
||||||
this.analyzeWildcard = analyzeWildcard;
|
this.analyzeWildcard = analyzeWildcard;
|
||||||
@ -476,8 +419,8 @@ public class DeleteQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Analyzer to use for the query string.
|
* Analyzer to use for the query string. This parameter can only be used when the lucene query {@code q} parameter
|
||||||
* This parameter can only be used when the lucene query {@code q} parameter is specified.
|
* is specified.
|
||||||
*/
|
*/
|
||||||
public Builder withAnalyzer(@Nullable String analyzer) {
|
public Builder withAnalyzer(@Nullable String analyzer) {
|
||||||
this.analyzer = analyzer;
|
this.analyzer = analyzer;
|
||||||
@ -486,8 +429,8 @@ public class DeleteQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default operator for a query string query: {@literal AND} or {@literal OR}. Defaults to {@literal OR}.
|
* The default operator for a query string query: {@literal AND} or {@literal OR}. Defaults to {@literal OR}. This
|
||||||
* This parameter can only be used when the lucene query {@code q} parameter is specified.
|
* parameter can only be used when the lucene query {@code q} parameter is specified.
|
||||||
*/
|
*/
|
||||||
public Builder withDefaultOperator(@Nullable OperatorType defaultOperator) {
|
public Builder withDefaultOperator(@Nullable OperatorType defaultOperator) {
|
||||||
this.defaultOperator = defaultOperator;
|
this.defaultOperator = defaultOperator;
|
||||||
@ -496,8 +439,8 @@ public class DeleteQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Field to be used as the default when no field prefix is specified in the query string.
|
* Field to be used as the default when no field prefix is specified in the query string. This parameter can only be
|
||||||
* This parameter can only be used when the lucene query {@code q} parameter is specified.
|
* used when the lucene query {@code q} parameter is specified.
|
||||||
* <p>
|
* <p>
|
||||||
* e.g: {@code {"query":{"prefix":{"user.name":{"value":"es"}}}} }
|
* e.g: {@code {"query":{"prefix":{"user.name":{"value":"es"}}}} }
|
||||||
*/
|
*/
|
||||||
@ -508,8 +451,8 @@ public class DeleteQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If a query contains errors related to the format of the data being entered, they will be disregarded unless specified otherwise.
|
* If a query contains errors related to the format of the data being entered, they will be disregarded unless
|
||||||
* By default, this feature is turned off.
|
* specified otherwise. By default, this feature is turned off.
|
||||||
*/
|
*/
|
||||||
public Builder withLenient(@Nullable Boolean lenient) {
|
public Builder withLenient(@Nullable Boolean lenient) {
|
||||||
this.lenient = lenient;
|
this.lenient = lenient;
|
||||||
@ -519,8 +462,8 @@ public class DeleteQuery {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error will occur if the condition is {@code false} and any of the following are true: a wildcard expression,
|
* An error will occur if the condition is {@code false} and any of the following are true: a wildcard expression,
|
||||||
* an index alias, or the {@literal _all value} only targets missing or closed indices.
|
* an index alias, or the {@literal _all value} only targets missing or closed indices. By default, this is set to
|
||||||
* By default, this is set to {@code true}.
|
* {@code true}.
|
||||||
*/
|
*/
|
||||||
public Builder withAllowNoIndices(@Nullable Boolean allowNoIndices) {
|
public Builder withAllowNoIndices(@Nullable Boolean allowNoIndices) {
|
||||||
this.allowNoIndices = allowNoIndices;
|
this.allowNoIndices = allowNoIndices;
|
||||||
@ -529,8 +472,8 @@ public class DeleteQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the types of conflicts that occur when a query encounters version conflicts: abort or proceed.
|
* Define the types of conflicts that occur when a query encounters version conflicts: abort or proceed. Defaults to
|
||||||
* Defaults to abort.
|
* abort.
|
||||||
*/
|
*/
|
||||||
public Builder withConflicts(@Nullable ConflictsType conflicts) {
|
public Builder withConflicts(@Nullable ConflictsType conflicts) {
|
||||||
this.conflicts = conflicts;
|
this.conflicts = conflicts;
|
||||||
@ -539,8 +482,7 @@ public class DeleteQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of index that wildcard patterns can match.
|
* Type of index that wildcard patterns can match. Defaults to {@literal open}.
|
||||||
* Defaults to {@literal open}.
|
|
||||||
*/
|
*/
|
||||||
public Builder setExpandWildcards(@Nullable EnumSet<IndicesOptions.WildcardStates> expandWildcards) {
|
public Builder setExpandWildcards(@Nullable EnumSet<IndicesOptions.WildcardStates> expandWildcards) {
|
||||||
this.expandWildcards = expandWildcards;
|
this.expandWildcards = expandWildcards;
|
||||||
@ -549,8 +491,8 @@ public class DeleteQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An error occurs if it is directed at an index that is missing or closed when it is {@code false}.
|
* An error occurs if it is directed at an index that is missing or closed when it is {@code false}. By default,
|
||||||
* By default, this is set to {@code false}.
|
* this is set to {@code false}.
|
||||||
*/
|
*/
|
||||||
public Builder withIgnoreUnavailable(@Nullable Boolean ignoreUnavailable) {
|
public Builder withIgnoreUnavailable(@Nullable Boolean ignoreUnavailable) {
|
||||||
this.ignoreUnavailable = ignoreUnavailable;
|
this.ignoreUnavailable = ignoreUnavailable;
|
||||||
@ -559,8 +501,7 @@ public class DeleteQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum number of documents to process.
|
* Maximum number of documents to process. Defaults to all documents.
|
||||||
* Defaults to all documents.
|
|
||||||
*/
|
*/
|
||||||
public Builder withMaxDocs(@Nullable Long maxDocs) {
|
public Builder withMaxDocs(@Nullable Long maxDocs) {
|
||||||
this.maxDocs = maxDocs;
|
this.maxDocs = maxDocs;
|
||||||
@ -578,8 +519,7 @@ public class DeleteQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use the request cache when it is {@code true}.
|
* Use the request cache when it is {@code true}. By default, use the index-level setting.
|
||||||
* By default, use the index-level setting.
|
|
||||||
*/
|
*/
|
||||||
public Builder withRequestCache(@Nullable Boolean requestCache) {
|
public Builder withRequestCache(@Nullable Boolean requestCache) {
|
||||||
this.requestCache = requestCache;
|
this.requestCache = requestCache;
|
||||||
@ -588,8 +528,8 @@ public class DeleteQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refreshes all shards involved in the deleting by query after the request completes when it is {@code true}.
|
* Refreshes all shards involved in the deleting by query after the request completes when it is {@code true}. By
|
||||||
* By default, this is set to {@code false}.
|
* default, this is set to {@code false}.
|
||||||
*/
|
*/
|
||||||
public Builder withRefresh(@Nullable Boolean refresh) {
|
public Builder withRefresh(@Nullable Boolean refresh) {
|
||||||
this.refresh = refresh;
|
this.refresh = refresh;
|
||||||
@ -598,8 +538,8 @@ public class DeleteQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Limited this request to a certain number of sub-requests per second.
|
* Limited this request to a certain number of sub-requests per second. By default, this is set to {@code -1} (no
|
||||||
* By default, this is set to {@code -1} (no throttle).
|
* throttle).
|
||||||
*/
|
*/
|
||||||
public Builder withRequestsPerSecond(@Nullable Float requestsPerSecond) {
|
public Builder withRequestsPerSecond(@Nullable Float requestsPerSecond) {
|
||||||
this.requestsPerSecond = requestsPerSecond;
|
this.requestsPerSecond = requestsPerSecond;
|
||||||
@ -626,8 +566,7 @@ public class DeleteQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Size of the scroll request that powers the operation.
|
* Size of the scroll request that powers the operation. By default, this is set to {@code 1000}.
|
||||||
* By default, this is set to {@code 1000}.
|
|
||||||
*/
|
*/
|
||||||
public Builder withScrollSize(@Nullable Long scrollSize) {
|
public Builder withScrollSize(@Nullable Long scrollSize) {
|
||||||
this.scrollSize = scrollSize;
|
this.scrollSize = scrollSize;
|
||||||
@ -645,8 +584,7 @@ public class DeleteQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Explicit timeout for each search request.
|
* Explicit timeout for each search request. By default, this is set to no timeout.
|
||||||
* By default, this is set to no timeout.
|
|
||||||
*/
|
*/
|
||||||
public Builder withSearchTimeout(@Nullable Duration searchTimeout) {
|
public Builder withSearchTimeout(@Nullable Duration searchTimeout) {
|
||||||
this.searchTimeout = searchTimeout;
|
this.searchTimeout = searchTimeout;
|
||||||
@ -655,8 +593,8 @@ public class DeleteQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of slices this task should be divided into.
|
* The number of slices this task should be divided into. By default, this is set to {@code 1} meaning the task
|
||||||
* By default, this is set to {@code 1} meaning the task isn’t sliced into subtasks.
|
* isn’t sliced into subtasks.
|
||||||
*/
|
*/
|
||||||
public Builder withSlices(@Nullable Integer slices) {
|
public Builder withSlices(@Nullable Integer slices) {
|
||||||
this.slices = slices;
|
this.slices = slices;
|
||||||
@ -683,8 +621,8 @@ public class DeleteQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Maximum number of documents that can be collected for each shard.
|
* The Maximum number of documents that can be collected for each shard. If a query exceeds this limit,
|
||||||
* If a query exceeds this limit, Elasticsearch will stop the query.
|
* Elasticsearch will stop the query.
|
||||||
*/
|
*/
|
||||||
public Builder withTerminateAfter(@Nullable Long terminateAfter) {
|
public Builder withTerminateAfter(@Nullable Long terminateAfter) {
|
||||||
this.terminateAfter = terminateAfter;
|
this.terminateAfter = terminateAfter;
|
||||||
@ -693,8 +631,7 @@ public class DeleteQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Period each deletion request waits for active shards.
|
* Period each deletion request waits for active shards. By default, this is set to {@code 1m} (one minute).
|
||||||
* By default, this is set to {@code 1m} (one minute).
|
|
||||||
*/
|
*/
|
||||||
public Builder withTimeout(@Nullable Duration timeout) {
|
public Builder withTimeout(@Nullable Duration timeout) {
|
||||||
this.timeout = timeout;
|
this.timeout = timeout;
|
||||||
@ -717,13 +654,16 @@ public class DeleteQuery {
|
|||||||
throw new IllegalArgumentException("When defining the df parameter, you must include the Lucene query.");
|
throw new IllegalArgumentException("When defining the df parameter, you must include the Lucene query.");
|
||||||
}
|
}
|
||||||
if (analyzer != null) {
|
if (analyzer != null) {
|
||||||
throw new IllegalArgumentException("When defining the analyzer parameter, you must include the Lucene query.");
|
throw new IllegalArgumentException(
|
||||||
|
"When defining the analyzer parameter, you must include the Lucene query.");
|
||||||
}
|
}
|
||||||
if (analyzeWildcard != null) {
|
if (analyzeWildcard != null) {
|
||||||
throw new IllegalArgumentException("When defining the analyzeWildcard parameter, you must include the Lucene query.");
|
throw new IllegalArgumentException(
|
||||||
|
"When defining the analyzeWildcard parameter, you must include the Lucene query.");
|
||||||
}
|
}
|
||||||
if (defaultOperator != null) {
|
if (defaultOperator != null) {
|
||||||
throw new IllegalArgumentException("When defining the defaultOperator parameter, you must include the Lucene query.");
|
throw new IllegalArgumentException(
|
||||||
|
"When defining the defaultOperator parameter, you must include the Lucene query.");
|
||||||
}
|
}
|
||||||
if (lenient != null) {
|
if (lenient != null) {
|
||||||
throw new IllegalArgumentException("When defining the lenient parameter, you must include the Lucene query.");
|
throw new IllegalArgumentException("When defining the lenient parameter, you must include the Lucene query.");
|
||||||
|
@ -19,6 +19,7 @@ package org.springframework.data.elasticsearch.core.query.types;
|
|||||||
* Define the types of conflicts that occur when a query encounters version conflicts.
|
* Define the types of conflicts that occur when a query encounters version conflicts.
|
||||||
*
|
*
|
||||||
* @author Aouichaoui Youssef
|
* @author Aouichaoui Youssef
|
||||||
|
* @since 5.3
|
||||||
*/
|
*/
|
||||||
public enum ConflictsType {
|
public enum ConflictsType {
|
||||||
Abort, Proceed
|
Abort, Proceed
|
||||||
|
@ -19,6 +19,7 @@ package org.springframework.data.elasticsearch.core.query.types;
|
|||||||
* Define the default operator for a query string query.
|
* Define the default operator for a query string query.
|
||||||
*
|
*
|
||||||
* @author Aouichaoui Youssef
|
* @author Aouichaoui Youssef
|
||||||
|
* @since 5.3
|
||||||
*/
|
*/
|
||||||
public enum OperatorType {
|
public enum OperatorType {
|
||||||
And, Or
|
And, Or
|
||||||
|
@ -19,16 +19,11 @@ import static java.util.Collections.*;
|
|||||||
import static org.assertj.core.api.Assertions.*;
|
import static org.assertj.core.api.Assertions.*;
|
||||||
import static org.springframework.data.elasticsearch.annotations.Document.VersionType.*;
|
import static org.springframework.data.elasticsearch.annotations.Document.VersionType.*;
|
||||||
import static org.springframework.data.elasticsearch.annotations.FieldType.*;
|
import static org.springframework.data.elasticsearch.annotations.FieldType.*;
|
||||||
import static org.springframework.data.elasticsearch.annotations.FieldType.Integer;
|
|
||||||
import static org.springframework.data.elasticsearch.core.document.Document.*;
|
import static org.springframework.data.elasticsearch.core.document.Document.*;
|
||||||
import static org.springframework.data.elasticsearch.core.query.StringQuery.*;
|
import static org.springframework.data.elasticsearch.core.query.StringQuery.*;
|
||||||
import static org.springframework.data.elasticsearch.utils.IdGenerator.*;
|
import static org.springframework.data.elasticsearch.utils.IdGenerator.*;
|
||||||
import static org.springframework.data.elasticsearch.utils.IndexBuilder.*;
|
import static org.springframework.data.elasticsearch.utils.IndexBuilder.*;
|
||||||
|
|
||||||
import java.lang.Double;
|
|
||||||
import java.lang.Integer;
|
|
||||||
import java.lang.Long;
|
|
||||||
import java.lang.Object;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
@ -2976,8 +2971,8 @@ public abstract class ElasticsearchIntegrationTests {
|
|||||||
.build();
|
.build();
|
||||||
Query query = getBuilderWithTermQuery("message", "message") //
|
Query query = getBuilderWithTermQuery("message", "message") //
|
||||||
.withHighlightQuery(
|
.withHighlightQuery(
|
||||||
new HighlightQuery(new Highlight(singletonList(new HighlightField("message", sameHighlightQuery))), HighlightEntity.class)
|
new HighlightQuery(new Highlight(singletonList(new HighlightField("message", sameHighlightQuery))),
|
||||||
)
|
HighlightEntity.class))
|
||||||
.build();
|
.build();
|
||||||
SearchHits<HighlightEntity> searchHits = operations.search(query, HighlightEntity.class, index);
|
SearchHits<HighlightEntity> searchHits = operations.search(query, HighlightEntity.class, index);
|
||||||
|
|
||||||
@ -3002,8 +2997,9 @@ public abstract class ElasticsearchIntegrationTests {
|
|||||||
// highlight_query in field
|
// highlight_query in field
|
||||||
Query highlightQueryInField = getBuilderWithTermQuery("message", "message") //
|
Query highlightQueryInField = getBuilderWithTermQuery("message", "message") //
|
||||||
.withHighlightQuery(
|
.withHighlightQuery(
|
||||||
new HighlightQuery(new Highlight(singletonList(new HighlightField("message", differentHighlightQueryInField))), HighlightEntity.class)
|
new HighlightQuery(
|
||||||
)
|
new Highlight(singletonList(new HighlightField("message", differentHighlightQueryInField))),
|
||||||
|
HighlightEntity.class))
|
||||||
.build();
|
.build();
|
||||||
assertThatHighlightFieldsIsDifferentFromHighlightQuery(highlightQueryInField, index);
|
assertThatHighlightFieldsIsDifferentFromHighlightQuery(highlightQueryInField, index);
|
||||||
}
|
}
|
||||||
@ -3019,8 +3015,9 @@ public abstract class ElasticsearchIntegrationTests {
|
|||||||
// highlight_query in param
|
// highlight_query in param
|
||||||
Query highlightQueryInParam = getBuilderWithTermQuery("message", "message") //
|
Query highlightQueryInParam = getBuilderWithTermQuery("message", "message") //
|
||||||
.withHighlightQuery(
|
.withHighlightQuery(
|
||||||
new HighlightQuery(new Highlight(differentHighlightQueryInParam, singletonList(new HighlightField("message"))), HighlightEntity.class)
|
new HighlightQuery(
|
||||||
)
|
new Highlight(differentHighlightQueryInParam, singletonList(new HighlightField("message"))),
|
||||||
|
HighlightEntity.class))
|
||||||
.build();
|
.build();
|
||||||
assertThatHighlightFieldsIsDifferentFromHighlightQuery(highlightQueryInParam, index);
|
assertThatHighlightFieldsIsDifferentFromHighlightQuery(highlightQueryInParam, index);
|
||||||
}
|
}
|
||||||
@ -3035,8 +3032,9 @@ public abstract class ElasticsearchIntegrationTests {
|
|||||||
// highlight_query in param
|
// highlight_query in param
|
||||||
Query differentHighlightQueryUsingCriteria = getBuilderWithTermQuery("message", "message") //
|
Query differentHighlightQueryUsingCriteria = getBuilderWithTermQuery("message", "message") //
|
||||||
.withHighlightQuery(
|
.withHighlightQuery(
|
||||||
new HighlightQuery(new Highlight(criteriaHighlightQueryInParam, singletonList(new HighlightField("message"))), HighlightEntity.class)
|
new HighlightQuery(
|
||||||
)
|
new Highlight(criteriaHighlightQueryInParam, singletonList(new HighlightField("message"))),
|
||||||
|
HighlightEntity.class))
|
||||||
.build();
|
.build();
|
||||||
assertThatHighlightFieldsIsDifferentFromHighlightQuery(differentHighlightQueryUsingCriteria, index);
|
assertThatHighlightFieldsIsDifferentFromHighlightQuery(differentHighlightQueryUsingCriteria, index);
|
||||||
}
|
}
|
||||||
@ -3055,14 +3053,13 @@ public abstract class ElasticsearchIntegrationTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"""
|
"""))
|
||||||
))
|
|
||||||
.build();
|
.build();
|
||||||
// highlight_query in param
|
// highlight_query in param
|
||||||
Query differentHighlightQueryUsingStringQuery = getBuilderWithTermQuery("message", "message") //
|
Query differentHighlightQueryUsingStringQuery = getBuilderWithTermQuery("message", "message") //
|
||||||
.withHighlightQuery(
|
.withHighlightQuery(
|
||||||
new HighlightQuery(new Highlight(stringHighlightQueryInParam, singletonList(new HighlightField("message"))), HighlightEntity.class)
|
new HighlightQuery(new Highlight(stringHighlightQueryInParam, singletonList(new HighlightField("message"))),
|
||||||
)
|
HighlightEntity.class))
|
||||||
.build();
|
.build();
|
||||||
assertThatHighlightFieldsIsDifferentFromHighlightQuery(differentHighlightQueryUsingStringQuery, index);
|
assertThatHighlightFieldsIsDifferentFromHighlightQuery(differentHighlightQueryUsingStringQuery, index);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user