Skip to content

Commit 481d18d

Browse files
committed
Deprecate sort on ReindexOnServer
Relates: #4341 Deprecate sorting in reindex elastic/elasticsearch#49458 (issue: elastic/elasticsearch#47567) Closes #4356
1 parent eaa51f7 commit 481d18d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-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

0 commit comments

Comments
 (0)