Class SearchRequestBody
- All Implemented Interfaces:
JsonpSerializable
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JsonpDeserializer<SearchRequestBody>
Json deserializer forSearchRequestBody
-
Method Summary
Modifier and TypeMethodDescriptionfinal Map<String,
Aggregation> Defines the aggregations that are run as part of the search request.final FieldCollapse
collapse()
Collapses search results the values of the specified field.final List<FieldAndFormat>
An array of wildcard (*
) field patterns.final Boolean
explain()
Iftrue
, the request returns detailed information about score computation as part of a hit.ext()
Configuration of search extensions defined by Elasticsearch plugins.final List<FieldAndFormat>
fields()
An array of wildcard (*
) field patterns.final Integer
from()
The starting document offset, which must be non-negative.final Highlight
Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results.final List<NamedValue<Double>>
Boost the_score
of documents from specified indices.knn()
The approximate kNN search to run.final Double
minScore()
The minimum_score
for matching documents.static SearchRequestBody
final PointInTimeReference
pit()
Limit the search to a point in time (PIT).final Query
Use thepost_filter
parameter to filter search results.final Boolean
profile()
Set totrue
to return detailed timing information about the execution of individual components in a search request.final Query
query()
The search definition using the Query DSL.final Rank
rank()
The Reciprocal Rank Fusion (RRF) to use.rescore()
Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by thequery
andpost_filter
phases.final Retriever
A retriever is a specification to describe top documents returned from a search.final Map<String,
RuntimeField> One or more runtime fields in the search request.final Map<String,
ScriptField> Retrieve a script evaluation (based on different fields) for each hit.final List<FieldValue>
Used to retrieve the next page of hits using a set of sort values from the previous page.final Boolean
Iftrue
, the request returns sequence number and primary term of the last modification of each hit.void
serialize
(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) Serialize this object to JSON.protected void
serializeInternal
(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) protected static void
final Integer
size()
The number of hits to return, which must not be negative.final SlicedScroll
slice()
Split a scrolled search into multiple slices that can be consumed independently.final List<SortOptions>
sort()
A comma-separated list of <field>:<direction> pairs.final SourceConfig
source()
The source fields that are returned for matching documents.stats()
The stats groups to associate with the search.A comma-separated list of stored fields to return as part of a hit.final Suggester
suggest()
Defines a suggester that provides similar looking terms based on a provided text.final Long
The maximum number of documents to collect for each shard.final String
timeout()
The period of time to wait for a response from each shard.toString()
final Boolean
Iftrue
, calculate and return document scores, even if the scores are not used for sorting.final TrackHits
Number of hits matching the query to count accurately.final Boolean
version()
Iftrue
, the request returns the document version as part of a hit.
-
Field Details
-
_DESERIALIZER
Json deserializer forSearchRequestBody
-
-
Method Details
-
of
public static SearchRequestBody of(Function<SearchRequestBody.Builder, ObjectBuilder<SearchRequestBody>> fn) -
aggregations
Defines the aggregations that are run as part of the search request.API name:
aggregations
-
collapse
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:
ext
-
from
The starting document offset, which must be non-negative. By default, you cannot page through more than 10,000 hits using thefrom
andsize
parameters. To page through more hits, use thesearch_after
parameter.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
-
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
-
indicesBoost
Boost the_score
of documents from specified indices. The boost value is the factor by which scores are multiplied. A boost value greater than1.0
increases the score. A boost value between0
and1.0
decreases the score.API name:
indices_boost
-
docvalueFields
An array of wildcard (*
) field patterns. The request returns doc values for field names matching these patterns in thehits.fields
property of the response.API name:
docvalue_fields
-
knn
The approximate kNN search to run.API name:
knn
-
rank
The Reciprocal Rank Fusion (RRF) to use.API name:
rank
-
minScore
The minimum_score
for matching documents. Documents with a lower_score
are not included in search results or results collected by aggregations.API name:
min_score
-
postFilter
Use thepost_filter
parameter 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 totrue
to 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
-
rescore
Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by thequery
andpost_filter
phases.API name:
rescore
-
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 asquery
andknn
.API name:
retriever
-
scriptFields
Retrieve a script evaluation (based on different fields) for each hit.API name:
script_fields
-
searchAfter
Used to retrieve the next page of hits using a set of sort values from the previous page.API name:
search_after
-
size
The number of hits to return, which must not be negative. By default, you cannot page through more than 10,000 hits using thefrom
andsize
parameters. To page through more hits, use thesearch_after
property.API name:
size
-
slice
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:
sort
-
source
The source fields that are returned for matching documents. These fields are returned in thehits._source
property of the search response. If thestored_fields
property is specified, the_source
property 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.fields
property of the response.API name:
fields
-
suggest
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_source
property defaults tofalse
. You can pass_source: true
to return both source fields and stored fields in the search response.API name:
stored_fields
-
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
-
runtimeMappings
One or more runtime fields in the search request. These fields take precedence over mapped fields with the same name.API name:
runtime_mappings
-
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:
stats
-
serialize
Serialize this object to JSON.- Specified by:
serialize
in interfaceJsonpSerializable
-
serializeInternal
-
toString
-
setupSearchRequestBodyDeserializer
protected static void setupSearchRequestBodyDeserializer(ObjectDeserializer<SearchRequestBody.Builder> op)
-