@@ -21,20 +21,21 @@ import {
21
21
TransportResult
22
22
} from '@elastic/transport'
23
23
import * as T from '../types'
24
+ import { kAcceptedParams } from '../../client'
24
25
25
26
interface That {
26
27
transport : Transport
27
- acceptedParams : Record < string , { path : string [ ] , body : string [ ] , query : string [ ] } >
28
+ [ kAcceptedParams ] : Record < string , { path : string [ ] , body : string [ ] , query : string [ ] } >
28
29
}
29
30
30
31
const commonQueryParams = [ 'error_trace' , 'filter_path' , 'human' , 'pretty' ]
31
32
32
33
export default class AsyncSearch {
33
34
transport : Transport
34
- acceptedParams : Record < string , { path : string [ ] , body : string [ ] , query : string [ ] } >
35
+ [ kAcceptedParams ] : Record < string , { path : string [ ] , body : string [ ] , query : string [ ] } >
35
36
constructor ( transport : Transport ) {
36
37
this . transport = transport
37
- this . acceptedParams = {
38
+ this [ kAcceptedParams ] = {
38
39
'async_search.delete' : {
39
40
path : [
40
41
'id'
@@ -121,6 +122,7 @@ export default class AsyncSearch {
121
122
'lenient' ,
122
123
'max_concurrent_shard_requests' ,
123
124
'preference' ,
125
+ 'project_routing' ,
124
126
'request_cache' ,
125
127
'routing' ,
126
128
'search_type' ,
@@ -160,7 +162,7 @@ export default class AsyncSearch {
160
162
async delete ( this : That , params : T . AsyncSearchDeleteRequest , options ?: TransportRequestOptions ) : Promise < any > {
161
163
const {
162
164
path : acceptedPath
163
- } = this . acceptedParams [ 'async_search.delete' ]
165
+ } = this [ kAcceptedParams ] [ 'async_search.delete' ]
164
166
165
167
const userQuery = params ?. querystring
166
168
const querystring : Record < string , any > = userQuery != null ? { ...userQuery } : { }
@@ -190,7 +192,10 @@ export default class AsyncSearch {
190
192
name : 'async_search.delete' ,
191
193
pathParts : {
192
194
id : params . id
193
- }
195
+ } ,
196
+ acceptedParams : [
197
+ 'id'
198
+ ]
194
199
}
195
200
return await this . transport . request ( { path, method, querystring, body, meta } , options )
196
201
}
@@ -205,7 +210,7 @@ export default class AsyncSearch {
205
210
async get < TDocument = unknown , TAggregations = Record < T . AggregateName , T . AggregationsAggregate > > ( this : That , params : T . AsyncSearchGetRequest , options ?: TransportRequestOptions ) : Promise < any > {
206
211
const {
207
212
path : acceptedPath
208
- } = this . acceptedParams [ 'async_search.get' ]
213
+ } = this [ kAcceptedParams ] [ 'async_search.get' ]
209
214
210
215
const userQuery = params ?. querystring
211
216
const querystring : Record < string , any > = userQuery != null ? { ...userQuery } : { }
@@ -235,7 +240,13 @@ export default class AsyncSearch {
235
240
name : 'async_search.get' ,
236
241
pathParts : {
237
242
id : params . id
238
- }
243
+ } ,
244
+ acceptedParams : [
245
+ 'id' ,
246
+ 'keep_alive' ,
247
+ 'typed_keys' ,
248
+ 'wait_for_completion_timeout'
249
+ ]
239
250
}
240
251
return await this . transport . request ( { path, method, querystring, body, meta } , options )
241
252
}
@@ -250,7 +261,7 @@ export default class AsyncSearch {
250
261
async status ( this : That , params : T . AsyncSearchStatusRequest , options ?: TransportRequestOptions ) : Promise < any > {
251
262
const {
252
263
path : acceptedPath
253
- } = this . acceptedParams [ 'async_search.status' ]
264
+ } = this [ kAcceptedParams ] [ 'async_search.status' ]
254
265
255
266
const userQuery = params ?. querystring
256
267
const querystring : Record < string , any > = userQuery != null ? { ...userQuery } : { }
@@ -280,7 +291,11 @@ export default class AsyncSearch {
280
291
name : 'async_search.status' ,
281
292
pathParts : {
282
293
id : params . id
283
- }
294
+ } ,
295
+ acceptedParams : [
296
+ 'id' ,
297
+ 'keep_alive'
298
+ ]
284
299
}
285
300
return await this . transport . request ( { path, method, querystring, body, meta } , options )
286
301
}
@@ -297,7 +312,7 @@ export default class AsyncSearch {
297
312
path : acceptedPath ,
298
313
body : acceptedBody ,
299
314
query : acceptedQuery
300
- } = this . acceptedParams [ 'async_search.submit' ]
315
+ } = this [ kAcceptedParams ] [ 'async_search.submit' ]
301
316
302
317
const userQuery = params ?. querystring
303
318
const querystring : Record < string , any > = userQuery != null ? { ...userQuery } : { }
@@ -349,7 +364,87 @@ export default class AsyncSearch {
349
364
name : 'async_search.submit' ,
350
365
pathParts : {
351
366
index : params . index
352
- }
367
+ } ,
368
+ acceptedParams : [
369
+ 'index' ,
370
+ 'aggregations' ,
371
+ 'aggs' ,
372
+ 'collapse' ,
373
+ 'explain' ,
374
+ 'ext' ,
375
+ 'from' ,
376
+ 'highlight' ,
377
+ 'track_total_hits' ,
378
+ 'indices_boost' ,
379
+ 'docvalue_fields' ,
380
+ 'knn' ,
381
+ 'min_score' ,
382
+ 'post_filter' ,
383
+ 'profile' ,
384
+ 'query' ,
385
+ 'rescore' ,
386
+ 'script_fields' ,
387
+ 'search_after' ,
388
+ 'size' ,
389
+ 'slice' ,
390
+ 'sort' ,
391
+ '_source' ,
392
+ 'fields' ,
393
+ 'suggest' ,
394
+ 'terminate_after' ,
395
+ 'timeout' ,
396
+ 'track_scores' ,
397
+ 'version' ,
398
+ 'seq_no_primary_term' ,
399
+ 'stored_fields' ,
400
+ 'pit' ,
401
+ 'runtime_mappings' ,
402
+ 'stats' ,
403
+ 'wait_for_completion_timeout' ,
404
+ 'keep_alive' ,
405
+ 'keep_on_completion' ,
406
+ 'allow_no_indices' ,
407
+ 'allow_partial_search_results' ,
408
+ 'analyzer' ,
409
+ 'analyze_wildcard' ,
410
+ 'batched_reduce_size' ,
411
+ 'ccs_minimize_roundtrips' ,
412
+ 'default_operator' ,
413
+ 'df' ,
414
+ 'docvalue_fields' ,
415
+ 'expand_wildcards' ,
416
+ 'explain' ,
417
+ 'ignore_throttled' ,
418
+ 'ignore_unavailable' ,
419
+ 'lenient' ,
420
+ 'max_concurrent_shard_requests' ,
421
+ 'preference' ,
422
+ 'project_routing' ,
423
+ 'request_cache' ,
424
+ 'routing' ,
425
+ 'search_type' ,
426
+ 'stats' ,
427
+ 'stored_fields' ,
428
+ 'suggest_field' ,
429
+ 'suggest_mode' ,
430
+ 'suggest_size' ,
431
+ 'suggest_text' ,
432
+ 'terminate_after' ,
433
+ 'timeout' ,
434
+ 'track_total_hits' ,
435
+ 'track_scores' ,
436
+ 'typed_keys' ,
437
+ 'rest_total_hits_as_int' ,
438
+ 'version' ,
439
+ '_source' ,
440
+ '_source_excludes' ,
441
+ '_source_includes' ,
442
+ 'seq_no_primary_term' ,
443
+ 'q' ,
444
+ 'size' ,
445
+ 'from' ,
446
+ 'sort'
447
+ ]
353
448
}
354
449
return await this . transport . request ( { path, method, querystring, body, meta } , options )
355
450
}
0 commit comments