@@ -124,6 +124,391 @@ public sealed class AsyncSearchSubmitRequestParameters : RequestParameters<Async
124124 public string ? QueryLuceneSyntax { get => Q < string ? > ( "q" ) ; set => Q ( "q" , value ) ; }
125125 }
126126
127+ internal sealed class AsyncSearchSubmitRequestConverter : JsonConverter < AsyncSearchSubmitRequest >
128+ {
129+ public override AsyncSearchSubmitRequest Read ( ref Utf8JsonReader reader , Type typeToConvert , JsonSerializerOptions options )
130+ {
131+ if ( reader . TokenType != JsonTokenType . StartObject )
132+ throw new JsonException ( "Unexpected JSON detected." ) ;
133+ var variant = new AsyncSearchSubmitRequest ( ) ;
134+ while ( reader . Read ( ) && reader . TokenType != JsonTokenType . EndObject )
135+ {
136+ if ( reader . TokenType == JsonTokenType . PropertyName )
137+ {
138+ var property = reader . GetString ( ) ;
139+ if ( property == "aggregations" || property == "aggs" )
140+ {
141+ variant . Aggregations = JsonSerializer . Deserialize < Elastic . Clients . Elasticsearch . Aggregations . AggregationDictionary ? > ( ref reader , options ) ;
142+ continue ;
143+ }
144+
145+ if ( property == "collapse" )
146+ {
147+ variant . Collapse = JsonSerializer . Deserialize < Elastic . Clients . Elasticsearch . FieldCollapse ? > ( ref reader , options ) ;
148+ continue ;
149+ }
150+
151+ if ( property == "explain" )
152+ {
153+ variant . Explain = JsonSerializer . Deserialize < bool ? > ( ref reader , options ) ;
154+ continue ;
155+ }
156+
157+ if ( property == "from" )
158+ {
159+ variant . From = JsonSerializer . Deserialize < int ? > ( ref reader , options ) ;
160+ continue ;
161+ }
162+
163+ if ( property == "highlight" )
164+ {
165+ variant . Highlight = JsonSerializer . Deserialize < Elastic . Clients . Elasticsearch . Highlight ? > ( ref reader , options ) ;
166+ continue ;
167+ }
168+
169+ if ( property == "track_total_hits" )
170+ {
171+ variant . TrackTotalHits = JsonSerializer . Deserialize < Elastic . Clients . Elasticsearch . TrackHits ? > ( ref reader , options ) ;
172+ continue ;
173+ }
174+
175+ if ( property == "indices_boost" )
176+ {
177+ variant . IndicesBoost = JsonSerializer . Deserialize < IEnumerable < Dictionary < Elastic . Clients . Elasticsearch . IndexName , double > > ? > ( ref reader , options ) ;
178+ continue ;
179+ }
180+
181+ if ( property == "docvalue_fields" )
182+ {
183+ variant . DocvalueFields = JsonSerializer . Deserialize < IEnumerable < Elastic . Clients . Elasticsearch . QueryDsl . FieldAndFormat > ? > ( ref reader , options ) ;
184+ continue ;
185+ }
186+
187+ if ( property == "min_score" )
188+ {
189+ variant . MinScore = JsonSerializer . Deserialize < double ? > ( ref reader , options ) ;
190+ continue ;
191+ }
192+
193+ if ( property == "post_filter" )
194+ {
195+ variant . PostFilter = JsonSerializer . Deserialize < Elastic . Clients . Elasticsearch . QueryDsl . QueryContainer ? > ( ref reader , options ) ;
196+ continue ;
197+ }
198+
199+ if ( property == "profile" )
200+ {
201+ variant . Profile = JsonSerializer . Deserialize < bool ? > ( ref reader , options ) ;
202+ continue ;
203+ }
204+
205+ if ( property == "query" )
206+ {
207+ variant . Query = JsonSerializer . Deserialize < Elastic . Clients . Elasticsearch . QueryDsl . QueryContainer ? > ( ref reader , options ) ;
208+ continue ;
209+ }
210+
211+ if ( property == "rescore" )
212+ {
213+ variant . Rescore = JsonSerializer . Deserialize < IEnumerable < Elastic . Clients . Elasticsearch . Rescore > ? > ( ref reader , options ) ;
214+ continue ;
215+ }
216+
217+ if ( property == "script_fields" )
218+ {
219+ variant . ScriptFields = JsonSerializer . Deserialize < Dictionary < string , Elastic . Clients . Elasticsearch . ScriptField > ? > ( ref reader , options ) ;
220+ continue ;
221+ }
222+
223+ if ( property == "search_after" )
224+ {
225+ variant . SearchAfter = JsonSerializer . Deserialize < IEnumerable < object > ? > ( ref reader , options ) ;
226+ continue ;
227+ }
228+
229+ if ( property == "size" )
230+ {
231+ variant . Size = JsonSerializer . Deserialize < int ? > ( ref reader , options ) ;
232+ continue ;
233+ }
234+
235+ if ( property == "slice" )
236+ {
237+ variant . Slice = JsonSerializer . Deserialize < Elastic . Clients . Elasticsearch . SlicedScroll ? > ( ref reader , options ) ;
238+ continue ;
239+ }
240+
241+ if ( property == "sort" )
242+ {
243+ variant . Sort = JsonSerializer . Deserialize < IEnumerable < Elastic . Clients . Elasticsearch . SortCombinations > ? > ( ref reader , options ) ;
244+ continue ;
245+ }
246+
247+ if ( property == "_source" )
248+ {
249+ variant . Source = JsonSerializer . Deserialize < Elastic . Clients . Elasticsearch . SourceConfig ? > ( ref reader , options ) ;
250+ continue ;
251+ }
252+
253+ if ( property == "fields" )
254+ {
255+ variant . Fields = JsonSerializer . Deserialize < IEnumerable < Elastic . Clients . Elasticsearch . QueryDsl . FieldAndFormat > ? > ( ref reader , options ) ;
256+ continue ;
257+ }
258+
259+ if ( property == "suggest" )
260+ {
261+ variant . Suggest = JsonSerializer . Deserialize < Elastic . Clients . Elasticsearch . Suggester ? > ( ref reader , options ) ;
262+ continue ;
263+ }
264+
265+ if ( property == "terminate_after" )
266+ {
267+ variant . TerminateAfter = JsonSerializer . Deserialize < long ? > ( ref reader , options ) ;
268+ continue ;
269+ }
270+
271+ if ( property == "timeout" )
272+ {
273+ variant . Timeout = JsonSerializer . Deserialize < string ? > ( ref reader , options ) ;
274+ continue ;
275+ }
276+
277+ if ( property == "track_scores" )
278+ {
279+ variant . TrackScores = JsonSerializer . Deserialize < bool ? > ( ref reader , options ) ;
280+ continue ;
281+ }
282+
283+ if ( property == "version" )
284+ {
285+ variant . Version = JsonSerializer . Deserialize < bool ? > ( ref reader , options ) ;
286+ continue ;
287+ }
288+
289+ if ( property == "seq_no_primary_term" )
290+ {
291+ variant . SeqNoPrimaryTerm = JsonSerializer . Deserialize < bool ? > ( ref reader , options ) ;
292+ continue ;
293+ }
294+
295+ if ( property == "stored_fields" )
296+ {
297+ variant . StoredFields = JsonSerializer . Deserialize < Elastic . Clients . Elasticsearch . Fields ? > ( ref reader , options ) ;
298+ continue ;
299+ }
300+
301+ if ( property == "pit" )
302+ {
303+ variant . Pit = JsonSerializer . Deserialize < Elastic . Clients . Elasticsearch . PointInTimeReference ? > ( ref reader , options ) ;
304+ continue ;
305+ }
306+
307+ if ( property == "runtime_mappings" )
308+ {
309+ variant . RuntimeMappings = JsonSerializer . Deserialize < Dictionary < Elastic . Clients . Elasticsearch . Field , IEnumerable < Elastic . Clients . Elasticsearch . Mapping . RuntimeField > > ? > ( ref reader , options ) ;
310+ continue ;
311+ }
312+
313+ if ( property == "stats" )
314+ {
315+ variant . Stats = JsonSerializer . Deserialize < IEnumerable < string > ? > ( ref reader , options ) ;
316+ continue ;
317+ }
318+ }
319+ }
320+
321+ return variant ;
322+ }
323+
324+ public override void Write ( Utf8JsonWriter writer , AsyncSearchSubmitRequest value , JsonSerializerOptions options )
325+ {
326+ writer . WriteStartObject ( ) ;
327+ if ( value . Aggregations is not null )
328+ {
329+ writer . WritePropertyName ( "aggregations" ) ;
330+ JsonSerializer . Serialize ( writer , value . Aggregations , options ) ;
331+ }
332+
333+ if ( value . Collapse is not null )
334+ {
335+ writer . WritePropertyName ( "collapse" ) ;
336+ JsonSerializer . Serialize ( writer , value . Collapse , options ) ;
337+ }
338+
339+ if ( value . Explain . HasValue )
340+ {
341+ writer . WritePropertyName ( "explain" ) ;
342+ writer . WriteBooleanValue ( value . Explain . Value ) ;
343+ }
344+
345+ if ( value . From . HasValue )
346+ {
347+ writer . WritePropertyName ( "from" ) ;
348+ writer . WriteNumberValue ( value . From . Value ) ;
349+ }
350+
351+ if ( value . Highlight is not null )
352+ {
353+ writer . WritePropertyName ( "highlight" ) ;
354+ JsonSerializer . Serialize ( writer , value . Highlight , options ) ;
355+ }
356+
357+ if ( value . TrackTotalHits is not null )
358+ {
359+ writer . WritePropertyName ( "track_total_hits" ) ;
360+ JsonSerializer . Serialize ( writer , value . TrackTotalHits , options ) ;
361+ }
362+
363+ if ( value . IndicesBoost is not null )
364+ {
365+ writer . WritePropertyName ( "indices_boost" ) ;
366+ JsonSerializer . Serialize ( writer , value . IndicesBoost , options ) ;
367+ }
368+
369+ if ( value . DocvalueFields is not null )
370+ {
371+ writer . WritePropertyName ( "docvalue_fields" ) ;
372+ JsonSerializer . Serialize ( writer , value . DocvalueFields , options ) ;
373+ }
374+
375+ if ( value . MinScore . HasValue )
376+ {
377+ writer . WritePropertyName ( "min_score" ) ;
378+ writer . WriteNumberValue ( value . MinScore . Value ) ;
379+ }
380+
381+ if ( value . PostFilter is not null )
382+ {
383+ writer . WritePropertyName ( "post_filter" ) ;
384+ JsonSerializer . Serialize ( writer , value . PostFilter , options ) ;
385+ }
386+
387+ if ( value . Profile . HasValue )
388+ {
389+ writer . WritePropertyName ( "profile" ) ;
390+ writer . WriteBooleanValue ( value . Profile . Value ) ;
391+ }
392+
393+ if ( value . Query is not null )
394+ {
395+ writer . WritePropertyName ( "query" ) ;
396+ JsonSerializer . Serialize ( writer , value . Query , options ) ;
397+ }
398+
399+ if ( value . Rescore is not null )
400+ {
401+ writer . WritePropertyName ( "rescore" ) ;
402+ JsonSerializer . Serialize ( writer , value . Rescore , options ) ;
403+ }
404+
405+ if ( value . ScriptFields is not null )
406+ {
407+ writer . WritePropertyName ( "script_fields" ) ;
408+ JsonSerializer . Serialize ( writer , value . ScriptFields , options ) ;
409+ }
410+
411+ if ( value . SearchAfter is not null )
412+ {
413+ writer . WritePropertyName ( "search_after" ) ;
414+ JsonSerializer . Serialize ( writer , value . SearchAfter , options ) ;
415+ }
416+
417+ if ( value . Size . HasValue )
418+ {
419+ writer . WritePropertyName ( "size" ) ;
420+ writer . WriteNumberValue ( value . Size . Value ) ;
421+ }
422+
423+ if ( value . Slice is not null )
424+ {
425+ writer . WritePropertyName ( "slice" ) ;
426+ JsonSerializer . Serialize ( writer , value . Slice , options ) ;
427+ }
428+
429+ if ( value . Sort is not null )
430+ {
431+ writer . WritePropertyName ( "sort" ) ;
432+ JsonSerializer . Serialize ( writer , value . Sort , options ) ;
433+ }
434+
435+ if ( value . Source is not null )
436+ {
437+ writer . WritePropertyName ( "_source" ) ;
438+ JsonSerializer . Serialize ( writer , value . Source , options ) ;
439+ }
440+
441+ if ( value . Fields is not null )
442+ {
443+ writer . WritePropertyName ( "fields" ) ;
444+ JsonSerializer . Serialize ( writer , value . Fields , options ) ;
445+ }
446+
447+ if ( value . Suggest is not null )
448+ {
449+ writer . WritePropertyName ( "suggest" ) ;
450+ JsonSerializer . Serialize ( writer , value . Suggest , options ) ;
451+ }
452+
453+ if ( value . TerminateAfter . HasValue )
454+ {
455+ writer . WritePropertyName ( "terminate_after" ) ;
456+ writer . WriteNumberValue ( value . TerminateAfter . Value ) ;
457+ }
458+
459+ if ( ! string . IsNullOrEmpty ( value . Timeout ) )
460+ {
461+ writer . WritePropertyName ( "timeout" ) ;
462+ writer . WriteStringValue ( value . Timeout ) ;
463+ }
464+
465+ if ( value . TrackScores . HasValue )
466+ {
467+ writer . WritePropertyName ( "track_scores" ) ;
468+ writer . WriteBooleanValue ( value . TrackScores . Value ) ;
469+ }
470+
471+ if ( value . Version . HasValue )
472+ {
473+ writer . WritePropertyName ( "version" ) ;
474+ writer . WriteBooleanValue ( value . Version . Value ) ;
475+ }
476+
477+ if ( value . SeqNoPrimaryTerm . HasValue )
478+ {
479+ writer . WritePropertyName ( "seq_no_primary_term" ) ;
480+ writer . WriteBooleanValue ( value . SeqNoPrimaryTerm . Value ) ;
481+ }
482+
483+ if ( value . StoredFields is not null )
484+ {
485+ writer . WritePropertyName ( "stored_fields" ) ;
486+ JsonSerializer . Serialize ( writer , value . StoredFields , options ) ;
487+ }
488+
489+ if ( value . Pit is not null )
490+ {
491+ writer . WritePropertyName ( "pit" ) ;
492+ JsonSerializer . Serialize ( writer , value . Pit , options ) ;
493+ }
494+
495+ if ( value . RuntimeMappings is not null )
496+ {
497+ writer . WritePropertyName ( "runtime_mappings" ) ;
498+ JsonSerializer . Serialize ( writer , value . RuntimeMappings , options ) ;
499+ }
500+
501+ if ( value . Stats is not null )
502+ {
503+ writer . WritePropertyName ( "stats" ) ;
504+ JsonSerializer . Serialize ( writer , value . Stats , options ) ;
505+ }
506+
507+ writer . WriteEndObject ( ) ;
508+ }
509+ }
510+
511+ [ JsonConverter ( typeof ( AsyncSearchSubmitRequestConverter ) ) ]
127512 public partial class AsyncSearchSubmitRequest : PlainRequestBase < AsyncSearchSubmitRequestParameters >
128513 {
129514 public AsyncSearchSubmitRequest ( )
0 commit comments