Class SearchRequest.Builder
- All Implemented Interfaces:
- WithJson<SearchRequest.Builder>,- ObjectBuilder<SearchRequest>
- Enclosing class:
- SearchRequest
SearchRequest.- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionfinal SearchRequest.Builderaggregations(String key, Aggregation value) Defines the aggregations that are run as part of the search request.final SearchRequest.Builderaggregations(String key, AggregationVariant value) Defines the aggregations that are run as part of the search request.final SearchRequest.BuilderDefines the aggregations that are run as part of the search request.final SearchRequest.Builderaggregations(Map<String, Aggregation> map) Defines the aggregations that are run as part of the search request.final SearchRequest.BuilderallowNoIndices(Boolean value) Iffalse, the request returns an error if any wildcard expression, index alias, or_allvalue targets only missing or closed indices.final SearchRequest.BuilderallowPartialSearchResults(Boolean value) Iftrueand there are shard request timeouts or shard failures, the request returns partial results.final SearchRequest.BuilderThe analyzer to use for the query string.final SearchRequest.BuilderanalyzeWildcard(Boolean value) Iftrue, wildcard and prefix queries are analyzed.final SearchRequest.BuilderbatchedReduceSize(Long value) The number of shard results that should be reduced at once on the coordinating node.build()Builds aSearchRequest.final SearchRequest.BuilderccsMinimizeRoundtrips(Boolean value) Iftrue, network round-trips between the coordinating node and the remote clusters are minimized when running cross-cluster search (CCS) requests.final SearchRequest.Buildercollapse(FieldCollapse value) Collapses search results the values of the specified field.final SearchRequest.BuilderCollapses search results the values of the specified field.final SearchRequest.BuilderdefaultOperator(Operator value) The default operator for the query string query:andoror.final SearchRequest.BuilderThe field to use as a default when no field prefix is given in the query string.final SearchRequest.BuilderdocvalueFields(FieldAndFormat value, FieldAndFormat... values) An array of wildcard (*) field patterns.final SearchRequest.BuilderAn array of wildcard (*) field patterns.final SearchRequest.BuilderdocvalueFields(List<FieldAndFormat> list) An array of wildcard (*) field patterns.final SearchRequest.BuilderexpandWildcards(ExpandWildcard value, ExpandWildcard... values) The type of index that wildcard patterns can match.final SearchRequest.BuilderexpandWildcards(List<ExpandWildcard> list) The type of index that wildcard patterns can match.final SearchRequest.BuilderIftrue, the request returns detailed information about score computation as part of a hit.final SearchRequest.BuilderConfiguration of search extensions defined by Elasticsearch plugins.final SearchRequest.BuilderConfiguration of search extensions defined by Elasticsearch plugins.final SearchRequest.Builderfields(FieldAndFormat value, FieldAndFormat... values) An array of wildcard (*) field patterns.final SearchRequest.BuilderAn array of wildcard (*) field patterns.final SearchRequest.Builderfields(List<FieldAndFormat> list) An array of wildcard (*) field patterns.final SearchRequest.BuilderforceSyntheticSource(Boolean value) Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance.final SearchRequest.BuilderThe starting document offset, which must be non-negative.final SearchRequest.BuilderSpecifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results.final SearchRequest.BuilderSpecifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results.final SearchRequest.BuilderignoreThrottled(Boolean value) Deprecated.7.16.0final SearchRequest.BuilderignoreUnavailable(Boolean value) Iffalse, the request returns an error if it targets a missing or closed index.final SearchRequest.BuilderincludeNamedQueriesScore(Boolean value) Iftrue, the response includes the score contribution from any named queries.final SearchRequest.BuilderA comma-separated list of data streams, indices, and aliases to search.final SearchRequest.BuilderA comma-separated list of data streams, indices, and aliases to search.final SearchRequest.BuilderindicesBoost(NamedValue<Double> value, NamedValue<Double>... values) Boost the_scoreof documents from specified indices.final SearchRequest.BuilderindicesBoost(List<NamedValue<Double>> list) Boost the_scoreof documents from specified indices.final SearchRequest.BuilderThe approximate kNN search to run.final SearchRequest.BuilderThe approximate kNN search to run.final SearchRequest.BuilderThe approximate kNN search to run.final SearchRequest.BuilderIftrue, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.final SearchRequest.BuilderThe number of concurrent shard requests per node that the search runs concurrently.final SearchRequest.BuilderThe minimum_scorefor matching documents.final SearchRequest.Builderpit(PointInTimeReference value) Limit the search to a point in time (PIT).final SearchRequest.BuilderLimit the search to a point in time (PIT).final SearchRequest.BuilderpostFilter(Query value) Use thepost_filterparameter to filter search results.final SearchRequest.BuilderpostFilter(QueryVariant value) Use thepost_filterparameter to filter search results.final SearchRequest.BuilderUse thepost_filterparameter to filter search results.final SearchRequest.Builderpreference(String value) The nodes and shards used for the search.final SearchRequest.BuilderpreFilterShardSize(Long value) A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold.final SearchRequest.BuilderSet totrueto return detailed timing information about the execution of individual components in a search request.final SearchRequest.BuilderprojectRouting(String value) Specifies a subset of projects to target for the search using project metadata tags in a subset of Lucene query syntax.final SearchRequest.BuilderA query in the Lucene query string syntax.final SearchRequest.BuilderThe search definition using the Query DSL.final SearchRequest.Builderquery(QueryVariant value) The search definition using the Query DSL.final SearchRequest.BuilderThe search definition using the Query DSL.final SearchRequest.BuilderThe Reciprocal Rank Fusion (RRF) to use.final SearchRequest.Builderrank(RankVariant value) The Reciprocal Rank Fusion (RRF) to use.final SearchRequest.BuilderThe Reciprocal Rank Fusion (RRF) to use.final SearchRequest.BuilderrequestCache(Boolean value) Iftrue, the caching of search results is enabled for requests wheresizeis0.final SearchRequest.BuilderCan be used to improve precision by reordering just the top (for example 100 - 500) documents returned by thequeryandpost_filterphases.final SearchRequest.Builderrescore(RescoreVariant value, RescoreVariant... values) Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by thequeryandpost_filterphases.final SearchRequest.BuilderCan be used to improve precision by reordering just the top (for example 100 - 500) documents returned by thequeryandpost_filterphases.final SearchRequest.BuilderCan be used to improve precision by reordering just the top (for example 100 - 500) documents returned by thequeryandpost_filterphases.final SearchRequest.BuilderA retriever is a specification to describe top documents returned from a search.final SearchRequest.Builderretriever(RetrieverVariant value) A retriever is a specification to describe top documents returned from a search.final SearchRequest.BuilderA retriever is a specification to describe top documents returned from a search.final SearchRequest.BuilderA custom value that is used to route operations to a specific shard.final SearchRequest.BuilderruntimeMappings(String key, RuntimeField value) One or more runtime fields in the search request.final SearchRequest.BuilderOne or more runtime fields in the search request.final SearchRequest.BuilderruntimeMappings(Map<String, RuntimeField> map) One or more runtime fields in the search request.final SearchRequest.BuilderscriptFields(String key, ScriptField value) Retrieve a script evaluation (based on different fields) for each hit.final SearchRequest.BuilderRetrieve a script evaluation (based on different fields) for each hit.final SearchRequest.BuilderscriptFields(Map<String, ScriptField> map) Retrieve a script evaluation (based on different fields) for each hit.final SearchRequest.BuilderThe period to retain the search context for scrolling.final SearchRequest.BuilderThe period to retain the search context for scrolling.final SearchRequest.BuildersearchAfter(boolean value, boolean... values) Used to retrieve the next page of hits using a set of sort values from the previous page.final SearchRequest.BuildersearchAfter(double value, double... values) Used to retrieve the next page of hits using a set of sort values from the previous page.final SearchRequest.BuildersearchAfter(long value, long... values) Used to retrieve the next page of hits using a set of sort values from the previous page.final SearchRequest.BuildersearchAfter(FieldValue value, FieldValue... values) Used to retrieve the next page of hits using a set of sort values from the previous page.final SearchRequest.BuildersearchAfter(String value, String... values) Used to retrieve the next page of hits using a set of sort values from the previous page.final SearchRequest.BuilderUsed to retrieve the next page of hits using a set of sort values from the previous page.final SearchRequest.BuildersearchAfter(List<FieldValue> list) Used to retrieve the next page of hits using a set of sort values from the previous page.final SearchRequest.BuildersearchType(SearchType value) Indicates how distributed term frequencies are calculated for relevance scoring.protected SearchRequest.Builderself()final SearchRequest.BuilderseqNoPrimaryTerm(Boolean value) Iftrue, the request returns sequence number and primary term of the last modification of each hit.final SearchRequest.BuilderThe number of hits to return, which must not be negative.final SearchRequest.Builderslice(SlicedScroll value) Split a scrolled search into multiple slices that can be consumed independently.final SearchRequest.BuilderSplit a scrolled search into multiple slices that can be consumed independently.final SearchRequest.Buildersort(SortOptions value, SortOptions... values) A comma-separated list of <field>:<direction> pairs.final SearchRequest.BuilderA comma-separated list of <field>:<direction> pairs.final SearchRequest.Buildersort(List<SortOptions> list) A comma-separated list of <field>:<direction> pairs.final SearchRequest.Buildersource(SourceConfig value) The source fields that are returned for matching documents.final SearchRequest.BuilderThe source fields that are returned for matching documents.final SearchRequest.BuilderThe stats groups to associate with the search.final SearchRequest.BuilderThe stats groups to associate with the search.final SearchRequest.BuilderstoredFields(String value, String... values) A comma-separated list of stored fields to return as part of a hit.final SearchRequest.BuilderstoredFields(List<String> list) A comma-separated list of stored fields to return as part of a hit.final SearchRequest.BuilderDefines a suggester that provides similar looking terms based on a provided text.final SearchRequest.BuilderDefines a suggester that provides similar looking terms based on a provided text.final SearchRequest.BuilderterminateAfter(Long value) The maximum number of documents to collect for each shard.final SearchRequest.BuilderThe period of time to wait for a response from each shard.final SearchRequest.BuildertrackScores(Boolean value) Iftrue, calculate and return document scores, even if the scores are not used for sorting.final SearchRequest.BuildertrackTotalHits(TrackHits value) Number of hits matching the query to count accurately.final SearchRequest.BuilderNumber of hits matching the query to count accurately.final SearchRequest.BuilderIftrue, the request returns the document version as part of a hit.Methods inherited from class co.elastic.clients.util.WithJsonObjectBuilderBasewithJsonMethods inherited from class co.elastic.clients.util.ObjectBuilderBase_checkSingleUse, _listAdd, _listAddAll, _mapPut, _mapPutAll
- 
Constructor Details- 
Builderpublic Builder()
 
- 
- 
Method Details- 
sourceThe source fields that are returned for matching documents. These fields are returned in thehits._sourceproperty of the search response. If thestored_fieldsproperty is specified, the_sourceproperty defaults tofalse. Otherwise, it defaults totrue.API name: _source
- 
sourcepublic final SearchRequest.Builder source(Function<SourceConfig.Builder, ObjectBuilder<SourceConfig>> fn) The source fields that are returned for matching documents. These fields are returned in thehits._sourceproperty of the search response. If thestored_fieldsproperty is specified, the_sourceproperty defaults tofalse. Otherwise, it defaults totrue.API name: _source
- 
aggregationsDefines the aggregations that are run as part of the search request.API name: aggregationsAdds all entries of maptoaggregations.
- 
aggregationsDefines the aggregations that are run as part of the search request.API name: aggregationsAdds an entry to aggregations.
- 
aggregationsDefines the aggregations that are run as part of the search request.API name: aggregationsAdds an entry to aggregations.
- 
aggregationspublic final SearchRequest.Builder aggregations(String key, Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn) Defines the aggregations that are run as part of the search request.API name: aggregationsAdds an entry to aggregationsusing a builder lambda.
- 
allowNoIndicesIffalse, the request returns an error if any wildcard expression, index alias, or_allvalue targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targetingfoo*,bar*returns an error if an index starts withfoobut no index starts withbar.API name: allow_no_indices
- 
allowPartialSearchResultsIftrueand there are shard request timeouts or shard failures, the request returns partial results. Iffalse, it returns an error with no partial results.To override the default behavior, you can set the search.default_allow_partial_resultscluster setting tofalse.API name: allow_partial_search_results
- 
analyzeWildcardIftrue, wildcard and prefix queries are analyzed. This parameter can be used only when theqquery string parameter is specified.API name: analyze_wildcard
- 
analyzerThe analyzer to use for the query string. This parameter can be used only when theqquery string parameter is specified.API name: analyzer
- 
batchedReduceSizeThe number of shard results that should be reduced at once on the coordinating node. If the potential number of shards in the request can be large, this value should be used as a protection mechanism to reduce the memory overhead per search request.API name: batched_reduce_size
- 
ccsMinimizeRoundtripsIftrue, network round-trips between the coordinating node and the remote clusters are minimized when running cross-cluster search (CCS) requests.API name: ccs_minimize_roundtrips
- 
collapseCollapses search results the values of the specified field.API name: collapse
- 
collapsepublic final SearchRequest.Builder collapse(Function<FieldCollapse.Builder, ObjectBuilder<FieldCollapse>> fn) Collapses search results the values of the specified field.API name: collapse
- 
defaultOperatorThe default operator for the query string query:andoror. This parameter can be used only when theqquery string parameter is specified.API name: default_operator
- 
dfThe field to use as a default when no field prefix is given in the query string. This parameter can be used only when theqquery string parameter is specified.API name: df
- 
docvalueFieldsAn array of wildcard (*) field patterns. The request returns doc values for field names matching these patterns in thehits.fieldsproperty of the response.API name: docvalue_fieldsAdds all elements of listtodocvalueFields.
- 
docvalueFieldsAn array of wildcard (*) field patterns. The request returns doc values for field names matching these patterns in thehits.fieldsproperty of the response.API name: docvalue_fieldsAdds one or more values to docvalueFields.
- 
docvalueFieldspublic final SearchRequest.Builder docvalueFields(Function<FieldAndFormat.Builder, ObjectBuilder<FieldAndFormat>> fn) An array of wildcard (*) field patterns. The request returns doc values for field names matching these patterns in thehits.fieldsproperty of the response.API name: docvalue_fieldsAdds a value to docvalueFieldsusing a builder lambda.
- 
expandWildcardsThe type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports comma-separated values such asopen,hidden.API name: expand_wildcardsAdds all elements of listtoexpandWildcards.
- 
expandWildcardsThe type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports comma-separated values such asopen,hidden.API name: expand_wildcardsAdds one or more values to expandWildcards.
- 
explainIftrue, the request returns detailed information about score computation as part of a hit.API name: explain
- 
extConfiguration of search extensions defined by Elasticsearch plugins.API name: extAdds all entries of maptoext.
- 
extConfiguration of search extensions defined by Elasticsearch plugins.API name: extAdds an entry to ext.
- 
fieldsAn array of wildcard (*) field patterns. The request returns values for field names matching these patterns in thehits.fieldsproperty of the response.API name: fieldsAdds all elements of listtofields.
- 
fieldsAn array of wildcard (*) field patterns. The request returns values for field names matching these patterns in thehits.fieldsproperty of the response.API name: fieldsAdds one or more values to fields.
- 
fieldspublic final SearchRequest.Builder fields(Function<FieldAndFormat.Builder, ObjectBuilder<FieldAndFormat>> fn) An array of wildcard (*) field patterns. The request returns values for field names matching these patterns in thehits.fieldsproperty of the response.API name: fieldsAdds a value to fieldsusing a builder lambda.
- 
forceSyntheticSourceShould this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index.API name: force_synthetic_source
- 
fromThe starting document offset, which must be non-negative. By default, you cannot page through more than 10,000 hits using thefromandsizeparameters. To page through more hits, use thesearch_afterparameter.API name: from
- 
highlightSpecifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results.API name: highlight
- 
highlightpublic final SearchRequest.Builder highlight(Function<Highlight.Builder, ObjectBuilder<Highlight>> fn) Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results.API name: highlight
- 
ignoreThrottledDeprecated.7.16.0Iftrue, concrete, expanded or aliased indices will be ignored when frozen.API name: ignore_throttled
- 
includeNamedQueriesScoreIftrue, the response includes the score contribution from any named queries.This functionality reruns each named query on every hit in a search response. Typically, this adds a small overhead to a request. However, using computationally expensive named queries on a large number of hits may add significant overhead. API name: include_named_queries_score
- 
indexA comma-separated list of data streams, indices, and aliases to search. It supports wildcards (*). To search all data streams and indices, omit this parameter or use*or_all.API name: indexAdds all elements of listtoindex.
- 
indexA comma-separated list of data streams, indices, and aliases to search. It supports wildcards (*). To search all data streams and indices, omit this parameter or use*or_all.API name: indexAdds one or more values to index.
- 
indicesBoostBoost the_scoreof documents from specified indices. The boost value is the factor by which scores are multiplied. A boost value greater than1.0increases the score. A boost value between0and1.0decreases the score.API name: indices_boostAdds all elements of listtoindicesBoost.
- 
indicesBoost@SafeVarargs public final SearchRequest.Builder indicesBoost(NamedValue<Double> value, NamedValue<Double>... values) Boost the_scoreof documents from specified indices. The boost value is the factor by which scores are multiplied. A boost value greater than1.0increases the score. A boost value between0and1.0decreases the score.API name: indices_boostAdds one or more values to indicesBoost.
- 
knnThe approximate kNN search to run.API name: knnAdds all elements of listtoknn.
- 
knnThe approximate kNN search to run.API name: knnAdds one or more values to knn.
- 
knnThe approximate kNN search to run.API name: knnAdds a value to knnusing a builder lambda.
- 
lenientIftrue, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can be used only when theqquery string parameter is specified.API name: lenient
- 
maxConcurrentShardRequestsThe number of concurrent shard requests per node that the search runs concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests.API name: max_concurrent_shard_requests
- 
minScoreThe minimum_scorefor matching documents. Documents with a lower_scoreare not included in search results and results collected by aggregations.API name: min_score
- 
pitLimit the search to a point in time (PIT). If you provide a PIT, you cannot specify an<index>in the request path.API name: pit
- 
pitpublic final SearchRequest.Builder pit(Function<PointInTimeReference.Builder, ObjectBuilder<PointInTimeReference>> fn) Limit the search to a point in time (PIT). If you provide a PIT, you cannot specify an<index>in the request path.API name: pit
- 
postFilterUse thepost_filterparameter to filter search results. The search hits are filtered after the aggregations are calculated. A post filter has no impact on the aggregation results.API name: post_filter
- 
postFilterUse thepost_filterparameter to filter search results. The search hits are filtered after the aggregations are calculated. A post filter has no impact on the aggregation results.API name: post_filter
- 
postFilterUse thepost_filterparameter to filter search results. The search hits are filtered after the aggregations are calculated. A post filter has no impact on the aggregation results.API name: post_filter
- 
preFilterShardSizeA threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method (if date filters are mandatory to match but the shard bounds and the query are disjoint). When unspecified, the pre-filter phase is executed if any of these conditions is met:- The request targets more than 128 shards.
- The request targets one or more read-only index.
- The primary sort of the query targets an indexed field.
 API name: pre_filter_shard_size
- 
preferenceThe nodes and shards used for the search. By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness. Valid values are:- _only_localto run the search only on shards on the local node.
- _localto, if possible, run the search on shards on the local node, or if not, select shards using the default method.
- _only_nodes:<node-id>,<node-id>to run the search on only the specified nodes IDs. If suitable shards exist on more than one selected node, use shards on those nodes using the default method. If none of the specified nodes are available, select shards from any available node using the default method.
- _prefer_nodes:<node-id>,<node-id>to if possible, run the search on the specified nodes IDs. If not, select shards using the default method.
- _shards:<shard>,<shard>to run the search only on the specified shards. You can combine this value with other- preferencevalues. However, the- _shardsvalue must come first. For example:- _shards:2,3|_local.
- <custom-string>(any string that does not start with- _) to route searches with the same- <custom-string>to the same shards in the same order.
 API name: preference
- 
profileSet totrueto return detailed timing information about the execution of individual components in a search request. NOTE: This is a debugging tool and adds significant overhead to search execution.API name: profile
- 
projectRoutingSpecifies a subset of projects to target for the search using project metadata tags in a subset of Lucene query syntax. Allowed Lucene queries: the _alias tag and a single value (possibly wildcarded). Examples: _alias:my-project _alias:_origin _alias:pr Supported in serverless only.API name: project_routing
- 
qA query in the Lucene query string syntax. Query parameter searches do not support the full Elasticsearch Query DSL but are handy for testing.IMPORTANT: This parameter overrides the query parameter in the request body. If both parameters are specified, documents matching the query request body parameter are not returned. API name: q
- 
queryThe search definition using the Query DSL.API name: query
- 
queryThe search definition using the Query DSL.API name: query
- 
queryThe search definition using the Query DSL.API name: query
- 
rankThe Reciprocal Rank Fusion (RRF) to use.API name: rank
- 
rankThe Reciprocal Rank Fusion (RRF) to use.API name: rank
- 
rankThe Reciprocal Rank Fusion (RRF) to use.API name: rank
- 
requestCacheIftrue, the caching of search results is enabled for requests wheresizeis0. It defaults to index level settings.API name: request_cache
- 
rescoreCan be used to improve precision by reordering just the top (for example 100 - 500) documents returned by thequeryandpost_filterphases.API name: rescoreAdds all elements of listtorescore.
- 
rescoreCan be used to improve precision by reordering just the top (for example 100 - 500) documents returned by thequeryandpost_filterphases.API name: rescoreAdds one or more values to rescore.
- 
rescoreCan be used to improve precision by reordering just the top (for example 100 - 500) documents returned by thequeryandpost_filterphases.API name: rescoreAdds one or more values to rescore.
- 
rescoreCan be used to improve precision by reordering just the top (for example 100 - 500) documents returned by thequeryandpost_filterphases.API name: rescoreAdds a value to rescoreusing a builder lambda.
- 
retrieverA retriever is a specification to describe top documents returned from a search. A retriever replaces other elements of the search API that also return top documents such asqueryandknn.API name: retriever
- 
retrieverpublic final SearchRequest.Builder retriever(Function<Retriever.Builder, ObjectBuilder<Retriever>> fn) A retriever is a specification to describe top documents returned from a search. A retriever replaces other elements of the search API that also return top documents such asqueryandknn.API name: retriever
- 
retrieverA retriever is a specification to describe top documents returned from a search. A retriever replaces other elements of the search API that also return top documents such asqueryandknn.API name: retriever
- 
routingA custom value that is used to route operations to a specific shard.API name: routing
- 
runtimeMappingsOne or more runtime fields in the search request. These fields take precedence over mapped fields with the same name.API name: runtime_mappingsAdds all entries of maptoruntimeMappings.
- 
runtimeMappingsOne or more runtime fields in the search request. These fields take precedence over mapped fields with the same name.API name: runtime_mappingsAdds an entry to runtimeMappings.
- 
runtimeMappingspublic final SearchRequest.Builder runtimeMappings(String key, Function<RuntimeField.Builder, ObjectBuilder<RuntimeField>> fn) One or more runtime fields in the search request. These fields take precedence over mapped fields with the same name.API name: runtime_mappingsAdds an entry to runtimeMappingsusing a builder lambda.
- 
scriptFieldsRetrieve a script evaluation (based on different fields) for each hit.API name: script_fieldsAdds all entries of maptoscriptFields.
- 
scriptFieldsRetrieve a script evaluation (based on different fields) for each hit.API name: script_fieldsAdds an entry to scriptFields.
- 
scriptFieldspublic final SearchRequest.Builder scriptFields(String key, Function<ScriptField.Builder, ObjectBuilder<ScriptField>> fn) Retrieve a script evaluation (based on different fields) for each hit.API name: script_fieldsAdds an entry to scriptFieldsusing a builder lambda.
- 
scrollThe period to retain the search context for scrolling. By default, this value cannot exceed1d(24 hours). You can change this limit by using thesearch.max_keep_alivecluster-level setting.API name: scroll
- 
scrollThe period to retain the search context for scrolling. By default, this value cannot exceed1d(24 hours). You can change this limit by using thesearch.max_keep_alivecluster-level setting.API name: scroll
- 
searchAfterUsed to retrieve the next page of hits using a set of sort values from the previous page.API name: search_afterAdds all elements of listtosearchAfter.
- 
searchAfterUsed to retrieve the next page of hits using a set of sort values from the previous page.API name: search_afterAdds one or more values to searchAfter.
- 
searchAfterUsed to retrieve the next page of hits using a set of sort values from the previous page.API name: search_afterAdds one or more values to searchAfter.
- 
searchAfterUsed to retrieve the next page of hits using a set of sort values from the previous page.API name: search_afterAdds one or more values to searchAfter.
- 
searchAfterUsed to retrieve the next page of hits using a set of sort values from the previous page.API name: search_afterAdds one or more values to searchAfter.
- 
searchAfterUsed to retrieve the next page of hits using a set of sort values from the previous page.API name: search_afterAdds one or more values to searchAfter.
- 
searchAfterpublic final SearchRequest.Builder searchAfter(Function<FieldValue.Builder, ObjectBuilder<FieldValue>> fn) Used to retrieve the next page of hits using a set of sort values from the previous page.API name: search_afterAdds a value to searchAfterusing a builder lambda.
- 
searchTypeIndicates how distributed term frequencies are calculated for relevance scoring.API name: search_type
- 
seqNoPrimaryTermIftrue, the request returns sequence number and primary term of the last modification of each hit.API name: seq_no_primary_term
- 
sizeThe number of hits to return, which must not be negative. By default, you cannot page through more than 10,000 hits using thefromandsizeparameters. To page through more hits, use thesearch_afterproperty.API name: size
- 
sliceSplit a scrolled search into multiple slices that can be consumed independently.API name: slice
- 
slicepublic final SearchRequest.Builder slice(Function<SlicedScroll.Builder, ObjectBuilder<SlicedScroll>> fn) Split a scrolled search into multiple slices that can be consumed independently.API name: slice
- 
sortA comma-separated list of <field>:<direction> pairs.API name: sortAdds all elements of listtosort.
- 
sortA comma-separated list of <field>:<direction> pairs.API name: sortAdds one or more values to sort.
- 
sortpublic final SearchRequest.Builder sort(Function<SortOptions.Builder, ObjectBuilder<SortOptions>> fn) A comma-separated list of <field>:<direction> pairs.API name: sortAdds a value to sortusing a builder lambda.
- 
statsThe stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. You can retrieve these stats using the indices stats API.API name: statsAdds all elements of listtostats.
- 
statsThe stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. You can retrieve these stats using the indices stats API.API name: statsAdds one or more values to stats.
- 
storedFieldsA comma-separated list of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this field is specified, the_sourceproperty defaults tofalse. You can pass_source: trueto return both source fields and stored fields in the search response.API name: stored_fieldsAdds all elements of listtostoredFields.
- 
storedFieldsA comma-separated list of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this field is specified, the_sourceproperty defaults tofalse. You can pass_source: trueto return both source fields and stored fields in the search response.API name: stored_fieldsAdds one or more values to storedFields.
- 
suggestDefines a suggester that provides similar looking terms based on a provided text.API name: suggest
- 
suggestDefines a suggester that provides similar looking terms based on a provided text.API name: suggest
- 
terminateAfterThe maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting.IMPORTANT: Use with caution. Elasticsearch applies this property to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this property for requests that target data streams with backing indices across multiple data tiers. If set to 0(default), the query does not terminate early.API name: terminate_after
- 
timeoutThe period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. Defaults to no timeout.API name: timeout
- 
trackScoresIftrue, calculate and return document scores, even if the scores are not used for sorting.API name: track_scores
- 
trackTotalHitsNumber of hits matching the query to count accurately. Iftrue, the exact number of hits is returned at the cost of some performance. Iffalse, the response does not include the total number of hits matching the query.API name: track_total_hits
- 
trackTotalHitspublic final SearchRequest.Builder trackTotalHits(Function<TrackHits.Builder, ObjectBuilder<TrackHits>> fn) Number of hits matching the query to count accurately. Iftrue, the exact number of hits is returned at the cost of some performance. Iffalse, the response does not include the total number of hits matching the query.API name: track_total_hits
- 
versionIftrue, the request returns the document version as part of a hit.API name: version
- 
self- Specified by:
- selfin class- RequestBase.AbstractBuilder<SearchRequest.Builder>
 
- 
buildBuilds aSearchRequest.- Specified by:
- buildin interface- ObjectBuilder<SearchRequest>
- Throws:
- NullPointerException- if some of the required fields are null.
 
 
-