Class MsearchRequest
- All Implemented Interfaces:
- JsonpSerializable,- NdJsonpSerializable
The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. The structure is as follows:
 header\n
 body\n
 header\n
 body\n
 
 
 This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node.
 IMPORTANT: The final line of data must end with a newline character
 \n. Each newline character may be preceded by a carriage return
 \r. When sending requests to this endpoint the
 Content-Type header should be set to
 application/x-ndjson.
- See Also:
- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from class co.elastic.clients.elasticsearch._types.RequestBaseRequestBase.AbstractBuilder<BuilderT extends RequestBase.AbstractBuilder<BuilderT>>
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final SimpleEndpoint<MsearchRequest,?> Endpoint "msearch".
- 
Method SummaryModifier and TypeMethodDescriptionIterator<?>final BooleanIf false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices.final BooleanIf true, network roundtrips between the coordinating node and remote clusters are minimized for cross-cluster search requests.static <TDocument>
 Endpoint<MsearchRequest,MsearchResponse<TDocument>, ErrorResponse> createMsearchEndpoint(JsonpDeserializer<TDocument> tDocumentDeserializer) Create an "msearch" endpoint.final List<ExpandWildcard>Type of index that wildcard expressions can match.final BooleanIf true, concrete, expanded or aliased indices are ignored when frozen.final BooleanIf true, missing or closed indices are not included in the response.final BooleanIndicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false) This functionality reruns each named query on every hit in a search response.index()Comma-separated list of data streams, indices, and index aliases to search.final IntegerMaximum number of concurrent searches the multi search API can execute.final IntegerMaximum number of concurrent shard requests that each sub-search request executes per node.static MsearchRequestfinal LongDefines 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 StringSpecifies a subset of projects to target for a search using project metadata tags in a subset Lucene syntax.final Stringrouting()Custom routing value used to route search operations to a specific shard.final List<RequestItem>searches()Required - Request body.final SearchTypeIndicates whether global term and document frequencies should be used when scoring returned documents.voidserialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) Serialize this value to JSON.Methods inherited from class co.elastic.clients.elasticsearch._types.RequestBasetoString
- 
Field Details- 
_ENDPOINTEndpoint "msearch".
 
- 
- 
Method Details- 
of
- 
_serializables- Specified by:
- _serializablesin interface- NdJsonpSerializable
 
- 
allowNoIndicesIf false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar.API name: allow_no_indices
- 
ccsMinimizeRoundtripsIf true, network roundtrips between the coordinating node and remote clusters are minimized for cross-cluster search requests.API name: ccs_minimize_roundtrips
- 
expandWildcardsType of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.API name: expand_wildcards
- 
ignoreThrottledIf true, concrete, expanded or aliased indices are ignored when frozen.API name: ignore_throttled
- 
includeNamedQueriesScoreIndicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false) 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
- 
indexComma-separated list of data streams, indices, and index aliases to search.API name: index
- 
maxConcurrentSearchesMaximum number of concurrent searches the multi search API can execute. Defaults tomax(1, (# of data nodes * min(search thread pool size, 10))).API name: max_concurrent_searches
- 
maxConcurrentShardRequestsMaximum number of concurrent shard requests that each sub-search request executes per node.API name: max_concurrent_shard_requests
- 
preFilterShardSizeDefines 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. 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 i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint.API name: pre_filter_shard_size
- 
projectRoutingSpecifies a subset of projects to target for a search using project metadata tags in a subset Lucene syntax. Allowed Lucene queries: the _alias tag and a single value (possible wildcarded). Examples: _alias:my-project _alias:_origin _alias:pr Supported in serverless only.API name: project_routing
- 
routingCustom routing value used to route search operations to a specific shard.API name: routing
- 
searchTypeIndicates whether global term and document frequencies should be used when scoring returned documents.API name: search_type
- 
searchesRequired - Request body.
- 
serializeSerialize this value to JSON.- Specified by:
- serializein interface- JsonpSerializable
 
- 
createMsearchEndpointpublic static <TDocument> Endpoint<MsearchRequest,MsearchResponse<TDocument>, createMsearchEndpointErrorResponse> (JsonpDeserializer<TDocument> tDocumentDeserializer) Create an "msearch" endpoint.
 
-