Skip to content

Commit 20a2133

Browse files
authored
Deprecate sort on ReindexOnServer (#4357)
Relates: #4341 Deprecate sorting in reindex elastic/elasticsearch#49458 (issue: elastic/elasticsearch#47567) Closes #4356
1 parent 0576da2 commit 20a2133

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/Nest/Document/Multiple/ReindexOnServer/ReindexSource.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public interface IReindexSource
5050
/// in conjunction with <see cref="Size" />
5151
/// </summary>
5252
[DataMember(Name ="sort")]
53+
[Obsolete("Deprecated in 7.6.0. Instead consider using query filtering to find the desired subset of data.")]
5354
IList<ISort> Sort { get; set; }
5455

5556
/// <summary>
@@ -78,6 +79,7 @@ public class ReindexSource : IReindexSource
7879
public ISlicedScroll Slice { get; set; }
7980

8081
/// <inheritdoc />
82+
[Obsolete("Deprecated in 7.6.0. Instead consider using query filtering to find the desired subset of data.")]
8183
public IList<ISort> Sort { get; set; }
8284

8385
/// <inheritdoc />
@@ -100,6 +102,7 @@ public ReindexSourceDescriptor Query<T>(Func<QueryContainerDescriptor<T>, QueryC
100102
Assign(querySelector, (a, v) => a.Query = v?.Invoke(new QueryContainerDescriptor<T>()));
101103

102104
/// <inheritdoc cref="IReindexSource.Sort" />
105+
[Obsolete("Deprecated in 7.6.0. Instead consider using query filtering to find the desired subset of data.")]
103106
public ReindexSourceDescriptor Sort<T>(Func<SortDescriptor<T>, IPromise<IList<ISort>>> selector) where T : class =>
104107
Assign(selector, (a, v) => a.Sort = v?.Invoke(new SortDescriptor<T>())?.Value);
105108

tests/Tests/Document/Multiple/ReindexOnServer/ReindexOnServerApiTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public ReindexOnServerApiTests(IntrusiveOperationCluster cluster, EndpointUsage
4646

4747
protected override int ExpectStatusCode => 200;
4848

49+
// Sort is deprecated
50+
#pragma warning disable 618
4951
protected override Func<ReindexOnServerDescriptor, IReindexOnServerRequest> Fluent => d => d
5052
.Source(s => s
5153
.Index(CallIsolatedValue)
@@ -56,6 +58,7 @@ public ReindexOnServerApiTests(IntrusiveOperationCluster cluster, EndpointUsage
5658
.Query("bar")
5759
)
5860
)
61+
5962
.Sort<Test>(sort => sort
6063
.Ascending("id")
6164
)
@@ -69,6 +72,7 @@ public ReindexOnServerApiTests(IntrusiveOperationCluster cluster, EndpointUsage
6972
.Script(ss => ss.Source(PainlessScript))
7073
.Conflicts(Conflicts.Proceed)
7174
.Refresh();
75+
#pragma warning restore 618
7276

7377
protected override HttpMethod HttpMethod => HttpMethod.POST;
7478

@@ -78,7 +82,9 @@ public ReindexOnServerApiTests(IntrusiveOperationCluster cluster, EndpointUsage
7882
{
7983
Index = CallIsolatedValue,
8084
Query = new MatchQuery { Field = Field<Test>(p => p.Flag), Query = "bar" },
85+
#pragma warning disable 618
8186
Sort = new List<ISort> { new FieldSort { Field = "id", Order = SortOrder.Ascending } },
87+
#pragma warning restore 618
8288
Size = 100
8389
},
8490
Destination = new ReindexDestination

tests/Tests/Document/Multiple/ReindexOnServer/ReindexOnServerSliceApiTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public ReindexOnServerSliceApiTests(IntrusiveOperationCluster cluster, EndpointU
4545

4646
protected override int ExpectStatusCode => 200;
4747

48+
#pragma warning disable 618
4849
protected override Func<ReindexOnServerDescriptor, IReindexOnServerRequest> Fluent => d => d
4950
.Source(s => s
5051
.Index(CallIsolatedValue)
@@ -69,6 +70,7 @@ public ReindexOnServerSliceApiTests(IntrusiveOperationCluster cluster, EndpointU
6970
)
7071
.Conflicts(Conflicts.Proceed)
7172
.Refresh();
73+
#pragma warning restore 618
7274

7375
protected override HttpMethod HttpMethod => HttpMethod.POST;
7476

@@ -78,7 +80,9 @@ public ReindexOnServerSliceApiTests(IntrusiveOperationCluster cluster, EndpointU
7880
{
7981
Index = CallIsolatedValue,
8082
Query = new MatchAllQuery(),
83+
#pragma warning disable 618
8184
Sort = new List<ISort> { new FieldSort { Field = "id", Order = SortOrder.Ascending } },
85+
#pragma warning restore 618
8286
Size = 100,
8387
Slice = new SlicedScroll { Field = "id", Id = 0, Max = 2 }
8488
},

0 commit comments

Comments
 (0)