@@ -155,7 +155,41 @@ async def status(
155
155
)
156
156
157
157
@_rewrite_parameters (
158
- body_fields = True ,
158
+ body_fields = (
159
+ "aggregations" ,
160
+ "aggs" ,
161
+ "collapse" ,
162
+ "docvalue_fields" ,
163
+ "explain" ,
164
+ "ext" ,
165
+ "fields" ,
166
+ "from_" ,
167
+ "highlight" ,
168
+ "indices_boost" ,
169
+ "knn" ,
170
+ "min_score" ,
171
+ "pit" ,
172
+ "post_filter" ,
173
+ "profile" ,
174
+ "query" ,
175
+ "rescore" ,
176
+ "runtime_mappings" ,
177
+ "script_fields" ,
178
+ "search_after" ,
179
+ "seq_no_primary_term" ,
180
+ "size" ,
181
+ "slice" ,
182
+ "sort" ,
183
+ "source" ,
184
+ "stats" ,
185
+ "stored_fields" ,
186
+ "suggest" ,
187
+ "terminate_after" ,
188
+ "timeout" ,
189
+ "track_scores" ,
190
+ "track_total_hits" ,
191
+ "version" ,
192
+ ),
159
193
parameter_aliases = {
160
194
"_source" : "source" ,
161
195
"_source_excludes" : "source_excludes" ,
@@ -260,6 +294,7 @@ async def submit(
260
294
wait_for_completion_timeout : t .Optional [
261
295
t .Union ["t.Literal[-1]" , "t.Literal[0]" , str ]
262
296
] = None ,
297
+ body : t .Optional [t .Dict [str , t .Any ]] = None ,
263
298
) -> ObjectApiResponse [t .Any ]:
264
299
"""
265
300
Executes a search request asynchronously.
@@ -397,7 +432,7 @@ async def submit(
397
432
else :
398
433
__path = "/_async_search"
399
434
__query : t .Dict [str , t .Any ] = {}
400
- __body : t .Dict [str , t .Any ] = {}
435
+ __body : t .Dict [str , t .Any ] = body if body is not None else {}
401
436
# The 'sort' parameter with a colon can't be encoded to the body.
402
437
if sort is not None and (
403
438
(isinstance (sort , str ) and ":" in sort )
@@ -481,72 +516,73 @@ async def submit(
481
516
__query ["typed_keys" ] = typed_keys
482
517
if wait_for_completion_timeout is not None :
483
518
__query ["wait_for_completion_timeout" ] = wait_for_completion_timeout
484
- if aggregations is not None :
485
- __body ["aggregations" ] = aggregations
486
- if aggs is not None :
487
- __body ["aggs" ] = aggs
488
- if collapse is not None :
489
- __body ["collapse" ] = collapse
490
- if docvalue_fields is not None :
491
- __body ["docvalue_fields" ] = docvalue_fields
492
- if explain is not None :
493
- __body ["explain" ] = explain
494
- if ext is not None :
495
- __body ["ext" ] = ext
496
- if fields is not None :
497
- __body ["fields" ] = fields
498
- if from_ is not None :
499
- __body ["from" ] = from_
500
- if highlight is not None :
501
- __body ["highlight" ] = highlight
502
- if indices_boost is not None :
503
- __body ["indices_boost" ] = indices_boost
504
- if knn is not None :
505
- __body ["knn" ] = knn
506
- if min_score is not None :
507
- __body ["min_score" ] = min_score
508
- if pit is not None :
509
- __body ["pit" ] = pit
510
- if post_filter is not None :
511
- __body ["post_filter" ] = post_filter
512
- if profile is not None :
513
- __body ["profile" ] = profile
514
- if query is not None :
515
- __body ["query" ] = query
516
- if rescore is not None :
517
- __body ["rescore" ] = rescore
518
- if runtime_mappings is not None :
519
- __body ["runtime_mappings" ] = runtime_mappings
520
- if script_fields is not None :
521
- __body ["script_fields" ] = script_fields
522
- if search_after is not None :
523
- __body ["search_after" ] = search_after
524
- if seq_no_primary_term is not None :
525
- __body ["seq_no_primary_term" ] = seq_no_primary_term
526
- if size is not None :
527
- __body ["size" ] = size
528
- if slice is not None :
529
- __body ["slice" ] = slice
530
- if sort is not None :
531
- __body ["sort" ] = sort
532
- if source is not None :
533
- __body ["_source" ] = source
534
- if stats is not None :
535
- __body ["stats" ] = stats
536
- if stored_fields is not None :
537
- __body ["stored_fields" ] = stored_fields
538
- if suggest is not None :
539
- __body ["suggest" ] = suggest
540
- if terminate_after is not None :
541
- __body ["terminate_after" ] = terminate_after
542
- if timeout is not None :
543
- __body ["timeout" ] = timeout
544
- if track_scores is not None :
545
- __body ["track_scores" ] = track_scores
546
- if track_total_hits is not None :
547
- __body ["track_total_hits" ] = track_total_hits
548
- if version is not None :
549
- __body ["version" ] = version
519
+ if not __body :
520
+ if aggregations is not None :
521
+ __body ["aggregations" ] = aggregations
522
+ if aggs is not None :
523
+ __body ["aggs" ] = aggs
524
+ if collapse is not None :
525
+ __body ["collapse" ] = collapse
526
+ if docvalue_fields is not None :
527
+ __body ["docvalue_fields" ] = docvalue_fields
528
+ if explain is not None :
529
+ __body ["explain" ] = explain
530
+ if ext is not None :
531
+ __body ["ext" ] = ext
532
+ if fields is not None :
533
+ __body ["fields" ] = fields
534
+ if from_ is not None :
535
+ __body ["from" ] = from_
536
+ if highlight is not None :
537
+ __body ["highlight" ] = highlight
538
+ if indices_boost is not None :
539
+ __body ["indices_boost" ] = indices_boost
540
+ if knn is not None :
541
+ __body ["knn" ] = knn
542
+ if min_score is not None :
543
+ __body ["min_score" ] = min_score
544
+ if pit is not None :
545
+ __body ["pit" ] = pit
546
+ if post_filter is not None :
547
+ __body ["post_filter" ] = post_filter
548
+ if profile is not None :
549
+ __body ["profile" ] = profile
550
+ if query is not None :
551
+ __body ["query" ] = query
552
+ if rescore is not None :
553
+ __body ["rescore" ] = rescore
554
+ if runtime_mappings is not None :
555
+ __body ["runtime_mappings" ] = runtime_mappings
556
+ if script_fields is not None :
557
+ __body ["script_fields" ] = script_fields
558
+ if search_after is not None :
559
+ __body ["search_after" ] = search_after
560
+ if seq_no_primary_term is not None :
561
+ __body ["seq_no_primary_term" ] = seq_no_primary_term
562
+ if size is not None :
563
+ __body ["size" ] = size
564
+ if slice is not None :
565
+ __body ["slice" ] = slice
566
+ if sort is not None :
567
+ __body ["sort" ] = sort
568
+ if source is not None :
569
+ __body ["_source" ] = source
570
+ if stats is not None :
571
+ __body ["stats" ] = stats
572
+ if stored_fields is not None :
573
+ __body ["stored_fields" ] = stored_fields
574
+ if suggest is not None :
575
+ __body ["suggest" ] = suggest
576
+ if terminate_after is not None :
577
+ __body ["terminate_after" ] = terminate_after
578
+ if timeout is not None :
579
+ __body ["timeout" ] = timeout
580
+ if track_scores is not None :
581
+ __body ["track_scores" ] = track_scores
582
+ if track_total_hits is not None :
583
+ __body ["track_total_hits" ] = track_total_hits
584
+ if version is not None :
585
+ __body ["version" ] = version
550
586
if not __body :
551
587
__body = None # type: ignore[assignment]
552
588
__headers = {"accept" : "application/json" }
0 commit comments