1818 */
1919
2020import { ResponseBody as SearchResponse } from '@global/search/SearchResponse'
21- import { FieldCollapse } from '@global/search/_types/FieldCollapse'
22- import { Highlight } from '@global/search/_types/highlighting'
23- import { TrackHits } from '@global/search/_types/hits'
24- import { PointInTimeReference } from '@global/search/_types/PointInTimeReference'
25- import { Rescore } from '@global/search/_types/rescoring'
26- import { SourceConfig } from '@global/search/_types/SourceFilter'
27- import { Suggester } from '@global/search/_types/suggester'
28- import { Dictionary , SingleKeyDictionary } from '@spec_utils/Dictionary'
29- import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
30- import { AggregationContainer } from '@_types/aggregations/AggregationContainer'
21+ import { SearchRequestBody } from '@global/search/_types/SearchRequestBody'
3122import { ErrorResponseBase } from '@_types/Base'
32- import {
33- ExpandWildcards ,
34- Fields ,
35- IndexName ,
36- Indices ,
37- Routing ,
38- SearchType
39- } from '@_types/common'
40- import { KnnSearch } from '@_types/Knn'
41- import { RuntimeFields } from '@_types/mapping/RuntimeFields'
42- import { double , integer , long } from '@_types/Numeric'
43- import { FieldAndFormat , QueryContainer } from '@_types/query_dsl/abstractions'
44- import { ScriptField } from '@_types/Scripting'
45- import { Sort , SortResults } from '@_types/sort'
23+ import { ExpandWildcards , Indices , Routing , SearchType } from '@_types/common'
24+ import { integer , long } from '@_types/Numeric'
4625
4726/**
4827 * @codegen_names header, body
4928 */
50- export type RequestItem = MultisearchHeader | MultisearchBody
29+ export type RequestItem = MultisearchHeader | SearchRequestBody
5130
5231/**
5332 * Contains parameters used to limit or change the subsequent search body request.
@@ -66,143 +45,6 @@ export class MultisearchHeader {
6645 ignore_throttled ?: boolean
6746}
6847
69- // We should keep this in sync with the normal search request body.
70- export class MultisearchBody {
71- /**
72- * @aliases aggs
73- * @ext_doc_id search-aggregations
74- */ // ES uses "aggregations" in serialization
75- aggregations ?: Dictionary < string , AggregationContainer >
76- collapse ?: FieldCollapse
77- /**
78- * Defines the search definition using the Query DSL.
79- */
80- query ?: QueryContainer
81- /**
82- * If true, returns detailed information about score computation as part of a hit.
83- * @server_default false
84- */
85- explain ?: boolean
86- /**
87- * Configuration of search extensions defined by Elasticsearch plugins.
88- */
89- ext ?: Dictionary < string , UserDefinedValue >
90- /**
91- * List of stored fields to return as part of a hit. If no fields are specified,
92- * no stored fields are included in the response. If this field is specified, the _source
93- * parameter defaults to false. You can pass _source: true to return both source fields
94- * and stored fields in the search response.
95- */
96- stored_fields ?: Fields
97- /**
98- * Array of wildcard (*) patterns. The request returns doc values for field
99- * names matching these patterns in the hits.fields property of the response.
100- */
101- docvalue_fields ?: FieldAndFormat [ ]
102- /**
103- * Defines the approximate kNN search to run.
104- * @availability stack since=8.4.0
105- * @availability serverless
106- */
107- knn ?: KnnSearch | KnnSearch [ ]
108- /**
109- * Starting document offset. By default, you cannot page through more than 10,000
110- * hits using the from and size parameters. To page through more hits, use the
111- * search_after parameter.
112- * @server_default 0
113- */
114- from ?: integer
115- highlight ?: Highlight
116- /**
117- * Boosts the _score of documents from specified indices.
118- */
119- indices_boost ?: Array < SingleKeyDictionary < IndexName , double > >
120- /**
121- * Minimum _score for matching documents. Documents with a lower _score are
122- * not included in the search results.
123- */
124- min_score ?: double
125- post_filter ?: QueryContainer
126- profile ?: boolean
127- rescore ?: Rescore | Rescore [ ]
128- /**
129- * Retrieve a script evaluation (based on different fields) for each hit.
130- */
131- script_fields ?: Dictionary < string , ScriptField >
132- search_after ?: SortResults
133- /**
134- * The number of hits to return. By default, you cannot page through more
135- * than 10,000 hits using the from and size parameters. To page through more
136- * hits, use the search_after parameter.
137- * @server_default 10
138- */
139- size ?: integer
140- /** @doc_id sort-search-results */
141- sort ?: Sort
142- /**
143- * Indicates which source fields are returned for matching documents. These
144- * fields are returned in the hits._source property of the search response.
145- */
146- _source ?: SourceConfig
147- /**
148- * Array of wildcard (*) patterns. The request returns values for field names
149- * matching these patterns in the hits.fields property of the response.
150- */
151- fields ?: Array < FieldAndFormat >
152- /**
153- * Maximum number of documents to collect for each shard. If a query reaches this
154- * limit, Elasticsearch terminates the query early. Elasticsearch collects documents
155- * before sorting. Defaults to 0, which does not terminate query execution early.
156- * @server_default 0
157- */
158- terminate_after ?: long
159- /**
160- * Stats groups to associate with the search. Each group maintains a statistics
161- * aggregation for its associated searches. You can retrieve these stats using
162- * the indices stats API.
163- */
164- stats ?: string [ ]
165- /**
166- * Specifies the period of time to wait for a response from each shard. If no response
167- * is received before the timeout expires, the request fails and returns an error.
168- * Defaults to no timeout.
169- */
170- timeout ?: string
171- /**
172- * If true, calculate and return document scores, even if the scores are not used for sorting.
173- * @server_default false
174- */
175- track_scores ?: boolean
176- /**
177- * Number of hits matching the query to count accurately. If true, the exact
178- * number of hits is returned at the cost of some performance. If false, the
179- * response does not include the total number of hits matching the query.
180- * Defaults to 10,000 hits.
181- */
182- track_total_hits ?: TrackHits
183- /**
184- * If true, returns document version as part of a hit.
185- * @server_default false
186- */
187- version ?: boolean
188- /**
189- * Defines one or more runtime fields in the search request. These fields take
190- * precedence over mapped fields with the same name.
191- */
192- runtime_mappings ?: RuntimeFields
193- /**
194- * If true, returns sequence number and primary term of the last modification
195- * of each hit. See Optimistic concurrency control.
196- */
197- seq_no_primary_term ?: boolean
198- /**
199- * Limits the search to a point in time (PIT). If you provide a PIT, you
200- * cannot specify an <index> in the request path.
201- */
202- pit ?: PointInTimeReference
203- suggest ?: Suggester
204- }
205-
20648export class MultiSearchResult < TDocument > {
20749 took : long
20850 responses : Array < ResponseItem < TDocument > >
0 commit comments