@@ -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'
@@ -160,7 +161,7 @@ export default class AsyncSearch {
160161 async delete ( this : That , params : T . AsyncSearchDeleteRequest , options ?: TransportRequestOptions ) : Promise < any > {
161162 const {
162163 path : acceptedPath
163- } = this . acceptedParams [ 'async_search.delete' ]
164+ } = this [ kAcceptedParams ] [ 'async_search.delete' ]
164165
165166 const userQuery = params ?. querystring
166167 const querystring : Record < string , any > = userQuery != null ? { ...userQuery } : { }
@@ -190,7 +191,10 @@ export default class AsyncSearch {
190191 name : 'async_search.delete' ,
191192 pathParts : {
192193 id : params . id
193- }
194+ } ,
195+ acceptedParams : [
196+ 'id'
197+ ]
194198 }
195199 return await this . transport . request ( { path, method, querystring, body, meta } , options )
196200 }
@@ -205,7 +209,7 @@ export default class AsyncSearch {
205209 async get < TDocument = unknown , TAggregations = Record < T . AggregateName , T . AggregationsAggregate > > ( this : That , params : T . AsyncSearchGetRequest , options ?: TransportRequestOptions ) : Promise < any > {
206210 const {
207211 path : acceptedPath
208- } = this . acceptedParams [ 'async_search.get' ]
212+ } = this [ kAcceptedParams ] [ 'async_search.get' ]
209213
210214 const userQuery = params ?. querystring
211215 const querystring : Record < string , any > = userQuery != null ? { ...userQuery } : { }
@@ -235,7 +239,13 @@ export default class AsyncSearch {
235239 name : 'async_search.get' ,
236240 pathParts : {
237241 id : params . id
238- }
242+ } ,
243+ acceptedParams : [
244+ 'id' ,
245+ 'keep_alive' ,
246+ 'typed_keys' ,
247+ 'wait_for_completion_timeout'
248+ ]
239249 }
240250 return await this . transport . request ( { path, method, querystring, body, meta } , options )
241251 }
@@ -250,7 +260,7 @@ export default class AsyncSearch {
250260 async status ( this : That , params : T . AsyncSearchStatusRequest , options ?: TransportRequestOptions ) : Promise < any > {
251261 const {
252262 path : acceptedPath
253- } = this . acceptedParams [ 'async_search.status' ]
263+ } = this [ kAcceptedParams ] [ 'async_search.status' ]
254264
255265 const userQuery = params ?. querystring
256266 const querystring : Record < string , any > = userQuery != null ? { ...userQuery } : { }
@@ -280,7 +290,11 @@ export default class AsyncSearch {
280290 name : 'async_search.status' ,
281291 pathParts : {
282292 id : params . id
283- }
293+ } ,
294+ acceptedParams : [
295+ 'id' ,
296+ 'keep_alive'
297+ ]
284298 }
285299 return await this . transport . request ( { path, method, querystring, body, meta } , options )
286300 }
@@ -297,7 +311,7 @@ export default class AsyncSearch {
297311 path : acceptedPath ,
298312 body : acceptedBody ,
299313 query : acceptedQuery
300- } = this . acceptedParams [ 'async_search.submit' ]
314+ } = this [ kAcceptedParams ] [ 'async_search.submit' ]
301315
302316 const userQuery = params ?. querystring
303317 const querystring : Record < string , any > = userQuery != null ? { ...userQuery } : { }
@@ -349,7 +363,86 @@ export default class AsyncSearch {
349363 name : 'async_search.submit' ,
350364 pathParts : {
351365 index : params . index
352- }
366+ } ,
367+ acceptedParams : [
368+ 'index' ,
369+ 'aggregations' ,
370+ 'aggs' ,
371+ 'collapse' ,
372+ 'explain' ,
373+ 'ext' ,
374+ 'from' ,
375+ 'highlight' ,
376+ 'track_total_hits' ,
377+ 'indices_boost' ,
378+ 'docvalue_fields' ,
379+ 'knn' ,
380+ 'min_score' ,
381+ 'post_filter' ,
382+ 'profile' ,
383+ 'query' ,
384+ 'rescore' ,
385+ 'script_fields' ,
386+ 'search_after' ,
387+ 'size' ,
388+ 'slice' ,
389+ 'sort' ,
390+ '_source' ,
391+ 'fields' ,
392+ 'suggest' ,
393+ 'terminate_after' ,
394+ 'timeout' ,
395+ 'track_scores' ,
396+ 'version' ,
397+ 'seq_no_primary_term' ,
398+ 'stored_fields' ,
399+ 'pit' ,
400+ 'runtime_mappings' ,
401+ 'stats' ,
402+ 'wait_for_completion_timeout' ,
403+ 'keep_alive' ,
404+ 'keep_on_completion' ,
405+ 'allow_no_indices' ,
406+ 'allow_partial_search_results' ,
407+ 'analyzer' ,
408+ 'analyze_wildcard' ,
409+ 'batched_reduce_size' ,
410+ 'ccs_minimize_roundtrips' ,
411+ 'default_operator' ,
412+ 'df' ,
413+ 'docvalue_fields' ,
414+ 'expand_wildcards' ,
415+ 'explain' ,
416+ 'ignore_throttled' ,
417+ 'ignore_unavailable' ,
418+ 'lenient' ,
419+ 'max_concurrent_shard_requests' ,
420+ 'preference' ,
421+ 'request_cache' ,
422+ 'routing' ,
423+ 'search_type' ,
424+ 'stats' ,
425+ 'stored_fields' ,
426+ 'suggest_field' ,
427+ 'suggest_mode' ,
428+ 'suggest_size' ,
429+ 'suggest_text' ,
430+ 'terminate_after' ,
431+ 'timeout' ,
432+ 'track_total_hits' ,
433+ 'track_scores' ,
434+ 'typed_keys' ,
435+ 'rest_total_hits_as_int' ,
436+ 'version' ,
437+ '_source' ,
438+ '_source_excludes' ,
439+ '_source_includes' ,
440+ 'seq_no_primary_term' ,
441+ 'q' ,
442+ 'size' ,
443+ 'from' ,
444+ 'sort'
445+ ]
353446 }
354447 return await this . transport . request ( { path, method, querystring, body, meta } , options )
355448 }
0 commit comments