@@ -21,20 +21,21 @@ import {
2121 TransportResult
2222} from '@elastic/transport'
2323import * as T from '../types'
24+ import { kAcceptedParams } from '../../client'
2425
2526interface That {
2627 transport : Transport
27- acceptedParams : Record < string , { path : string [ ] , body : string [ ] , query : string [ ] } >
28+ [ kAcceptedParams ] : Record < string , { path : string [ ] , body : string [ ] , query : string [ ] } >
2829}
2930
3031const commonQueryParams = [ 'error_trace' , 'filter_path' , 'human' , 'pretty' ]
3132
3233export default class AsyncSearch {
3334 transport : Transport
34- acceptedParams : Record < string , { path : string [ ] , body : string [ ] , query : string [ ] } >
35+ [ kAcceptedParams ] : Record < string , { path : string [ ] , body : string [ ] , query : string [ ] } >
3536 constructor ( transport : Transport ) {
3637 this . transport = transport
37- this . acceptedParams = {
38+ this [ kAcceptedParams ] = {
3839 'async_search.delete' : {
3940 path : [
4041 'id'
@@ -121,6 +122,7 @@ export default class AsyncSearch {
121122 'lenient' ,
122123 'max_concurrent_shard_requests' ,
123124 'preference' ,
125+ 'project_routing' ,
124126 'request_cache' ,
125127 'routing' ,
126128 'search_type' ,
@@ -160,7 +162,7 @@ export default class AsyncSearch {
160162 async delete ( this : That , params : T . AsyncSearchDeleteRequest , options ?: TransportRequestOptions ) : Promise < any > {
161163 const {
162164 path : acceptedPath
163- } = this . acceptedParams [ 'async_search.delete' ]
165+ } = this [ kAcceptedParams ] [ 'async_search.delete' ]
164166
165167 const userQuery = params ?. querystring
166168 const querystring : Record < string , any > = userQuery != null ? { ...userQuery } : { }
@@ -190,7 +192,10 @@ export default class AsyncSearch {
190192 name : 'async_search.delete' ,
191193 pathParts : {
192194 id : params . id
193- }
195+ } ,
196+ acceptedParams : [
197+ 'id'
198+ ]
194199 }
195200 return await this . transport . request ( { path, method, querystring, body, meta } , options )
196201 }
@@ -205,7 +210,7 @@ export default class AsyncSearch {
205210 async get < TDocument = unknown , TAggregations = Record < T . AggregateName , T . AggregationsAggregate > > ( this : That , params : T . AsyncSearchGetRequest , options ?: TransportRequestOptions ) : Promise < any > {
206211 const {
207212 path : acceptedPath
208- } = this . acceptedParams [ 'async_search.get' ]
213+ } = this [ kAcceptedParams ] [ 'async_search.get' ]
209214
210215 const userQuery = params ?. querystring
211216 const querystring : Record < string , any > = userQuery != null ? { ...userQuery } : { }
@@ -235,7 +240,13 @@ export default class AsyncSearch {
235240 name : 'async_search.get' ,
236241 pathParts : {
237242 id : params . id
238- }
243+ } ,
244+ acceptedParams : [
245+ 'id' ,
246+ 'keep_alive' ,
247+ 'typed_keys' ,
248+ 'wait_for_completion_timeout'
249+ ]
239250 }
240251 return await this . transport . request ( { path, method, querystring, body, meta } , options )
241252 }
@@ -250,7 +261,7 @@ export default class AsyncSearch {
250261 async status ( this : That , params : T . AsyncSearchStatusRequest , options ?: TransportRequestOptions ) : Promise < any > {
251262 const {
252263 path : acceptedPath
253- } = this . acceptedParams [ 'async_search.status' ]
264+ } = this [ kAcceptedParams ] [ 'async_search.status' ]
254265
255266 const userQuery = params ?. querystring
256267 const querystring : Record < string , any > = userQuery != null ? { ...userQuery } : { }
@@ -280,7 +291,11 @@ export default class AsyncSearch {
280291 name : 'async_search.status' ,
281292 pathParts : {
282293 id : params . id
283- }
294+ } ,
295+ acceptedParams : [
296+ 'id' ,
297+ 'keep_alive'
298+ ]
284299 }
285300 return await this . transport . request ( { path, method, querystring, body, meta } , options )
286301 }
@@ -297,7 +312,7 @@ export default class AsyncSearch {
297312 path : acceptedPath ,
298313 body : acceptedBody ,
299314 query : acceptedQuery
300- } = this . acceptedParams [ 'async_search.submit' ]
315+ } = this [ kAcceptedParams ] [ 'async_search.submit' ]
301316
302317 const userQuery = params ?. querystring
303318 const querystring : Record < string , any > = userQuery != null ? { ...userQuery } : { }
@@ -349,7 +364,87 @@ export default class AsyncSearch {
349364 name : 'async_search.submit' ,
350365 pathParts : {
351366 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+ ]
353448 }
354449 return await this . transport . request ( { path, method, querystring, body, meta } , options )
355450 }
0 commit comments