[[reference-msearch]] == client.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 || || || || || || || =========================================================================================================================== //////// ++++ ++++ [discrete] [[client.msearch]] == `client.msearch()` Run multiple searches. 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`. {ref}/search-multi-search.html[{es} documentation] [discrete] === Function signature [source,ts] ---- (request: MsearchRequest, options?: TransportRequestOptions) => Promise ---- [discrete] === Request [source,ts,subs=+macros] ---- interface MsearchRequest extends <> { index?: <> allow_no_indices?: boolean ccs_minimize_roundtrips?: boolean expand_wildcards?: <> ignore_throttled?: boolean ignore_unavailable?: boolean include_named_queries_score?: boolean max_concurrent_searches?: <> max_concurrent_shard_requests?: <> pre_filter_shard_size?: <> rest_total_hits_as_int?: boolean routing?: <> search_type?: <> typed_keys?: boolean searches?: <>[] } ---- [discrete] === Response [source,ts,subs=+macros] ---- type MsearchResponse>, <>>> = <> ----