org.springframework.data.elasticsearch.core.query.BaseQueryBuilder 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 2022-2023 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 java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
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;
/**
* base class for query builders. The different implementations of {@link Query} should derive from this class and then
* offer a constructor that takes their builder as argument and passes this on to the super class.
*
* @author Peter-Josef Meisch
* @since 4.4
*/
public abstract class BaseQueryBuilder> {
@Nullable private Sort sort;
@Nullable private Pageable pageable;
private final List fields = new ArrayList<>();
@Nullable private List storedFields;
@Nullable private SourceFilter sourceFilter;
private float minScore;
private final Collection ids = new ArrayList<>();
@Nullable private String route;
private Query.SearchType searchType = Query.SearchType.QUERY_THEN_FETCH;
@Nullable private IndicesOptions indicesOptions;
private boolean trackScores;
@Nullable private String preference;
@Nullable private Integer maxResults;
@Nullable private HighlightQuery highlightQuery;
@Nullable private Boolean trackTotalHits;
@Nullable private Integer trackTotalHitsUpTo;
@Nullable private Duration scrollTime;
@Nullable private Duration timeout;
boolean explain = false;
@Nullable private List