Class MsearchTemplateRequest

java.lang.Object
co.elastic.clients.elasticsearch._types.RequestBase
co.elastic.clients.elasticsearch.core.MsearchTemplateRequest
All Implemented Interfaces:
JsonpSerializable, NdJsonpSerializable

public class MsearchTemplateRequest extends RequestBase implements NdJsonpSerializable, JsonpSerializable
Run multiple templated searches.

Run multiple templated searches with a single request. If you are providing a text file or text input to curl, use the --data-binary flag instead of -d to preserve newlines. For example:

 $ cat requests
 { "index": "my-index" }
 { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }}
 { "index": "my-other-index" }
 { "id": "my-other-search-template", "params": { "query_type": "match_all" }}

 $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo
 
 
See Also:
  • Field Details

  • Method Details

    • of

    • _serializables

      public Iterator<?> _serializables()
      Specified by:
      _serializables in interface NdJsonpSerializable
    • ccsMinimizeRoundtrips

      @Nullable public final Boolean ccsMinimizeRoundtrips()
      If true, network round-trips are minimized for cross-cluster search requests.

      API name: ccs_minimize_roundtrips

    • index

      public final List<String> index()
      A 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 *.

      API name: index

    • maxConcurrentSearches

      @Nullable public final Long maxConcurrentSearches()
      The maximum number of concurrent searches the API can run.

      API name: max_concurrent_searches

    • projectRouting

      @Nullable public final String projectRouting()
      Specifies 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

    • searchType

      @Nullable public final SearchType searchType()
      The type of the search operation.

      API name: search_type

    • searchTemplates

      public final List<RequestItem> searchTemplates()
      Required - Request body.
    • serialize

      public void serialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
      Serialize this value to JSON.
      Specified by:
      serialize in interface JsonpSerializable
    • createMsearchTemplateEndpoint

      public static <TDocument> Endpoint<MsearchTemplateRequest,MsearchTemplateResponse<TDocument>,ErrorResponse> createMsearchTemplateEndpoint(JsonpDeserializer<TDocument> tDocumentDeserializer)
      Create an "msearch_template" endpoint.