Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate sort on ReindexOnServer #4357

Merged
merged 2 commits into from
Feb 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Nest/Document/Multiple/ReindexOnServer/ReindexSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public interface IReindexSource
/// in conjunction with <see cref="Size" />
/// </summary>
[DataMember(Name ="sort")]
[Obsolete("Deprecated in 7.6.0. Instead consider using query filtering to find the desired subset of data.")]
IList<ISort> Sort { get; set; }

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

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

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public ReindexOnServerApiTests(IntrusiveOperationCluster cluster, EndpointUsage

protected override int ExpectStatusCode => 200;

// Sort is deprecated
#pragma warning disable 618
protected override Func<ReindexOnServerDescriptor, IReindexOnServerRequest> Fluent => d => d
.Source(s => s
.Index(CallIsolatedValue)
Expand All @@ -56,6 +58,7 @@ public ReindexOnServerApiTests(IntrusiveOperationCluster cluster, EndpointUsage
.Query("bar")
)
)

.Sort<Test>(sort => sort
.Ascending("id")
)
Expand All @@ -69,6 +72,7 @@ public ReindexOnServerApiTests(IntrusiveOperationCluster cluster, EndpointUsage
.Script(ss => ss.Source(PainlessScript))
.Conflicts(Conflicts.Proceed)
.Refresh();
#pragma warning restore 618

protected override HttpMethod HttpMethod => HttpMethod.POST;

Expand All @@ -78,7 +82,9 @@ public ReindexOnServerApiTests(IntrusiveOperationCluster cluster, EndpointUsage
{
Index = CallIsolatedValue,
Query = new MatchQuery { Field = Field<Test>(p => p.Flag), Query = "bar" },
#pragma warning disable 618
Sort = new List<ISort> { new FieldSort { Field = "id", Order = SortOrder.Ascending } },
#pragma warning restore 618
Size = 100
},
Destination = new ReindexDestination
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public ReindexOnServerSliceApiTests(IntrusiveOperationCluster cluster, EndpointU

protected override int ExpectStatusCode => 200;

#pragma warning disable 618
protected override Func<ReindexOnServerDescriptor, IReindexOnServerRequest> Fluent => d => d
.Source(s => s
.Index(CallIsolatedValue)
Expand All @@ -69,6 +70,7 @@ public ReindexOnServerSliceApiTests(IntrusiveOperationCluster cluster, EndpointU
)
.Conflicts(Conflicts.Proceed)
.Refresh();
#pragma warning restore 618

protected override HttpMethod HttpMethod => HttpMethod.POST;

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