Class SearchRequestBody.Builder
- All Implemented Interfaces:
WithJson<SearchRequestBody.Builder>,ObjectBuilder<SearchRequestBody>
- Enclosing class:
- SearchRequestBody
SearchRequestBody.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaggregations(String key, Aggregation value) Defines the aggregations that are run as part of the search request.aggregations(String key, AggregationVariant value) Defines the aggregations that are run as part of the search request.Defines the aggregations that are run as part of the search request.aggregations(Map<String, Aggregation> map) Defines the aggregations that are run as part of the search request.build()Builds aSearchRequestBody.collapse(FieldCollapse value) Collapses search results the values of the specified field.Collapses search results the values of the specified field.docvalueFields(FieldAndFormat value, FieldAndFormat... values) An array of wildcard (*) field patterns.An array of wildcard (*) field patterns.docvalueFields(List<FieldAndFormat> list) An array of wildcard (*) field patterns.Iftrue, the request returns detailed information about score computation as part of a hit.Configuration of search extensions defined by Elasticsearch plugins.Configuration of search extensions defined by Elasticsearch plugins.fields(FieldAndFormat value, FieldAndFormat... values) An array of wildcard (*) field patterns.An array of wildcard (*) field patterns.fields(List<FieldAndFormat> list) An array of wildcard (*) field patterns.The starting document offset, which must be non-negative.Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results.Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results.indicesBoost(NamedValue<Double> value, NamedValue<Double>... values) Boost the_scoreof documents from specified indices.indicesBoost(List<NamedValue<Double>> list) Boost the_scoreof documents from specified indices.The approximate kNN search to run.The approximate kNN search to run.The approximate kNN search to run.The minimum_scorefor matching documents.pit(PointInTimeReference value) Limit the search to a point in time (PIT).Limit the search to a point in time (PIT).postFilter(Query value) Use thepost_filterparameter to filter search results.postFilter(QueryVariant value) Use thepost_filterparameter to filter search results.Use thepost_filterparameter to filter search results.Set totrueto return detailed timing information about the execution of individual components in a search request.The search definition using the Query DSL.query(QueryVariant value) The search definition using the Query DSL.The search definition using the Query DSL.The Reciprocal Rank Fusion (RRF) to use.rank(RankVariant value) The Reciprocal Rank Fusion (RRF) to use.The Reciprocal Rank Fusion (RRF) to use.Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by thequeryandpost_filterphases.rescore(RescoreVariant value, RescoreVariant... values) Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by thequeryandpost_filterphases.Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by thequeryandpost_filterphases.Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by thequeryandpost_filterphases.A retriever is a specification to describe top documents returned from a search.retriever(RetrieverVariant value) A retriever is a specification to describe top documents returned from a search.A retriever is a specification to describe top documents returned from a search.runtimeMappings(String key, RuntimeField value) One or more runtime fields in the search request.One or more runtime fields in the search request.runtimeMappings(Map<String, RuntimeField> map) One or more runtime fields in the search request.scriptFields(String key, ScriptField value) Retrieve a script evaluation (based on different fields) for each hit.Retrieve a script evaluation (based on different fields) for each hit.scriptFields(Map<String, ScriptField> map) Retrieve a script evaluation (based on different fields) for each hit.searchAfter(boolean value, boolean... values) Used to retrieve the next page of hits using a set of sort values from the previous page.searchAfter(double value, double... values) Used to retrieve the next page of hits using a set of sort values from the previous page.searchAfter(long value, long... values) Used to retrieve the next page of hits using a set of sort values from the previous page.searchAfter(FieldValue value, FieldValue... values) Used to retrieve the next page of hits using a set of sort values from the previous page.searchAfter(String value, String... values) Used to retrieve the next page of hits using a set of sort values from the previous page.Used to retrieve the next page of hits using a set of sort values from the previous page.searchAfter(List<FieldValue> list) Used to retrieve the next page of hits using a set of sort values from the previous page.protected SearchRequestBody.Builderself()seqNoPrimaryTerm(Boolean value) Iftrue, the request returns sequence number and primary term of the last modification of each hit.The number of hits to return, which must not be negative.slice(SlicedScroll value) Split a scrolled search into multiple slices that can be consumed independently.Split a scrolled search into multiple slices that can be consumed independently.sort(SortOptions value, SortOptions... values) A comma-separated list of <field>:<direction> pairs.A comma-separated list of <field>:<direction> pairs.sort(List<SortOptions> list) A comma-separated list of <field>:<direction> pairs.source(SourceConfig value) The source fields that are returned for matching documents.The source fields that are returned for matching documents.The stats groups to associate with the search.The stats groups to associate with the search.storedFields(String value, String... values) A comma-separated list of stored fields to return as part of a hit.storedFields(List<String> list) A comma-separated list of stored fields to return as part of a hit.Defines a suggester that provides similar looking terms based on a provided text.Defines a suggester that provides similar looking terms based on a provided text.terminateAfter(Long value) The maximum number of documents to collect for each shard.The period of time to wait for a response from each shard.trackScores(Boolean value) Iftrue, calculate and return document scores, even if the scores are not used for sorting.trackTotalHits(TrackHits value) Number of hits matching the query to count accurately.Number of hits matching the query to count accurately.Iftrue, the request returns the document version as part of a hit.Methods inherited from class co.elastic.clients.util.WithJsonObjectBuilderBase
withJsonMethods inherited from class co.elastic.clients.util.ObjectBuilderBase
_checkSingleUse, _listAdd, _listAddAll, _mapPut, _mapPutAll
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
aggregations
Defines the aggregations that are run as part of the search request.API name:
aggregationsAdds all entries of
maptoaggregations. -
aggregations
Defines the aggregations that are run as part of the search request.API name:
aggregationsAdds an entry to
aggregations. -
aggregations
Defines the aggregations that are run as part of the search request.API name:
aggregationsAdds an entry to
aggregations. -
aggregations
public final SearchRequestBody.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. -
collapse
Collapses search results the values of the specified field.API name:
collapse -
collapse
public final SearchRequestBody.Builder collapse(Function<FieldCollapse.Builder, ObjectBuilder<FieldCollapse>> fn) Collapses search results the values of the specified field.API name:
collapse -
explain
Iftrue, the request returns detailed information about score computation as part of a hit.API name:
explain -
ext
Configuration of search extensions defined by Elasticsearch plugins.API name:
extAdds all entries of
maptoext. -
ext
Configuration of search extensions defined by Elasticsearch plugins.API name:
extAdds an entry to
ext. -
from
The 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 -
highlight
Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results.API name:
highlight -
highlight
public final SearchRequestBody.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 -
trackTotalHits
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 -
trackTotalHits
public final SearchRequestBody.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 -
indicesBoost
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 all elements of
listtoindicesBoost. -
indicesBoost
@SafeVarargs public final SearchRequestBody.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. -
docvalueFields
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 all elements of
listtodocvalueFields. -
docvalueFields
public final SearchRequestBody.Builder docvalueFields(FieldAndFormat value, FieldAndFormat... values) 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 one or more values to
docvalueFields. -
docvalueFields
public final SearchRequestBody.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. -
knn
The approximate kNN search to run.API name:
knnAdds all elements of
listtoknn. -
knn
The approximate kNN search to run.API name:
knnAdds one or more values to
knn. -
knn
The approximate kNN search to run.API name:
knnAdds a value to
knnusing a builder lambda. -
rank
The Reciprocal Rank Fusion (RRF) to use.API name:
rank -
rank
The Reciprocal Rank Fusion (RRF) to use.API name:
rank -
rank
The Reciprocal Rank Fusion (RRF) to use.API name:
rank -
minScore
The minimum_scorefor matching documents. Documents with a lower_scoreare not included in search results or results collected by aggregations.API name:
min_score -
postFilter
Use 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 -
postFilter
Use 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 -
postFilter
Use 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 -
profile
Set 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 -
query
The search definition using the Query DSL.API name:
query -
query
The search definition using the Query DSL.API name:
query -
query
The search definition using the Query DSL.API name:
query -
rescore
Can 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. -
rescore
Can 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. -
rescore
Can 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. -
rescore
Can 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. -
retriever
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 -
retriever
public final SearchRequestBody.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 -
retriever
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 -
scriptFields
Retrieve a script evaluation (based on different fields) for each hit.API name:
script_fieldsAdds all entries of
maptoscriptFields. -
scriptFields
Retrieve a script evaluation (based on different fields) for each hit.API name:
script_fieldsAdds an entry to
scriptFields. -
scriptFields
public final SearchRequestBody.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. -
searchAfter
Used 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. -
searchAfter
Used 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. -
searchAfter
Used 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. -
searchAfter
Used 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. -
searchAfter
Used 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. -
searchAfter
Used 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. -
searchAfter
public final SearchRequestBody.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. -
size
The 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 -
slice
Split a scrolled search into multiple slices that can be consumed independently.API name:
slice -
slice
public final SearchRequestBody.Builder slice(Function<SlicedScroll.Builder, ObjectBuilder<SlicedScroll>> fn) Split a scrolled search into multiple slices that can be consumed independently.API name:
slice -
sort
A comma-separated list of <field>:<direction> pairs.API name:
sortAdds all elements of
listtosort. -
sort
A comma-separated list of <field>:<direction> pairs.API name:
sortAdds one or more values to
sort. -
sort
public final SearchRequestBody.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. -
source
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 -
source
public final SearchRequestBody.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 -
fields
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 all elements of
listtofields. -
fields
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 one or more values to
fields. -
fields
public final SearchRequestBody.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. -
suggest
Defines a suggester that provides similar looking terms based on a provided text.API name:
suggest -
suggest
public final SearchRequestBody.Builder suggest(Function<Suggester.Builder, ObjectBuilder<Suggester>> fn) Defines a suggester that provides similar looking terms based on a provided text.API name:
suggest -
terminateAfter
The 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 -
timeout
The 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 -
trackScores
Iftrue, calculate and return document scores, even if the scores are not used for sorting.API name:
track_scores -
version
Iftrue, the request returns the document version as part of a hit.API name:
version -
seqNoPrimaryTerm
Iftrue, the request returns sequence number and primary term of the last modification of each hit.API name:
seq_no_primary_term -
storedFields
A 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. -
storedFields
A 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. -
pit
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 -
pit
public final SearchRequestBody.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 -
runtimeMappings
One 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. -
runtimeMappings
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
runtimeMappings. -
runtimeMappings
public final SearchRequestBody.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. -
stats
The 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. -
stats
The 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. -
self
- Specified by:
selfin classWithJsonObjectBuilderBase<SearchRequestBody.Builder>
-
build
Builds aSearchRequestBody.- Specified by:
buildin interfaceObjectBuilder<SearchRequestBody>- Throws:
NullPointerException- if some of the required fields are null.
-