@@ -895,6 +895,14 @@ public AsyncSearchSubmitRequestDescriptor<TDocument> Indices(Elastic.Clients.Ela
895
895
896
896
private Action < SlicedScrollDescriptor < TDocument > > SliceDescriptorAction { get ; set ; }
897
897
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
+
898
906
private Elastic . Clients . Elasticsearch . Core . Search . SourceConfig ? SourceValue { get ; set ; }
899
907
900
908
private bool ? ExplainValue { get ; set ; }
@@ -925,8 +933,6 @@ public AsyncSearchSubmitRequestDescriptor<TDocument> Indices(Elastic.Clients.Ela
925
933
926
934
private int ? SizeValue { get ; set ; }
927
935
928
- private ICollection < Elastic . Clients . Elasticsearch . SortOptions > ? SortValue { get ; set ; }
929
-
930
936
private ICollection < string > ? StatsValue { get ; set ; }
931
937
932
938
private Elastic . Clients . Elasticsearch . Fields ? StoredFieldsValue { get ; set ; }
@@ -1223,6 +1229,42 @@ public AsyncSearchSubmitRequestDescriptor<TDocument> Slice(Action<SlicedScrollDe
1223
1229
return Self ;
1224
1230
}
1225
1231
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
+
1226
1268
public AsyncSearchSubmitRequestDescriptor < TDocument > Source ( Elastic . Clients . Elasticsearch . Core . Search . SourceConfig ? source )
1227
1269
{
1228
1270
SourceValue = source ;
@@ -1319,12 +1361,6 @@ public AsyncSearchSubmitRequestDescriptor<TDocument> Size(int? size)
1319
1361
return Self ;
1320
1362
}
1321
1363
1322
- public AsyncSearchSubmitRequestDescriptor < TDocument > Sort ( ICollection < Elastic . Clients . Elasticsearch . SortOptions > ? sort )
1323
- {
1324
- SortValue = sort ;
1325
- return Self ;
1326
- }
1327
-
1328
1364
public AsyncSearchSubmitRequestDescriptor < TDocument > Stats ( ICollection < string > ? stats )
1329
1365
{
1330
1366
StatsValue = stats ;
@@ -1599,6 +1635,35 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o
1599
1635
JsonSerializer . Serialize ( writer , SliceValue , options ) ;
1600
1636
}
1601
1637
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
+
1602
1667
if ( SourceValue is not null )
1603
1668
{
1604
1669
writer . WritePropertyName ( "_source" ) ;
@@ -1687,12 +1752,6 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o
1687
1752
writer . WriteNumberValue ( SizeValue . Value ) ;
1688
1753
}
1689
1754
1690
- if ( SortValue is not null )
1691
- {
1692
- writer . WritePropertyName ( "sort" ) ;
1693
- SingleOrManySerializationHelper . Serialize < Elastic . Clients . Elasticsearch . SortOptions > ( SortValue , writer , options ) ;
1694
- }
1695
-
1696
1755
if ( StatsValue is not null )
1697
1756
{
1698
1757
writer . WritePropertyName ( "stats" ) ;
@@ -1869,6 +1928,14 @@ public AsyncSearchSubmitRequestDescriptor Indices(Elastic.Clients.Elasticsearch.
1869
1928
1870
1929
private Action < SlicedScrollDescriptor > SliceDescriptorAction { get ; set ; }
1871
1930
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
+
1872
1939
private Elastic . Clients . Elasticsearch . Core . Search . SourceConfig ? SourceValue { get ; set ; }
1873
1940
1874
1941
private bool ? ExplainValue { get ; set ; }
@@ -1899,8 +1966,6 @@ public AsyncSearchSubmitRequestDescriptor Indices(Elastic.Clients.Elasticsearch.
1899
1966
1900
1967
private int ? SizeValue { get ; set ; }
1901
1968
1902
- private ICollection < Elastic . Clients . Elasticsearch . SortOptions > ? SortValue { get ; set ; }
1903
-
1904
1969
private ICollection < string > ? StatsValue { get ; set ; }
1905
1970
1906
1971
private Elastic . Clients . Elasticsearch . Fields ? StoredFieldsValue { get ; set ; }
@@ -2197,6 +2262,42 @@ public AsyncSearchSubmitRequestDescriptor Slice(Action<SlicedScrollDescriptor> c
2197
2262
return Self ;
2198
2263
}
2199
2264
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
+
2200
2301
public AsyncSearchSubmitRequestDescriptor Source ( Elastic . Clients . Elasticsearch . Core . Search . SourceConfig ? source )
2201
2302
{
2202
2303
SourceValue = source ;
@@ -2293,12 +2394,6 @@ public AsyncSearchSubmitRequestDescriptor Size(int? size)
2293
2394
return Self ;
2294
2395
}
2295
2396
2296
- public AsyncSearchSubmitRequestDescriptor Sort ( ICollection < Elastic . Clients . Elasticsearch . SortOptions > ? sort )
2297
- {
2298
- SortValue = sort ;
2299
- return Self ;
2300
- }
2301
-
2302
2397
public AsyncSearchSubmitRequestDescriptor Stats ( ICollection < string > ? stats )
2303
2398
{
2304
2399
StatsValue = stats ;
@@ -2573,6 +2668,35 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o
2573
2668
JsonSerializer . Serialize ( writer , SliceValue , options ) ;
2574
2669
}
2575
2670
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
+
2576
2700
if ( SourceValue is not null )
2577
2701
{
2578
2702
writer . WritePropertyName ( "_source" ) ;
@@ -2661,12 +2785,6 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o
2661
2785
writer . WriteNumberValue ( SizeValue . Value ) ;
2662
2786
}
2663
2787
2664
- if ( SortValue is not null )
2665
- {
2666
- writer . WritePropertyName ( "sort" ) ;
2667
- SingleOrManySerializationHelper . Serialize < Elastic . Clients . Elasticsearch . SortOptions > ( SortValue , writer , options ) ;
2668
- }
2669
-
2670
2788
if ( StatsValue is not null )
2671
2789
{
2672
2790
writer . WritePropertyName ( "stats" ) ;
0 commit comments