Class BaseQueryBuilder<Q extends BaseQuery, SELF extends BaseQueryBuilder<Q,SELF>>

java.lang.Object
org.springframework.data.elasticsearch.core.query.BaseQueryBuilder<Q,SELF>
Direct Known Subclasses:
CriteriaQueryBuilder, NativeQueryBuilder, SearchTemplateQueryBuilder, StringQueryBuilder

public abstract class BaseQueryBuilder<Q extends BaseQuery, SELF extends BaseQueryBuilder<Q,SELF>> extends Object
base class for query builders. The different implementations of 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.
Since:
4.4
Author:
Peter-Josef Meisch
  • Field Details

  • Constructor Details

    • BaseQueryBuilder

      public BaseQueryBuilder()
  • Method Details

    • getSort

      public @Nullable Sort getSort()
    • getPageable

      public @Nullable Pageable getPageable()
    • getFields

      public List<String> getFields()
    • getStoredFields

      public @Nullable List<String> getStoredFields()
    • getMaxResults

      public @Nullable Integer getMaxResults()
    • getIds

      public @Nullable Collection<String> getIds()
    • getTrackScores

      public boolean getTrackScores()
    • getIndicesOptions

      public @Nullable IndicesOptions getIndicesOptions()
    • getMinScore

      public float getMinScore()
    • getPreference

      public @Nullable String getPreference()
    • getSourceFilter

      public @Nullable SourceFilter getSourceFilter()
    • getHighlightQuery

      public @Nullable HighlightQuery getHighlightQuery()
    • getRoute

      public @Nullable String getRoute()
    • getIndicesBoost

      public @Nullable List<IndexBoost> getIndicesBoost()
    • getSearchType

      public @Nullable Query.SearchType getSearchType()
    • getTrackTotalHits

      public @Nullable Boolean getTrackTotalHits()
    • getTrackTotalHitsUpTo

      public @Nullable Integer getTrackTotalHitsUpTo()
    • getScrollTime

      public @Nullable Duration getScrollTime()
    • getTimeout

      public @Nullable Duration getTimeout()
    • getExplain

      public boolean getExplain()
    • getSearchAfter

      public @Nullable List<Object> getSearchAfter()
    • getRequestCache

      public @Nullable Boolean getRequestCache()
    • getIdsWithRouting

      public List<Query.IdWithRouting> getIdsWithRouting()
    • getRuntimeFields

      public List<RuntimeField> getRuntimeFields()
    • getRescorerQueries

      public List<RescorerQuery> getRescorerQueries()
    • getPointInTime

      public @Nullable Query.PointInTime getPointInTime()
      Since:
      5.0
    • getReactiveBatchSize

      public @Nullable Integer getReactiveBatchSize()
      Since:
      5.1
    • getAllowNoIndices

      public @Nullable Boolean getAllowNoIndices()
      Since:
      5.1
    • getExpandWildcards

      public EnumSet<IndicesOptions.WildcardStates> getExpandWildcards()
      Since:
      5.1
    • getDocValueFields

      public List<DocValueField> getDocValueFields()
      Since:
      5.1
    • getScriptedFields

      public List<ScriptedField> getScriptedFields()
    • withPageable

      public SELF withPageable(Pageable pageable)
    • withSort

      public SELF withSort(Sort sort)
    • withMaxResults

      public SELF withMaxResults(Integer maxResults)
    • withIds

      public SELF withIds(String... ids)
      Set Ids for a multi-get request run with this query. Not used in any other searches.
      Parameters:
      ids - list of id values
    • withIds

      public SELF withIds(Collection<String> ids)
      Set Ids for a multi-get request run with this query. Not used in any other searches.
      Parameters:
      ids - list of id values
    • withTrackScores

      public SELF withTrackScores(boolean trackScores)
    • withIndicesOptions

      public SELF withIndicesOptions(IndicesOptions indicesOptions)
    • withMinScore

      public SELF withMinScore(float minScore)
    • withPreference

      public SELF withPreference(String preference)
    • withSourceFilter

      public SELF withSourceFilter(SourceFilter sourceFilter)
    • withFields

      public SELF withFields(String... fields)
    • withFields

      public SELF withFields(Collection<String> fields)
    • withHighlightQuery

      public SELF withHighlightQuery(HighlightQuery highlightQuery)
    • withRoute

      public SELF withRoute(String route)
    • withIndicesBoost

      public SELF withIndicesBoost(@Nullable List<IndexBoost> indicesBoost)
    • withStoredFields

      public SELF withStoredFields(@Nullable List<String> storedFields)
    • withIndicesBoost

      public SELF withIndicesBoost(IndexBoost... indicesBoost)
    • withSearchType

      public SELF withSearchType(@Nullable Query.SearchType searchType)
    • withTrackTotalHits

      public SELF withTrackTotalHits(@Nullable Boolean trackTotalHits)
    • withTrackTotalHitsUpTo

      public SELF withTrackTotalHitsUpTo(@Nullable Integer trackTotalHitsUpTo)
    • withTimeout

      public SELF withTimeout(@Nullable Duration timeout)
    • withScrollTime

      public SELF withScrollTime(@Nullable Duration scrollTime)
    • withExplain

      public SELF withExplain(boolean explain)
    • withSearchAfter

      public SELF withSearchAfter(@Nullable List<Object> searchAfter)
    • withRequestCache

      public SELF withRequestCache(@Nullable Boolean requestCache)
    • withIdsWithRouting

      public SELF withIdsWithRouting(List<Query.IdWithRouting> idsWithRouting)
      Set Ids with routing values for a multi-get request run with this query. Not used in any other searches.
      Parameters:
      idsWithRouting - list of id values, must not be null
      Since:
      4.3
    • withRuntimeFields

      public SELF withRuntimeFields(List<RuntimeField> runtimeFields)
    • withRescorerQueries

      public SELF withRescorerQueries(List<RescorerQuery> rescorerQueries)
    • withRescorerQuery

      public SELF withRescorerQuery(RescorerQuery rescorerQuery)
    • withPointInTime

      public SELF withPointInTime(@Nullable Query.PointInTime pointInTime)
      Since:
      5.0
    • withReactiveBatchSize

      public SELF withReactiveBatchSize(@Nullable Integer reactiveBatchSize)
      Since:
      5.1
    • withAllowNoIndices

      public SELF withAllowNoIndices(@Nullable Boolean allowNoIndices)
    • withExpandWildcards

      public SELF withExpandWildcards(EnumSet<IndicesOptions.WildcardStates> expandWildcards)
    • withDocValueFields

      public SELF withDocValueFields(List<DocValueField> docValueFields)
      Since:
      5.1
    • withScriptedField

      public SELF withScriptedField(ScriptedField scriptedField)
    • build

      public abstract Q build()