[[reference-shared-types-msearch]]

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    This file is autogenerated, DO NOT send pull requests that changes this file directly.                             ||
||    You should update the script that does the generation, which can be found in:                                      ||
||    https://github.com/elastic/elastic-client-generator-js                                                             ||
||                                                                                                                       ||
||    You can run the script with the following command:                                                                 ||
||       npm run elasticsearch -- --version <version>                                                                    ||
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
===========================================================================================================================
////////



== Shared Msearch types


[discrete]
[[MsearchMultiSearchItem]]
=== MsearchMultiSearchItem

[pass]
++++
<pre>
++++
interface MsearchMultiSearchItem<TDocument = unknown> extends <<SearchResponseBody>><TDocument> {
  status?: <<integer>>
}
[pass]
++++
</pre>
++++

[discrete]
[[MsearchMultiSearchResult]]
=== MsearchMultiSearchResult

[pass]
++++
<pre>
++++
interface MsearchMultiSearchResult<TDocument = unknown, TAggregations = Record<<<AggregateName>>, <<AggregationsAggregate>>>> {
  took: <<long>>
  responses: <<MsearchResponseItem>><TDocument>[]
}
[pass]
++++
</pre>
++++

[discrete]
[[MsearchMultisearchBody]]
=== MsearchMultisearchBody

[pass]
++++
<pre>
++++
interface MsearchMultisearchBody {
  aggregations?: Record<string, <<AggregationsAggregationContainer>>>
  aggs?: Record<string, <<AggregationsAggregationContainer>>>
  collapse?: <<SearchFieldCollapse>>
  pass:[/**] @property query Defines the search definition using the <<Query>> DSL. */
  query?: <<QueryDslQueryContainer>>
  pass:[/**] @property explain If true, returns detailed information about score computation as part of a hit. */
  explain?: boolean
  pass:[/**] @property ext <<Configuration>> of search extensions defined by Elasticsearch plugins. */
  ext?: Record<string, any>
  pass:[/**] @property stored_fields 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 parameter defaults to false. You can pass _source: true to return both source fields and stored fields in the search response. */
  stored_fields?: <<Fields>>
  pass:[/**] @property docvalue_fields Array of wildcard (*) patterns. The request returns doc values for field names matching these patterns in the hits.fields property of the response. */
  docvalue_fields?: (<<QueryDslFieldAndFormat>> | <<Field>>)[]
  pass:[/**] @property knn Defines the approximate kNN search to run. */
  knn?: <<KnnSearch>> | <<KnnSearch>>[]
  pass:[/**] @property from Starting document offset. By default, you cannot page through more than 10,000 hits using the from and size parameters. To page through more hits, use the search_after parameter. */
  from?: <<integer>>
  highlight?: <<SearchHighlight>>
  pass:[/**] @property indices_boost Boosts the _score of documents from specified indices. */
  indices_boost?: Record<<<IndexName>>, <<double>>>[]
  pass:[/**] @property min_score Minimum _score for matching documents. Documents with a lower _score are not included in the search results. */
  min_score?: <<double>>
  post_filter?: <<QueryDslQueryContainer>>
  profile?: boolean
  rescore?: <<SearchRescore>> | <<SearchRescore>>[]
  pass:[/**] @property script_fields Retrieve a script evaluation (based on different fields) for each hit. */
  script_fields?: Record<string, <<ScriptField>>>
  search_after?: <<SortResults>>
  pass:[/**] @property size The number of hits to return. By default, you cannot page through more than 10,000 hits using the from and size parameters. To page through more hits, use the search_after parameter. */
  size?: <<integer>>
  sort?: <<Sort>>
  pass:[/**] @property _source Indicates which source fields are returned for matching documents. These fields are returned in the hits._source property of the search response. */
  _source?: <<SearchSourceConfig>>
  pass:[/**] @property fields Array of wildcard (*) patterns. The request returns values for field names matching these patterns in the hits.fields property of the response. */
  fields?: (<<QueryDslFieldAndFormat>> | <<Field>>)[]
  pass:[/**] @property terminate_after 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. Defaults to 0, which does not terminate query execution early. */
  terminate_after?: <<long>>
  pass:[/**] @property stats <<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. */
  stats?: string[]
  pass:[/**] @property timeout Specifies 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. */
  timeout?: string
  pass:[/**] @property track_scores If true, calculate and return document scores, even if the scores are not used for sorting. */
  track_scores?: boolean
  pass:[/**] @property track_total_hits Number of hits matching the query to count accurately. If true, the exact number of hits is returned at the cost of some performance. If false, the response does not include the total number of hits matching the query. Defaults to 10,000 hits. */
  track_total_hits?: <<SearchTrackHits>>
  pass:[/**] @property version If true, returns document version as part of a hit. */
  version?: boolean
  pass:[/**] @property runtime_mappings Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. */
  runtime_mappings?: <<MappingRuntimeFields>>
  pass:[/**] @property seq_no_primary_term If true, returns sequence number and primary term of the last modification of each hit. See Optimistic concurrency control. */
  seq_no_primary_term?: boolean
  pass:[/**] @property pit Limits the search to a point in time (PIT). If you provide a PIT, you cannot specify an <index> in the request path. */
  pit?: <<SearchPointInTimeReference>>
  suggest?: <<SearchSuggester>>
}
[pass]
++++
</pre>
++++

[discrete]
[[MsearchMultisearchHeader]]
=== MsearchMultisearchHeader

[pass]
++++
<pre>
++++
interface MsearchMultisearchHeader {
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_unavailable?: boolean
  index?: <<Indices>>
  preference?: string
  request_cache?: boolean
  routing?: <<Routing>>
  search_type?: <<SearchType>>
  ccs_minimize_roundtrips?: boolean
  allow_partial_search_results?: boolean
  ignore_throttled?: boolean
}
[pass]
++++
</pre>
++++

[discrete]
[[MsearchRequest]]
=== MsearchRequest

[pass]
++++
<pre>
++++
interface MsearchRequest extends <<RequestBase>> {
  index?: <<Indices>>
  allow_no_indices?: boolean
  ccs_minimize_roundtrips?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_throttled?: boolean
  ignore_unavailable?: boolean
  include_named_queries_score?: boolean
  max_concurrent_searches?: <<long>>
  max_concurrent_shard_requests?: <<long>>
  pre_filter_shard_size?: <<long>>
  rest_total_hits_as_int?: boolean
  routing?: <<Routing>>
  search_type?: <<SearchType>>
  typed_keys?: boolean
  searches?: <<MsearchRequestItem>>[]
}
[pass]
++++
</pre>
++++

[discrete]
[[MsearchRequestItem]]
=== MsearchRequestItem

[pass]
++++
<pre>
++++
type MsearchRequestItem = <<MsearchMultisearchHeader>> | <<MsearchMultisearchBody>>
[pass]
++++
</pre>
++++

[discrete]
[[MsearchResponse]]
=== MsearchResponse

[pass]
++++
<pre>
++++
type MsearchResponse<TDocument = unknown, TAggregations = Record<<<AggregateName>>, <<AggregationsAggregate>>>> = <<MsearchMultiSearchResult>><TDocument, TAggregations>
[pass]
++++
</pre>
++++

[discrete]
[[MsearchResponseItem]]
=== MsearchResponseItem

[pass]
++++
<pre>
++++
type MsearchResponseItem<TDocument = unknown> = <<MsearchMultiSearchItem>><TDocument> | <<ErrorResponseBase>>
[pass]
++++
</pre>
++++
