public class BaseQuery extends Object implements Query
Query.IdWithRouting, Query.SearchType| Modifier and Type | Field and Description |
|---|---|
protected List<String> |
fields |
protected HighlightQuery |
highlightQuery |
protected Collection<String> |
ids |
protected List<Query.IdWithRouting> |
idsWithRouting |
protected List<IndexBoost> |
indicesBoost |
protected IndicesOptions |
indicesOptions |
protected Integer |
maxResults |
protected float |
minScore |
protected Pageable |
pageable |
protected String |
preference |
protected Boolean |
requestCache |
protected List<RescorerQuery> |
rescorerQueries |
protected String |
route |
protected List<RuntimeField> |
runtimeFields |
protected Duration |
scrollTime |
protected List<Object> |
searchAfter |
protected Query.SearchType |
searchType |
protected Sort |
sort |
protected SourceFilter |
sourceFilter |
protected List<String> |
storedFields |
protected Duration |
timeout |
protected boolean |
trackScores |
protected Integer |
trackTotalHitsUpTo |
DEFAULT_PAGE, DEFAULT_PAGE_SIZE| Constructor and Description |
|---|
BaseQuery() |
BaseQuery(BaseQueryBuilder<Q,B> builder) |
| Modifier and Type | Method and Description |
|---|---|
void |
addFields(String... fields)
Add fields to be added as part of search request
|
void |
addRescorerQuery(RescorerQuery rescorerQuery)
Adds a
RescorerQuery. |
void |
addRuntimeField(RuntimeField runtimeField)
Adds a runtime field to the query.
|
<T extends Query> |
addSort(Sort sort)
Add
Sort to query |
void |
addSourceFilter(SourceFilter sourceFilter)
Add source filter to be added as part of search request
|
void |
addStoredFields(String... storedFields)
Add stored fields to be added as part of search request
|
boolean |
getExplain() |
List<String> |
getFields()
Get fields to be returned as part of search request
|
Optional<HighlightQuery> |
getHighlightQuery() |
Collection<String> |
getIds() |
List<Query.IdWithRouting> |
getIdsWithRouting() |
List<IndexBoost> |
getIndicesBoost() |
IndicesOptions |
getIndicesOptions()
Get indices options
|
Integer |
getMaxResults()
return the max of results.
|
float |
getMinScore()
Get minimum score
|
Pageable |
getPageable()
Get page settings if defined
|
String |
getPreference()
Get preference
|
Boolean |
getRequestCache() |
List<RescorerQuery> |
getRescorerQueries()
get the list of
RescorerQuerys |
String |
getRoute()
Get route
|
List<RuntimeField> |
getRuntimeFields() |
Duration |
getScrollTime()
For queries that are used in delete request, these are internally handled by Elasticsearch as scroll/bulk delete
queries.
|
List<Object> |
getSearchAfter() |
Query.SearchType |
getSearchType()
Type of search
|
Sort |
getSort() |
SourceFilter |
getSourceFilter()
Get SourceFilter to be returned to get include and exclude source fields as part of search request.
|
List<String> |
getStoredFields()
Get stored fields to be returned as part of search request
|
Duration |
getTimeout()
Get the query timeout.
|
boolean |
getTrackScores()
Get if scores will be computed and tracked, regardless of whether sorting on a field.
|
Boolean |
getTrackTotalHits()
Sets the flag whether to set the Track_total_hits parameter on queries Elasticseacrh
documentation>
|
Integer |
getTrackTotalHitsUpTo()
Gets the maximum value up to which total hits are tracked.
|
boolean |
isLimiting() |
void |
setExplain(boolean explain) |
void |
setFields(List<String> fields)
Set fields to be returned as part of search request
|
void |
setHighlightQuery(HighlightQuery highlightQuery)
Sets the
HighlightQuery. |
void |
setIds(Collection<String> ids)
Set Ids for a multi-get request with on this query.
|
void |
setIdsWithRouting(List<Query.IdWithRouting> idsWithRouting)
Set Ids with routing values for a multi-get request set on this query.
|
void |
setIndicesOptions(IndicesOptions indicesOptions) |
void |
setMaxResults(Integer maxResults) |
void |
setMinScore(float minScore) |
<T extends Query> |
setPageable(Pageable pageable)
restrict result to entries on given page.
|
void |
setPreference(String preference)
Add preference filter to be added as part of search request
|
void |
setRequestCache(Boolean value)
sets the request_cache value for the query.
|
void |
setRescorerQueries(List<RescorerQuery> rescorerQueryList)
Sets the
RescorerQuery. |
void |
setRoute(String route) |
void |
setScrollTime(Duration scrollTime)
For queries that are used in delete request, these are internally handled by Elasticsearch as scroll/bulk delete
queries.
|
void |
setSearchAfter(List<Object> searchAfter)
Sets the setSearchAfter objects for this query.
|
void |
setSearchType(Query.SearchType searchType) |
void |
setStoredFields(List<String> storedFields)
Set stored fields to be returned as part of search request
|
void |
setTimeout(Duration timeout)
set the query timeout
|
void |
setTrackScores(boolean trackScores)
Configures whether to track scores.
|
void |
setTrackTotalHits(Boolean trackTotalHits)
Sets the flag whether to set the Track_total_hits parameter on queries Elasticseacrh
documentation>
|
void |
setTrackTotalHitsUpTo(Integer trackTotalHitsUpTo)
Sets the maximum value up to which total hits are tracked.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfindAll, hasScrollTime, multiGetQuery, multiGetQueryWithRoutingprotected Pageable pageable
@Nullable protected SourceFilter sourceFilter
protected float minScore
@Nullable protected Collection<String> ids
protected Query.SearchType searchType
@Nullable protected IndicesOptions indicesOptions
protected boolean trackScores
@Nullable protected HighlightQuery highlightQuery
protected List<RescorerQuery> rescorerQueries
protected List<Query.IdWithRouting> idsWithRouting
protected final List<RuntimeField> runtimeFields
@Nullable protected List<IndexBoost> indicesBoost
public BaseQuery()
public BaseQuery(BaseQueryBuilder<Q,B> builder)
public Pageable getPageable()
QuerygetPageable in interface Querypublic final <T extends Query> T setPageable(Pageable pageable)
QuerysetPageable in interface Querypublic void addFields(String... fields)
Querypublic List<String> getFields()
Querypublic void setFields(List<String> fields)
Querypublic void addStoredFields(String... storedFields)
QueryaddStoredFields in interface Query@Nullable public List<String> getStoredFields()
QuerygetStoredFields in interface Querypublic void setStoredFields(@Nullable List<String> storedFields)
QuerysetStoredFields in interface Querypublic void addSourceFilter(SourceFilter sourceFilter)
QueryaddSourceFilter in interface Query@Nullable public SourceFilter getSourceFilter()
QuerygetSourceFilter in interface Querypublic final <T extends Query> T addSort(@Nullable Sort sort)
QuerySort to querypublic float getMinScore()
QuerygetMinScore in interface Querypublic void setMinScore(float minScore)
public void setIds(@Nullable Collection<String> ids)
ids - list of id values@Nullable public Collection<String> getIds()
public List<Query.IdWithRouting> getIdsWithRouting()
getIdsWithRouting in interface QueryQuery.multiGetQueryWithRouting(List)public void setIdsWithRouting(List<Query.IdWithRouting> idsWithRouting)
idsWithRouting - list of id values, must not be nullpublic void setRoute(String route)
public void setSearchType(Query.SearchType searchType)
public Query.SearchType getSearchType()
QuerygetSearchType in interface Query@Nullable public IndicesOptions getIndicesOptions()
QuerygetIndicesOptions in interface Querypublic void setIndicesOptions(IndicesOptions indicesOptions)
public boolean getTrackScores()
QuerygetTrackScores in interface Querypublic void setTrackScores(boolean trackScores)
trackScores - @Nullable public String getPreference()
QuerygetPreference in interface Querypublic void setPreference(String preference)
QuerysetPreference in interface Querypublic boolean isLimiting()
isLimiting in interface Query@Nullable public Integer getMaxResults()
QueryQuery.isLimiting() returns true.getMaxResults in interface Querypublic void setMaxResults(Integer maxResults)
public void setHighlightQuery(HighlightQuery highlightQuery)
QueryHighlightQuery.setHighlightQuery in interface QueryhighlightQuery - the query to setpublic Optional<HighlightQuery> getHighlightQuery()
getHighlightQuery in interface QueryHighlightQuery.public void setTrackTotalHits(@Nullable Boolean trackTotalHits)
QuerysetTrackTotalHits in interface QuerytrackTotalHits - the value to set.@Nullable public Boolean getTrackTotalHits()
QuerygetTrackTotalHits in interface Querypublic void setTrackTotalHitsUpTo(@Nullable Integer trackTotalHitsUpTo)
QuerysetTrackTotalHitsUpTo in interface QuerytrackTotalHitsUpTo - max limit for trackTotalHits@Nullable public Integer getTrackTotalHitsUpTo()
QuerygetTrackTotalHitsUpTo in interface Query@Nullable public Duration getScrollTime()
QueryQuery.hasScrollTime() returns true.getScrollTime in interface Querypublic void setScrollTime(@Nullable Duration scrollTime)
QuerysetScrollTime in interface QueryscrollTime - the scrolltime settings@Nullable public Duration getTimeout()
QuerygetTimeout in interface Querypublic void setTimeout(@Nullable Duration timeout)
timeout - public boolean getExplain()
getExplain in interface Querypublic void setExplain(boolean explain)
explain - the explain flag on the query.public void setSearchAfter(@Nullable List<Object> searchAfter)
QuerysetSearchAfter in interface QuerysearchAfter - the setSearchAfter objects. These are obtained with SearchHit.getSortValues() from a
search result.@Nullable public List<Object> getSearchAfter()
getSearchAfter in interface Querypublic void addRescorerQuery(RescorerQuery rescorerQuery)
QueryRescorerQuery.addRescorerQuery in interface QueryrescorerQuery - the query to add to the list of rescorer queries, must not be nullpublic void setRescorerQueries(List<RescorerQuery> rescorerQueryList)
QueryRescorerQuery.setRescorerQueries in interface QueryrescorerQueryList - list of rescorer queries set, must not be null.public List<RescorerQuery> getRescorerQueries()
QueryRescorerQuerysgetRescorerQueries in interface Querypublic void setRequestCache(@Nullable Boolean value)
QuerysetRequestCache in interface Queryvalue - new value@Nullable public Boolean getRequestCache()
getRequestCache in interface Querypublic void addRuntimeField(RuntimeField runtimeField)
QueryaddRuntimeField in interface QueryruntimeField - the runtime field definition, must not be nullpublic List<RuntimeField> getRuntimeFields()
getRuntimeFields in interface Query@Nullable public List<IndexBoost> getIndicesBoost()
getIndicesBoost in interface QueryCopyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.