org.springframework.data.elasticsearch.core.query.BaseQuery Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-data-elasticsearch Show documentation
Show all versions of spring-data-elasticsearch Show documentation
Spring Data Implementation for Elasticsearch
/*
* Copyright 2013-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.elasticsearch.core.query;
import static java.util.Collections.*;
import static org.springframework.util.CollectionUtils.*;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.elasticsearch.core.RuntimeField;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
* BaseQuery
*
* @author Rizwan Idrees
* @author Mohsin Husen
* @author Mark Paluch
* @author Alen Turkovic
* @author Sascha Woo
* @author Farid Azaza
* @author Peter-Josef Meisch
* @author Peer Mueller
* @author vdisk
*/
public class BaseQuery implements Query {
private static final int DEFAULT_REACTIVE_BATCH_SIZE = 500;
@Nullable protected Sort sort;
protected Pageable pageable = DEFAULT_PAGE;
protected List fields = new ArrayList<>();
@Nullable protected List storedFields;
@Nullable protected SourceFilter sourceFilter;
protected float minScore;
@Nullable protected Collection ids;
@Nullable protected String route;
protected SearchType searchType = SearchType.QUERY_THEN_FETCH;
@Nullable protected IndicesOptions indicesOptions;
protected boolean trackScores;
@Nullable protected String preference;
@Nullable protected Integer maxResults;
@Nullable protected HighlightQuery highlightQuery;
@Nullable private Boolean trackTotalHits;
@Nullable protected Integer trackTotalHitsUpTo;
@Nullable protected Duration scrollTime;
@Nullable protected Duration timeout;
private boolean explain = false;
@Nullable protected List