[[reference-search]] //////// =========================================================================================================================== || || || || || || || ██████╗ ███████╗ █████╗ ██████╗ ███╗ ███╗███████╗ || || ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝ || || ██████╔╝█████╗ ███████║██║ ██║██╔████╔██║█████╗ || || ██╔══██╗██╔══╝ ██╔══██║██║ ██║██║╚██╔╝██║██╔══╝ || || ██║ ██║███████╗██║ ██║██████╔╝██║ ╚═╝ ██║███████╗ || || ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚══════╝ || || || || || || 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.search Run a search. Get search hits that match the query defined in the request. You can provide search queries using the `q` query string parameter or the request body. If both are specified, only the query parameter is used. {ref}/search-search.html[{es} documentation] [discrete] ==== Function signature [source,ts] ---- (SearchRequest, options?): Promise ---- [discrete] ===== `SearchRequest` [source,ts] ---- interface SearchRequest extends <> { index?: <> allow_no_indices?: boolean allow_partial_search_results?: boolean analyzer?: string analyze_wildcard?: boolean batched_reduce_size?: <> ccs_minimize_roundtrips?: boolean default_operator?: QueryDslOperator df?: string expand_wildcards?: <> ignore_throttled?: boolean ignore_unavailable?: boolean include_named_queries_score?: boolean lenient?: boolean max_concurrent_shard_requests?: <> min_compatible_shard_node?: <> preference?: string pre_filter_shard_size?: <> request_cache?: boolean routing?: <> scroll?: <> search_type?: <> suggest_field?: <> suggest_mode?: <> suggest_size?: <> suggest_text?: string typed_keys?: boolean rest_total_hits_as_int?: boolean _source_excludes?: <> _source_includes?: <> q?: string force_synthetic_source?: boolean aggregations?: Record /** @alias aggregations */ aggs?: Record collapse?: SearchFieldCollapse explain?: boolean ext?: Record from?: <> highlight?: SearchHighlight track_total_hits?: SearchTrackHits indices_boost?: Record<<>, <>>[] docvalue_fields?: (QueryDslFieldAndFormat | <>)[] knn?: <> | <>[] rank?: <> min_score?: <> post_filter?: QueryDslQueryContainer profile?: boolean query?: QueryDslQueryContainer rescore?: SearchRescore | SearchRescore[] retriever?: <> script_fields?: Record>> search_after?: <> size?: <> slice?: <> sort?: <> _source?: SearchSourceConfig fields?: (QueryDslFieldAndFormat | <>)[] suggest?: SearchSuggester terminate_after?: <> timeout?: string track_scores?: boolean version?: boolean seq_no_primary_term?: boolean stored_fields?: <> pit?: SearchPointInTimeReference runtime_mappings?: MappingRuntimeFields stats?: string[] } ---- [discrete] ===== `SearchResponse` [source,ts] ---- type SearchResponse>, AggregationsAggregate>> = SearchResponseBody ----