diff --git a/src/Nest/Document/Multiple/DeleteByQuery/DeleteByQueryRequest.cs b/src/Nest/Document/Multiple/DeleteByQuery/DeleteByQueryRequest.cs index b94fb707351..cfc6aab14ed 100644 --- a/src/Nest/Document/Multiple/DeleteByQuery/DeleteByQueryRequest.cs +++ b/src/Nest/Document/Multiple/DeleteByQuery/DeleteByQueryRequest.cs @@ -20,6 +20,12 @@ public partial interface IDeleteByQueryRequest /// [DataMember(Name ="slice")] ISlicedScroll Slice { get; set; } + + /// + /// Limit the number of processed documents + /// + [DataMember(Name ="max_docs")] + long? MaximumDocuments { get; set; } } /// @@ -34,6 +40,9 @@ public partial class DeleteByQueryRequest /// public ISlicedScroll Slice { get; set; } + + /// + public long? MaximumDocuments { get; set; } } /// @@ -49,6 +58,7 @@ public partial class DeleteByQueryDescriptor : IDeleteByQueryRequest< { QueryContainer IDeleteByQueryRequest.Query { get; set; } ISlicedScroll IDeleteByQueryRequest.Slice { get; set; } + long? IDeleteByQueryRequest.MaximumDocuments { get; set; } /// /// A match_all query to select all documents. Convenient shorthand for specifying @@ -56,17 +66,16 @@ public partial class DeleteByQueryDescriptor : IDeleteByQueryRequest< /// public DeleteByQueryDescriptor MatchAll() => Assign(new QueryContainerDescriptor().MatchAll(), (a, v) => a.Query = v); - /// - /// The query to use to select documents for deletion - /// + /// public DeleteByQueryDescriptor Query(Func, QueryContainer> querySelector) => Assign(querySelector, (a, v) => a.Query = v?.Invoke(new QueryContainerDescriptor())); - /// - /// Parallelize the deleting process. This parallelization can improve efficiency and - /// provide a convenient way to break the request down into smaller parts. - /// + /// public DeleteByQueryDescriptor Slice(Func, ISlicedScroll> selector) => Assign(selector, (a, v) => a.Slice = v?.Invoke(new SlicedScrollDescriptor())); + + /// + public DeleteByQueryDescriptor MaximumDocuments(long? maximumDocuments) => + Assign(maximumDocuments, (a, v) => a.MaximumDocuments = v); } } diff --git a/src/Nest/Document/Multiple/ReindexOnServer/ReindexOnServerRequest.cs b/src/Nest/Document/Multiple/ReindexOnServer/ReindexOnServerRequest.cs index ba5a121817a..a3cfbf69a15 100644 --- a/src/Nest/Document/Multiple/ReindexOnServer/ReindexOnServerRequest.cs +++ b/src/Nest/Document/Multiple/ReindexOnServer/ReindexOnServerRequest.cs @@ -38,9 +38,17 @@ public partial interface IReindexOnServerRequest /// /// Limit the number of processed documents /// + // TODO: Remove in 8.0 [DataMember(Name ="size")] + [Obsolete("Deprecated. Use MaximumDocuments")] long? Size { get; set; } + /// + /// Limit the number of processed documents + /// + [DataMember(Name ="max_docs")] + long? MaximumDocuments { get; set; } + /// /// The source for the reindex operation /// @@ -51,19 +59,23 @@ public partial interface IReindexOnServerRequest /// public partial class ReindexOnServerRequest { - /// + /// public Conflicts? Conflicts { get; set; } - /// + /// public IReindexDestination Destination { get; set; } - /// + /// public IScript Script { get; set; } - /// + /// + [Obsolete("Deprecated. Use MaximumDocuments")] public long? Size { get; set; } - /// + /// + public long? MaximumDocuments { get; set; } + + /// public IReindexSource Source { get; set; } } @@ -72,8 +84,10 @@ public partial class ReindexOnServerDescriptor Conflicts? IReindexOnServerRequest.Conflicts { get; set; } IReindexDestination IReindexOnServerRequest.Destination { get; set; } IScript IReindexOnServerRequest.Script { get; set; } + [Obsolete("Deprecated. Use MaximumDocuments")] long? IReindexOnServerRequest.Size { get; set; } IReindexSource IReindexOnServerRequest.Source { get; set; } + long? IReindexOnServerRequest.MaximumDocuments { get; set; } /// public ReindexOnServerDescriptor Source(Func selector = null) => @@ -90,10 +104,15 @@ public ReindexOnServerDescriptor Destination(Func scriptSelector) => Assign(scriptSelector, (a, v) => a.Script = v?.Invoke(new ScriptDescriptor())); + [Obsolete("Deprecated. Use MaximumDocuments")] /// public ReindexOnServerDescriptor Size(long? size) => Assign(size, (a, v) => a.Size = v); /// public ReindexOnServerDescriptor Conflicts(Conflicts? conflicts) => Assign(conflicts, (a, v) => a.Conflicts = v); + + /// + public ReindexOnServerDescriptor MaximumDocuments(long? maximumDocuments) => + Assign(maximumDocuments, (a, v) => a.MaximumDocuments = v); } } diff --git a/src/Nest/Document/Multiple/ReindexOnServer/ReindexSource.cs b/src/Nest/Document/Multiple/ReindexOnServer/ReindexSource.cs index a0639ed6e0b..e456fd663d3 100644 --- a/src/Nest/Document/Multiple/ReindexOnServer/ReindexSource.cs +++ b/src/Nest/Document/Multiple/ReindexOnServer/ReindexSource.cs @@ -28,7 +28,7 @@ public interface IReindexSource IRemoteSource Remote { get; set; } /// - /// Limit the number of processed documents + /// The batch size of documents /// [DataMember(Name ="size")] int? Size { get; set; } diff --git a/src/Nest/Document/Multiple/UpdateByQuery/UpdateByQueryRequest.cs b/src/Nest/Document/Multiple/UpdateByQuery/UpdateByQueryRequest.cs index 502e6f7d2bd..f08a319c350 100644 --- a/src/Nest/Document/Multiple/UpdateByQuery/UpdateByQueryRequest.cs +++ b/src/Nest/Document/Multiple/UpdateByQuery/UpdateByQueryRequest.cs @@ -5,11 +5,30 @@ namespace Nest { public partial interface IUpdateByQueryRequest { + /// + /// Parallelize the update process by splitting a query into + /// multiple slices. + /// + [DataMember(Name ="slice")] + ISlicedScroll Slice { get; set; } + + /// + /// Query to select documents to update + /// [DataMember(Name ="query")] QueryContainer Query { get; set; } + /// + /// A script specifying the update to make + /// [DataMember(Name ="script")] IScript Script { get; set; } + + /// + /// Limit the number of processed documents + /// + [DataMember(Name ="max_docs")] + long? MaximumDocuments { get; set; } } // ReSharper disable once UnusedMember.Global @@ -18,8 +37,14 @@ public partial interface IUpdateByQueryRequest where TDocument : clas public partial class UpdateByQueryRequest { + /// + public ISlicedScroll Slice { get; set; } + /// public QueryContainer Query { get; set; } + /// public IScript Script { get; set; } + /// + public long? MaximumDocuments { get; set; } } // ReSharper disable once UnusedTypeParameter @@ -32,15 +57,31 @@ public partial class UpdateByQueryDescriptor { QueryContainer IUpdateByQueryRequest.Query { get; set; } IScript IUpdateByQueryRequest.Script { get; set; } + long? IUpdateByQueryRequest.MaximumDocuments { get; set; } + ISlicedScroll IUpdateByQueryRequest.Slice { get; set; } + /// + /// Query that selects all documents + /// public UpdateByQueryDescriptor MatchAll() => Assign(new QueryContainerDescriptor().MatchAll(), (a, v) => a.Query = v); + /// public UpdateByQueryDescriptor Query(Func, QueryContainer> querySelector) => Assign(querySelector, (a, v) => a.Query = v?.Invoke(new QueryContainerDescriptor())); + /// public UpdateByQueryDescriptor Script(string script) => Assign((InlineScript)script, (a, v) => a.Script = v); + /// public UpdateByQueryDescriptor Script(Func scriptSelector) => Assign(scriptSelector, (a, v) => a.Script = v?.Invoke(new ScriptDescriptor())); + + /// + public UpdateByQueryDescriptor MaximumDocuments(long? maximumDocuments) => + Assign(maximumDocuments, (a, v) => a.MaximumDocuments = v); + + /// + public UpdateByQueryDescriptor Slice(Func, ISlicedScroll> selector) => + Assign(selector, (a, v) => a.Slice = v?.Invoke(new SlicedScrollDescriptor())); } }