Skip to content

Commit 3d17791

Browse files
committed
Delete by query rethrottle API (#3595)
* download specs from v6.6.2 tag * Delete by Query rethrottle API * exclude DeleteByQueryRethrottle API from naming conventions (cherry picked from commit 220b2dc)
1 parent 928b681 commit 3d17791

File tree

18 files changed

+1026
-3448
lines changed

18 files changed

+1026
-3448
lines changed

src/CodeGeneration/ApiGenerator/CodeConfiguration.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public static class CodeConfiguration
3737
"ml.set_upgrade_mode.json",
3838
"ml.find_file_structure.json",
3939
"monitoring.bulk.json",
40-
"delete_by_query_rethrottle.json",
4140

4241
"security.delete_privileges.json",
4342
"security.get_privileges.json",

src/CodeGeneration/ApiGenerator/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private static void Main(string[] args)
2323

2424
if (redownloadCoreSpecification)
2525
{
26-
Console.Write("Branch to download specification from (default master): ");
26+
Console.Write($"Branch to download specification from (default {downloadBranch}): ");
2727
var readBranch = Console.ReadLine()?.Trim();
2828
if (!string.IsNullOrEmpty(readBranch)) downloadBranch = readBranch;
2929
}

src/CodeGeneration/ApiGenerator/RestSpecification/Core/root.html

Lines changed: 717 additions & 3436 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.4
1+
v6.6.2

src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,13 @@ public class DeleteByQueryRequestParameters : RequestParameters<DeleteByQueryReq
735735
///<summary>The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks.</summary>
736736
public long? Slices { get => Q<long?>("slices"); set => Q("slices", value); }
737737
}
738+
///<summary>Request options for DeleteByQueryRethrottle<pre>https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html</pre></summary>
739+
public class DeleteByQueryRethrottleRequestParameters : RequestParameters<DeleteByQueryRethrottleRequestParameters>
740+
{
741+
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
742+
///<summary>The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.</summary>
743+
public long? RequestsPerSecond { get => Q<long?>("requests_per_second"); set => Q("requests_per_second", value); }
744+
}
738745
///<summary>Request options for DeleteScript<pre>http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html</pre></summary>
739746
public class DeleteScriptRequestParameters : RequestParameters<DeleteScriptRequestParameters>
740747
{

src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,16 @@ public TResponse DeleteByQuery<TResponse>(string index, PostData body, DeleteByQ
562562
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
563563
public Task<TResponse> DeleteByQueryAsync<TResponse>(string index, PostData body, DeleteByQueryRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken))
564564
where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync<TResponse>(POST, Url($"{index.NotNull("index")}/_delete_by_query"), ctx, body, _params(requestParameters));
565+
///<summary>POST on /_delete_by_query/{task_id}/_rethrottle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html</para></summary>
566+
///<param name="task_id">The task id to rethrottle</param>
567+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
568+
public TResponse DeleteByQueryRethrottle<TResponse>(string task_id, DeleteByQueryRethrottleRequestParameters requestParameters = null)
569+
where TResponse : class, IElasticsearchResponse, new() => this.DoRequest<TResponse>(POST, Url($"_delete_by_query/{task_id.NotNull("task_id")}/_rethrottle"), null, _params(requestParameters));
570+
///<summary>POST on /_delete_by_query/{task_id}/_rethrottle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html</para></summary>
571+
///<param name="task_id">The task id to rethrottle</param>
572+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
573+
public Task<TResponse> DeleteByQueryRethrottleAsync<TResponse>(string task_id, DeleteByQueryRethrottleRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken))
574+
where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync<TResponse>(POST, Url($"_delete_by_query/{task_id.NotNull("task_id")}/_rethrottle"), ctx, null, _params(requestParameters));
565575
///<summary>DELETE on /_scripts/{id} <para>http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html</para></summary>
566576
///<param name="id">Script ID</param>
567577
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>

src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,14 @@ public partial interface IElasticLowLevelClient
444444
///<param name="body">The search definition using the Query DSL</param>
445445
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
446446
Task<TResponse> DeleteByQueryAsync<TResponse>(string index, PostData body, DeleteByQueryRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new();
447+
///<summary>POST on /_delete_by_query/{task_id}/_rethrottle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html</para></summary>
448+
///<param name="task_id">The task id to rethrottle</param>
449+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
450+
TResponse DeleteByQueryRethrottle<TResponse>(string task_id, DeleteByQueryRethrottleRequestParameters requestParameters = null) where TResponse : class, IElasticsearchResponse, new();
451+
///<summary>POST on /_delete_by_query/{task_id}/_rethrottle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html</para></summary>
452+
///<param name="task_id">The task id to rethrottle</param>
453+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
454+
Task<TResponse> DeleteByQueryRethrottleAsync<TResponse>(string task_id, DeleteByQueryRethrottleRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new();
447455
///<summary>DELETE on /_scripts/{id} <para>http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html</para></summary>
448456
///<param name="id">Script ID</param>
449457
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>

src/Elasticsearch.sln.DotSettings

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,4 +479,5 @@
479479
<s:String x:Key="/Default/PatternsAndTemplates/Todo/TodoPatterns/=B68C83B0AE11204AAA509A6033251E74/Name/@EntryValue">Hack</s:String>
480480
<s:String x:Key="/Default/PatternsAndTemplates/Todo/TodoPatterns/=B68C83B0AE11204AAA509A6033251E74/Pattern/@EntryValue">(?&lt;=\W|^)(?&lt;TAG&gt;HACK)(\W|$)(.*)</s:String>
481481
<s:String x:Key="/Default/PatternsAndTemplates/Todo/TodoPatterns/=B68C83B0AE11204AAA509A6033251E74/TodoIconStyle/@EntryValue">Warning</s:String>
482-
<s:Boolean x:Key="/Default/UserDictionary/Words/=/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
482+
<s:Boolean x:Key="/Default/UserDictionary/Words/=/@EntryIndexedValue">True</s:Boolean>
483+
<s:Boolean x:Key="/Default/UserDictionary/Words/=Rethrottle/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

src/Nest/Cluster/TaskManagement/ListTasks/ListTasksResponse.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ public class ListTasksResponse : ResponseBase, IListTasksResponse
1818
{
1919
public override bool IsValid => base.IsValid && !NodeFailures.HasAny();
2020
public IReadOnlyCollection<ErrorCause> NodeFailures { get; internal set; } = EmptyReadOnly<ErrorCause>.Collection;
21-
2221
public IReadOnlyDictionary<string, TaskExecutingNode> Nodes { get; internal set; } = EmptyReadOnly<string, TaskExecutingNode>.Dictionary;
2322
}
2423

24+
/// <summary>
25+
/// A node executing a task
26+
/// </summary>
2527
public class TaskExecutingNode
2628
{
2729
[DataMember(Name = "attributes")]
@@ -47,6 +49,9 @@ public class TaskExecutingNode
4749
public string TransportAddress { get; internal set; }
4850
}
4951

52+
/// <summary>
53+
/// The state of the task
54+
/// </summary>
5055
public class TaskState
5156
{
5257
[DataMember(Name = "action")]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace Nest
2+
{
3+
/// <summary>
4+
/// Rethrottles a running delete by query
5+
/// </summary>
6+
[MapsApi("delete_by_query_rethrottle")]
7+
public partial interface IDeleteByQueryRethrottleRequest { }
8+
9+
/// <inheritdoc cref="IDeleteByQueryRethrottleRequest" />
10+
public partial class DeleteByQueryRethrottleRequest : IDeleteByQueryRethrottleRequest { }
11+
12+
/// <inheritdoc cref="IDeleteByQueryRethrottleRequest" />
13+
public partial class DeleteByQueryRethrottleDescriptor : IDeleteByQueryRethrottleRequest { }
14+
}

0 commit comments

Comments
 (0)