Skip to content

Commit 384cf80

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
1 parent 089a709 commit 384cf80

File tree

18 files changed

+1024
-3442
lines changed

18 files changed

+1024
-3442
lines changed

src/CodeGeneration/ApiGenerator/ApiGenerator.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public class ApiGenerator
2929
// these API's are new and need to be mapped
3030
"xpack.ml.delete_forecast.json",
3131
"xpack.ml.find_file_structure.json",
32-
"delete_by_query_rethrottle.json",
3332

3433
"xpack.ml.update_filter.json",
3534
"xpack.security.delete_privileges.json",

src/CodeGeneration/ApiGenerator/Program.cs

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

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

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.5.3
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
@@ -740,6 +740,13 @@ public partial class DeleteByQueryRequestParameters : RequestParameters<DeleteBy
740740
///<summary>The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks.</summary>
741741
public long? Slices { get => Q<long?>("slices"); set => Q("slices", value); }
742742
}
743+
///<summary>Request options for DeleteByQueryRethrottle<pre>https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html</pre></summary>
744+
public partial class DeleteByQueryRethrottleRequestParameters : RequestParameters<DeleteByQueryRethrottleRequestParameters>
745+
{
746+
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
747+
///<summary>The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.</summary>
748+
public long? RequestsPerSecond { get => Q<long?>("requests_per_second"); set => Q("requests_per_second", value); }
749+
}
743750
///<summary>Request options for DeleteScript<pre>http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html</pre></summary>
744751
public partial class DeleteScriptRequestParameters : RequestParameters<DeleteScriptRequestParameters>
745752
{

src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,16 @@ public TResponse DeleteByQuery<TResponse>(string index, string type, PostData bo
636636
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
637637
public Task<TResponse> DeleteByQueryAsync<TResponse>(string index, string type, PostData body, DeleteByQueryRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken))
638638
where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync<TResponse>(POST, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_delete_by_query"), ctx, body, _params(requestParameters));
639+
///<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>
640+
///<param name="task_id">The task id to rethrottle</param>
641+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
642+
public TResponse DeleteByQueryRethrottle<TResponse>(string task_id, DeleteByQueryRethrottleRequestParameters requestParameters = null)
643+
where TResponse : class, IElasticsearchResponse, new() => this.DoRequest<TResponse>(POST, Url($"_delete_by_query/{task_id.NotNull("task_id")}/_rethrottle"), null, _params(requestParameters));
644+
///<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>
645+
///<param name="task_id">The task id to rethrottle</param>
646+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
647+
public Task<TResponse> DeleteByQueryRethrottleAsync<TResponse>(string task_id, DeleteByQueryRethrottleRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken))
648+
where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync<TResponse>(POST, Url($"_delete_by_query/{task_id.NotNull("task_id")}/_rethrottle"), ctx, null, _params(requestParameters));
639649
///<summary>DELETE on /_scripts/{id} <para>http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html</para></summary>
640650
///<param name="id">Script ID</param>
641651
///<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
@@ -508,6 +508,14 @@ public partial interface IElasticLowLevelClient
508508
///<param name="body">The search definition using the Query DSL</param>
509509
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
510510
Task<TResponse> DeleteByQueryAsync<TResponse>(string index, string type, PostData body, DeleteByQueryRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new();
511+
///<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>
512+
///<param name="task_id">The task id to rethrottle</param>
513+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
514+
TResponse DeleteByQueryRethrottle<TResponse>(string task_id, DeleteByQueryRethrottleRequestParameters requestParameters = null) where TResponse : class, IElasticsearchResponse, new();
515+
///<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>
516+
///<param name="task_id">The task id to rethrottle</param>
517+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
518+
Task<TResponse> DeleteByQueryRethrottleAsync<TResponse>(string task_id, DeleteByQueryRethrottleRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new();
511519
///<summary>DELETE on /_scripts/{id} <para>http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html</para></summary>
512520
///<param name="id">Script ID</param>
513521
///<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
[JsonProperty("attributes")]
@@ -48,6 +50,9 @@ public class TaskExecutingNode
4850
public string TransportAddress { get; internal set; }
4951
}
5052

53+
/// <summary>
54+
/// The state of the task
55+
/// </summary>
5156
public class TaskState
5257
{
5358
[JsonProperty("action")]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using Newtonsoft.Json;
3+
4+
namespace Nest
5+
{
6+
/// <summary>
7+
/// Rethrottles a running delete by query
8+
/// </summary>
9+
public partial interface IDeleteByQueryRethrottleRequest
10+
{
11+
}
12+
13+
/// <inheritdoc cref="IDeleteByQueryRethrottleRequest" />
14+
public partial class DeleteByQueryRethrottleRequest : IDeleteByQueryRethrottleRequest
15+
{
16+
17+
}
18+
19+
/// <inheritdoc cref="IDeleteByQueryRethrottleRequest" />
20+
public partial class DeleteByQueryRethrottleDescriptor : IDeleteByQueryRethrottleRequest
21+
{
22+
}
23+
}

0 commit comments

Comments
 (0)