@@ -895,6 +895,14 @@ public AsyncSearchSubmitRequestDescriptor<TDocument> Indices(Elastic.Clients.Ela
895895
896896 private Action < SlicedScrollDescriptor < TDocument > > SliceDescriptorAction { get ; set ; }
897897
898+ private ICollection < Elastic . Clients . Elasticsearch . SortOptions > ? SortValue { get ; set ; }
899+
900+ private SortOptionsDescriptor < TDocument > SortDescriptor { get ; set ; }
901+
902+ private Action < SortOptionsDescriptor < TDocument > > SortDescriptorAction { get ; set ; }
903+
904+ private Action < SortOptionsDescriptor < TDocument > > [ ] SortDescriptorActions { get ; set ; }
905+
898906 private Elastic . Clients . Elasticsearch . Core . Search . SourceConfig ? SourceValue { get ; set ; }
899907
900908 private bool ? ExplainValue { get ; set ; }
@@ -925,8 +933,6 @@ public AsyncSearchSubmitRequestDescriptor<TDocument> Indices(Elastic.Clients.Ela
925933
926934 private int ? SizeValue { get ; set ; }
927935
928- private ICollection < Elastic . Clients . Elasticsearch . SortOptions > ? SortValue { get ; set ; }
929-
930936 private ICollection < string > ? StatsValue { get ; set ; }
931937
932938 private Elastic . Clients . Elasticsearch . Fields ? StoredFieldsValue { get ; set ; }
@@ -1223,6 +1229,42 @@ public AsyncSearchSubmitRequestDescriptor<TDocument> Slice(Action<SlicedScrollDe
12231229 return Self ;
12241230 }
12251231
1232+ public AsyncSearchSubmitRequestDescriptor < TDocument > Sort ( ICollection < Elastic . Clients . Elasticsearch . SortOptions > ? sort )
1233+ {
1234+ SortDescriptor = null ;
1235+ SortDescriptorAction = null ;
1236+ SortDescriptorActions = null ;
1237+ SortValue = sort ;
1238+ return Self ;
1239+ }
1240+
1241+ public AsyncSearchSubmitRequestDescriptor < TDocument > Sort ( SortOptionsDescriptor < TDocument > descriptor )
1242+ {
1243+ SortValue = null ;
1244+ SortDescriptorAction = null ;
1245+ SortDescriptorActions = null ;
1246+ SortDescriptor = descriptor ;
1247+ return Self ;
1248+ }
1249+
1250+ public AsyncSearchSubmitRequestDescriptor < TDocument > Sort ( Action < SortOptionsDescriptor < TDocument > > configure )
1251+ {
1252+ SortValue = null ;
1253+ SortDescriptor = null ;
1254+ SortDescriptorActions = null ;
1255+ SortDescriptorAction = configure ;
1256+ return Self ;
1257+ }
1258+
1259+ public AsyncSearchSubmitRequestDescriptor < TDocument > Sort ( params Action < SortOptionsDescriptor < TDocument > > [ ] configure )
1260+ {
1261+ SortValue = null ;
1262+ SortDescriptor = null ;
1263+ SortDescriptorAction = null ;
1264+ SortDescriptorActions = configure ;
1265+ return Self ;
1266+ }
1267+
12261268 public AsyncSearchSubmitRequestDescriptor < TDocument > Source ( Elastic . Clients . Elasticsearch . Core . Search . SourceConfig ? source )
12271269 {
12281270 SourceValue = source ;
@@ -1319,12 +1361,6 @@ public AsyncSearchSubmitRequestDescriptor<TDocument> Size(int? size)
13191361 return Self ;
13201362 }
13211363
1322- public AsyncSearchSubmitRequestDescriptor < TDocument > Sort ( ICollection < Elastic . Clients . Elasticsearch . SortOptions > ? sort )
1323- {
1324- SortValue = sort ;
1325- return Self ;
1326- }
1327-
13281364 public AsyncSearchSubmitRequestDescriptor < TDocument > Stats ( ICollection < string > ? stats )
13291365 {
13301366 StatsValue = stats ;
@@ -1599,6 +1635,35 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o
15991635 JsonSerializer . Serialize ( writer , SliceValue , options ) ;
16001636 }
16011637
1638+ if ( SortDescriptor is not null )
1639+ {
1640+ writer . WritePropertyName ( "sort" ) ;
1641+ JsonSerializer . Serialize ( writer , SortDescriptor , options ) ;
1642+ }
1643+ else if ( SortDescriptorAction is not null )
1644+ {
1645+ writer . WritePropertyName ( "sort" ) ;
1646+ JsonSerializer . Serialize ( writer , new SortOptionsDescriptor < TDocument > ( SortDescriptorAction ) , options ) ;
1647+ }
1648+ else if ( SortDescriptorActions is not null )
1649+ {
1650+ writer . WritePropertyName ( "sort" ) ;
1651+ if ( SortDescriptorActions . Length > 1 )
1652+ writer . WriteStartArray ( ) ;
1653+ foreach ( var action in SortDescriptorActions )
1654+ {
1655+ JsonSerializer . Serialize ( writer , new SortOptionsDescriptor < TDocument > ( action ) , options ) ;
1656+ }
1657+
1658+ if ( SortDescriptorActions . Length > 1 )
1659+ writer . WriteEndArray ( ) ;
1660+ }
1661+ else if ( SortValue is not null )
1662+ {
1663+ writer . WritePropertyName ( "sort" ) ;
1664+ SingleOrManySerializationHelper . Serialize < Elastic . Clients . Elasticsearch . SortOptions > ( SortValue , writer , options ) ;
1665+ }
1666+
16021667 if ( SourceValue is not null )
16031668 {
16041669 writer . WritePropertyName ( "_source" ) ;
@@ -1687,12 +1752,6 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o
16871752 writer . WriteNumberValue ( SizeValue . Value ) ;
16881753 }
16891754
1690- if ( SortValue is not null )
1691- {
1692- writer . WritePropertyName ( "sort" ) ;
1693- SingleOrManySerializationHelper . Serialize < Elastic . Clients . Elasticsearch . SortOptions > ( SortValue , writer , options ) ;
1694- }
1695-
16961755 if ( StatsValue is not null )
16971756 {
16981757 writer . WritePropertyName ( "stats" ) ;
@@ -1869,6 +1928,14 @@ public AsyncSearchSubmitRequestDescriptor Indices(Elastic.Clients.Elasticsearch.
18691928
18701929 private Action < SlicedScrollDescriptor > SliceDescriptorAction { get ; set ; }
18711930
1931+ private ICollection < Elastic . Clients . Elasticsearch . SortOptions > ? SortValue { get ; set ; }
1932+
1933+ private SortOptionsDescriptor SortDescriptor { get ; set ; }
1934+
1935+ private Action < SortOptionsDescriptor > SortDescriptorAction { get ; set ; }
1936+
1937+ private Action < SortOptionsDescriptor > [ ] SortDescriptorActions { get ; set ; }
1938+
18721939 private Elastic . Clients . Elasticsearch . Core . Search . SourceConfig ? SourceValue { get ; set ; }
18731940
18741941 private bool ? ExplainValue { get ; set ; }
@@ -1899,8 +1966,6 @@ public AsyncSearchSubmitRequestDescriptor Indices(Elastic.Clients.Elasticsearch.
18991966
19001967 private int ? SizeValue { get ; set ; }
19011968
1902- private ICollection < Elastic . Clients . Elasticsearch . SortOptions > ? SortValue { get ; set ; }
1903-
19041969 private ICollection < string > ? StatsValue { get ; set ; }
19051970
19061971 private Elastic . Clients . Elasticsearch . Fields ? StoredFieldsValue { get ; set ; }
@@ -2197,6 +2262,42 @@ public AsyncSearchSubmitRequestDescriptor Slice(Action<SlicedScrollDescriptor> c
21972262 return Self ;
21982263 }
21992264
2265+ public AsyncSearchSubmitRequestDescriptor Sort ( ICollection < Elastic . Clients . Elasticsearch . SortOptions > ? sort )
2266+ {
2267+ SortDescriptor = null ;
2268+ SortDescriptorAction = null ;
2269+ SortDescriptorActions = null ;
2270+ SortValue = sort ;
2271+ return Self ;
2272+ }
2273+
2274+ public AsyncSearchSubmitRequestDescriptor Sort ( SortOptionsDescriptor descriptor )
2275+ {
2276+ SortValue = null ;
2277+ SortDescriptorAction = null ;
2278+ SortDescriptorActions = null ;
2279+ SortDescriptor = descriptor ;
2280+ return Self ;
2281+ }
2282+
2283+ public AsyncSearchSubmitRequestDescriptor Sort ( Action < SortOptionsDescriptor > configure )
2284+ {
2285+ SortValue = null ;
2286+ SortDescriptor = null ;
2287+ SortDescriptorActions = null ;
2288+ SortDescriptorAction = configure ;
2289+ return Self ;
2290+ }
2291+
2292+ public AsyncSearchSubmitRequestDescriptor Sort ( params Action < SortOptionsDescriptor > [ ] configure )
2293+ {
2294+ SortValue = null ;
2295+ SortDescriptor = null ;
2296+ SortDescriptorAction = null ;
2297+ SortDescriptorActions = configure ;
2298+ return Self ;
2299+ }
2300+
22002301 public AsyncSearchSubmitRequestDescriptor Source ( Elastic . Clients . Elasticsearch . Core . Search . SourceConfig ? source )
22012302 {
22022303 SourceValue = source ;
@@ -2293,12 +2394,6 @@ public AsyncSearchSubmitRequestDescriptor Size(int? size)
22932394 return Self ;
22942395 }
22952396
2296- public AsyncSearchSubmitRequestDescriptor Sort ( ICollection < Elastic . Clients . Elasticsearch . SortOptions > ? sort )
2297- {
2298- SortValue = sort ;
2299- return Self ;
2300- }
2301-
23022397 public AsyncSearchSubmitRequestDescriptor Stats ( ICollection < string > ? stats )
23032398 {
23042399 StatsValue = stats ;
@@ -2573,6 +2668,35 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o
25732668 JsonSerializer . Serialize ( writer , SliceValue , options ) ;
25742669 }
25752670
2671+ if ( SortDescriptor is not null )
2672+ {
2673+ writer . WritePropertyName ( "sort" ) ;
2674+ JsonSerializer . Serialize ( writer , SortDescriptor , options ) ;
2675+ }
2676+ else if ( SortDescriptorAction is not null )
2677+ {
2678+ writer . WritePropertyName ( "sort" ) ;
2679+ JsonSerializer . Serialize ( writer , new SortOptionsDescriptor ( SortDescriptorAction ) , options ) ;
2680+ }
2681+ else if ( SortDescriptorActions is not null )
2682+ {
2683+ writer . WritePropertyName ( "sort" ) ;
2684+ if ( SortDescriptorActions . Length > 1 )
2685+ writer . WriteStartArray ( ) ;
2686+ foreach ( var action in SortDescriptorActions )
2687+ {
2688+ JsonSerializer . Serialize ( writer , new SortOptionsDescriptor ( action ) , options ) ;
2689+ }
2690+
2691+ if ( SortDescriptorActions . Length > 1 )
2692+ writer . WriteEndArray ( ) ;
2693+ }
2694+ else if ( SortValue is not null )
2695+ {
2696+ writer . WritePropertyName ( "sort" ) ;
2697+ SingleOrManySerializationHelper . Serialize < Elastic . Clients . Elasticsearch . SortOptions > ( SortValue , writer , options ) ;
2698+ }
2699+
25762700 if ( SourceValue is not null )
25772701 {
25782702 writer . WritePropertyName ( "_source" ) ;
@@ -2661,12 +2785,6 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o
26612785 writer . WriteNumberValue ( SizeValue . Value ) ;
26622786 }
26632787
2664- if ( SortValue is not null )
2665- {
2666- writer . WritePropertyName ( "sort" ) ;
2667- SingleOrManySerializationHelper . Serialize < Elastic . Clients . Elasticsearch . SortOptions > ( SortValue , writer , options ) ;
2668- }
2669-
26702788 if ( StatsValue is not null )
26712789 {
26722790 writer . WritePropertyName ( "stats" ) ;
0 commit comments