Skip to content

Commit 2f89376

Browse files
Add support for additional endpoints (#7607) (#7610)
* Add support for RenderSearchTemplate and SearchTemplate * Add support for TermVectors endpoint * Support generated enrich endpoints * Support generated graph explore endpoint * Support generated MultiTermVectors endpoint * Support additional generated cluster endpoints * Support list dangling indices endpoint Co-authored-by: Steve Gordon <[email protected]>
1 parent 910e995 commit 2f89376

File tree

102 files changed

+10214
-115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+10214
-115
lines changed

src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs

+15
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,23 @@ internal static class ApiUrlLookup
2828
internal static ApiUrls NoNamespaceBulk = new ApiUrls(new[] { "/_bulk", "/{index}/_bulk" });
2929
internal static ApiUrls NoNamespaceClearScroll = new ApiUrls(new[] { "/_search/scroll" });
3030
internal static ApiUrls NoNamespaceClosePointInTime = new ApiUrls(new[] { "/_pit" });
31+
internal static ApiUrls ClusterAllocationExplain = new ApiUrls(new[] { "/_cluster/allocation/explain" });
32+
internal static ApiUrls ClusterStats = new ApiUrls(new[] { "/_cluster/stats", "/_cluster/stats/nodes/{node_id}" });
33+
internal static ApiUrls ClusterGetSettings = new ApiUrls(new[] { "/_cluster/settings" });
3134
internal static ApiUrls ClusterHealth = new ApiUrls(new[] { "/_cluster/health", "/_cluster/health/{index}" });
35+
internal static ApiUrls ClusterPendingTasks = new ApiUrls(new[] { "/_cluster/pending_tasks" });
3236
internal static ApiUrls NoNamespaceCount = new ApiUrls(new[] { "/_count", "/{index}/_count" });
3337
internal static ApiUrls NoNamespaceCreate = new ApiUrls(new[] { "/{index}/_create/{id}" });
38+
internal static ApiUrls DanglingIndicesListDanglingIndices = new ApiUrls(new[] { "/_dangling" });
3439
internal static ApiUrls NoNamespaceDeleteByQuery = new ApiUrls(new[] { "/{index}/_delete_by_query" });
3540
internal static ApiUrls NoNamespaceDeleteByQueryRethrottle = new ApiUrls(new[] { "/_delete_by_query/{task_id}/_rethrottle" });
3641
internal static ApiUrls NoNamespaceDelete = new ApiUrls(new[] { "/{index}/_doc/{id}" });
3742
internal static ApiUrls NoNamespaceDeleteScript = new ApiUrls(new[] { "/_scripts/{id}" });
43+
internal static ApiUrls EnrichDeletePolicy = new ApiUrls(new[] { "/_enrich/policy/{name}" });
44+
internal static ApiUrls EnrichStats = new ApiUrls(new[] { "/_enrich/_stats" });
45+
internal static ApiUrls EnrichExecutePolicy = new ApiUrls(new[] { "/_enrich/policy/{name}/_execute" });
46+
internal static ApiUrls EnrichGetPolicy = new ApiUrls(new[] { "/_enrich/policy/{name}", "/_enrich/policy" });
47+
internal static ApiUrls EnrichPutPolicy = new ApiUrls(new[] { "/_enrich/policy/{name}" });
3848
internal static ApiUrls EqlDelete = new ApiUrls(new[] { "/_eql/search/{id}" });
3949
internal static ApiUrls EqlGet = new ApiUrls(new[] { "/_eql/search/{id}" });
4050
internal static ApiUrls EqlSearch = new ApiUrls(new[] { "/{index}/_eql/search" });
@@ -48,6 +58,7 @@ internal static class ApiUrlLookup
4858
internal static ApiUrls NoNamespaceGetScriptLanguages = new ApiUrls(new[] { "/_script_language" });
4959
internal static ApiUrls NoNamespaceGetScript = new ApiUrls(new[] { "/_scripts/{id}" });
5060
internal static ApiUrls NoNamespaceGetSource = new ApiUrls(new[] { "/{index}/_source/{id}" });
61+
internal static ApiUrls GraphExplore = new ApiUrls(new[] { "/{index}/_graph/explore" });
5162
internal static ApiUrls IndexManagementClone = new ApiUrls(new[] { "/{index}/_clone/{target}" });
5263
internal static ApiUrls IndexManagementClose = new ApiUrls(new[] { "/{index}/_close" });
5364
internal static ApiUrls IndexManagementCreateDataStream = new ApiUrls(new[] { "/_data_stream/{name}" });
@@ -95,15 +106,18 @@ internal static class ApiUrlLookup
95106
internal static ApiUrls NoNamespaceMget = new ApiUrls(new[] { "/_mget", "/{index}/_mget" });
96107
internal static ApiUrls NoNamespaceMsearch = new ApiUrls(new[] { "/_msearch", "/{index}/_msearch" });
97108
internal static ApiUrls NoNamespaceMsearchTemplate = new ApiUrls(new[] { "/_msearch/template", "/{index}/_msearch/template" });
109+
internal static ApiUrls NoNamespaceMtermvectors = new ApiUrls(new[] { "/_mtermvectors", "/{index}/_mtermvectors" });
98110
internal static ApiUrls NoNamespaceOpenPointInTime = new ApiUrls(new[] { "/{index}/_pit" });
99111
internal static ApiUrls NoNamespacePing = new ApiUrls(new[] { "/" });
100112
internal static ApiUrls NoNamespacePutScript = new ApiUrls(new[] { "/_scripts/{id}", "/_scripts/{id}/{context}" });
101113
internal static ApiUrls NoNamespaceRankEval = new ApiUrls(new[] { "/_rank_eval", "/{index}/_rank_eval" });
102114
internal static ApiUrls NoNamespaceReindex = new ApiUrls(new[] { "/_reindex" });
103115
internal static ApiUrls NoNamespaceReindexRethrottle = new ApiUrls(new[] { "/_reindex/{task_id}/_rethrottle" });
116+
internal static ApiUrls NoNamespaceRenderSearchTemplate = new ApiUrls(new[] { "/_render/template", "/_render/template/{id}" });
104117
internal static ApiUrls NoNamespaceScroll = new ApiUrls(new[] { "/_search/scroll" });
105118
internal static ApiUrls NoNamespaceSearch = new ApiUrls(new[] { "/_search", "/{index}/_search" });
106119
internal static ApiUrls NoNamespaceSearchShards = new ApiUrls(new[] { "/_search_shards", "/{index}/_search_shards" });
120+
internal static ApiUrls NoNamespaceSearchTemplate = new ApiUrls(new[] { "/_search/template", "/{index}/_search/template" });
107121
internal static ApiUrls SqlClearCursor = new ApiUrls(new[] { "/_sql/close" });
108122
internal static ApiUrls SqlDeleteAsync = new ApiUrls(new[] { "/_sql/async/delete/{id}" });
109123
internal static ApiUrls SqlGetAsync = new ApiUrls(new[] { "/_sql/async/{id}" });
@@ -113,6 +127,7 @@ internal static class ApiUrlLookup
113127
internal static ApiUrls TasksGet = new ApiUrls(new[] { "/_tasks/{task_id}" });
114128
internal static ApiUrls TasksList = new ApiUrls(new[] { "/_tasks" });
115129
internal static ApiUrls NoNamespaceTermsEnum = new ApiUrls(new[] { "/{index}/_terms_enum" });
130+
internal static ApiUrls NoNamespaceTermvectors = new ApiUrls(new[] { "/{index}/_termvectors/{id}", "/{index}/_termvectors" });
116131
internal static ApiUrls NoNamespaceUpdateByQuery = new ApiUrls(new[] { "/{index}/_update_by_query" });
117132
internal static ApiUrls NoNamespaceUpdateByQueryRethrottle = new ApiUrls(new[] { "/_update_by_query/{task_id}/_rethrottle" });
118133
internal static ApiUrls NoNamespaceUpdate = new ApiUrls(new[] { "/{index}/_update/{id}" });
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
#nullable restore
19+
20+
using Elastic.Clients.Elasticsearch.Fluent;
21+
using Elastic.Clients.Elasticsearch.Requests;
22+
using Elastic.Clients.Elasticsearch.Serialization;
23+
using Elastic.Transport;
24+
using System;
25+
using System.Collections.Generic;
26+
using System.Linq.Expressions;
27+
using System.Text.Json;
28+
using System.Text.Json.Serialization;
29+
30+
namespace Elastic.Clients.Elasticsearch.Cluster;
31+
32+
public sealed class AllocationExplainRequestParameters : RequestParameters
33+
{
34+
/// <summary>
35+
/// <para>If true, returns information about disk usage and shard sizes.</para>
36+
/// </summary>
37+
public bool? IncludeDiskInfo { get => Q<bool?>("include_disk_info"); set => Q("include_disk_info", value); }
38+
39+
/// <summary>
40+
/// <para>If true, returns YES decisions in explanation.</para>
41+
/// </summary>
42+
public bool? IncludeYesDecisions { get => Q<bool?>("include_yes_decisions"); set => Q("include_yes_decisions", value); }
43+
}
44+
45+
/// <summary>
46+
/// <para>Provides explanations for shard allocations in the cluster.</para>
47+
/// </summary>
48+
public sealed partial class AllocationExplainRequest : PlainRequest<AllocationExplainRequestParameters>
49+
{
50+
internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterAllocationExplain;
51+
52+
protected override HttpMethod StaticHttpMethod => HttpMethod.POST;
53+
54+
internal override bool SupportsBody => true;
55+
56+
/// <summary>
57+
/// <para>If true, returns information about disk usage and shard sizes.</para>
58+
/// </summary>
59+
[JsonIgnore]
60+
public bool? IncludeDiskInfo { get => Q<bool?>("include_disk_info"); set => Q("include_disk_info", value); }
61+
62+
/// <summary>
63+
/// <para>If true, returns YES decisions in explanation.</para>
64+
/// </summary>
65+
[JsonIgnore]
66+
public bool? IncludeYesDecisions { get => Q<bool?>("include_yes_decisions"); set => Q("include_yes_decisions", value); }
67+
68+
/// <summary>
69+
/// <para>Specifies the node ID or the name of the node to only explain a shard that is currently located on the specified node.</para>
70+
/// </summary>
71+
[JsonInclude, JsonPropertyName("current_node")]
72+
public string? CurrentNode { get; set; }
73+
74+
/// <summary>
75+
/// <para>Specifies the name of the index that you would like an explanation for.</para>
76+
/// </summary>
77+
[JsonInclude, JsonPropertyName("index")]
78+
public Elastic.Clients.Elasticsearch.IndexName? Index { get; set; }
79+
80+
/// <summary>
81+
/// <para>If true, returns explanation for the primary shard for the given shard ID.</para>
82+
/// </summary>
83+
[JsonInclude, JsonPropertyName("primary")]
84+
public bool? Primary { get; set; }
85+
86+
/// <summary>
87+
/// <para>Specifies the ID of the shard that you would like an explanation for.</para>
88+
/// </summary>
89+
[JsonInclude, JsonPropertyName("shard")]
90+
public int? Shard { get; set; }
91+
}
92+
93+
/// <summary>
94+
/// <para>Provides explanations for shard allocations in the cluster.</para>
95+
/// </summary>
96+
public sealed partial class AllocationExplainRequestDescriptor : RequestDescriptor<AllocationExplainRequestDescriptor, AllocationExplainRequestParameters>
97+
{
98+
internal AllocationExplainRequestDescriptor(Action<AllocationExplainRequestDescriptor> configure) => configure.Invoke(this);
99+
100+
public AllocationExplainRequestDescriptor()
101+
{
102+
}
103+
104+
internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterAllocationExplain;
105+
106+
protected override HttpMethod StaticHttpMethod => HttpMethod.POST;
107+
108+
internal override bool SupportsBody => true;
109+
110+
public AllocationExplainRequestDescriptor IncludeDiskInfo(bool? includeDiskInfo = true) => Qs("include_disk_info", includeDiskInfo);
111+
public AllocationExplainRequestDescriptor IncludeYesDecisions(bool? includeYesDecisions = true) => Qs("include_yes_decisions", includeYesDecisions);
112+
113+
private string? CurrentNodeValue { get; set; }
114+
private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; }
115+
private bool? PrimaryValue { get; set; }
116+
private int? ShardValue { get; set; }
117+
118+
/// <summary>
119+
/// <para>Specifies the node ID or the name of the node to only explain a shard that is currently located on the specified node.</para>
120+
/// </summary>
121+
public AllocationExplainRequestDescriptor CurrentNode(string? currentNode)
122+
{
123+
CurrentNodeValue = currentNode;
124+
return Self;
125+
}
126+
127+
/// <summary>
128+
/// <para>Specifies the name of the index that you would like an explanation for.</para>
129+
/// </summary>
130+
public AllocationExplainRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index)
131+
{
132+
IndexValue = index;
133+
return Self;
134+
}
135+
136+
/// <summary>
137+
/// <para>If true, returns explanation for the primary shard for the given shard ID.</para>
138+
/// </summary>
139+
public AllocationExplainRequestDescriptor Primary(bool? primary = true)
140+
{
141+
PrimaryValue = primary;
142+
return Self;
143+
}
144+
145+
/// <summary>
146+
/// <para>Specifies the ID of the shard that you would like an explanation for.</para>
147+
/// </summary>
148+
public AllocationExplainRequestDescriptor Shard(int? shard)
149+
{
150+
ShardValue = shard;
151+
return Self;
152+
}
153+
154+
protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
155+
{
156+
writer.WriteStartObject();
157+
if (!string.IsNullOrEmpty(CurrentNodeValue))
158+
{
159+
writer.WritePropertyName("current_node");
160+
writer.WriteStringValue(CurrentNodeValue);
161+
}
162+
163+
if (IndexValue is not null)
164+
{
165+
writer.WritePropertyName("index");
166+
JsonSerializer.Serialize(writer, IndexValue, options);
167+
}
168+
169+
if (PrimaryValue.HasValue)
170+
{
171+
writer.WritePropertyName("primary");
172+
writer.WriteBooleanValue(PrimaryValue.Value);
173+
}
174+
175+
if (ShardValue.HasValue)
176+
{
177+
writer.WritePropertyName("shard");
178+
writer.WriteNumberValue(ShardValue.Value);
179+
}
180+
181+
writer.WriteEndObject();
182+
}
183+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
#nullable restore
19+
20+
using Elastic.Clients.Elasticsearch.Fluent;
21+
using Elastic.Clients.Elasticsearch.Serialization;
22+
using Elastic.Transport.Products.Elasticsearch;
23+
using System.Collections.Generic;
24+
using System.Text.Json.Serialization;
25+
26+
namespace Elastic.Clients.Elasticsearch.Cluster;
27+
28+
public sealed partial class AllocationExplainResponse : ElasticsearchResponse
29+
{
30+
[JsonInclude, JsonPropertyName("allocate_explanation")]
31+
public string? AllocateExplanation { get; init; }
32+
[JsonInclude, JsonPropertyName("allocation_delay")]
33+
public Elastic.Clients.Elasticsearch.Duration? AllocationDelay { get; init; }
34+
[JsonInclude, JsonPropertyName("allocation_delay_in_millis")]
35+
public long? AllocationDelayInMillis { get; init; }
36+
[JsonInclude, JsonPropertyName("can_allocate")]
37+
public Elastic.Clients.Elasticsearch.Cluster.Decision? CanAllocate { get; init; }
38+
[JsonInclude, JsonPropertyName("can_move_to_other_node")]
39+
public Elastic.Clients.Elasticsearch.Cluster.Decision? CanMoveToOtherNode { get; init; }
40+
[JsonInclude, JsonPropertyName("can_rebalance_cluster")]
41+
public Elastic.Clients.Elasticsearch.Cluster.Decision? CanRebalanceCluster { get; init; }
42+
[JsonInclude, JsonPropertyName("can_rebalance_cluster_decisions")]
43+
public IReadOnlyCollection<Elastic.Clients.Elasticsearch.Cluster.AllocationDecision>? CanRebalanceClusterDecisions { get; init; }
44+
[JsonInclude, JsonPropertyName("can_rebalance_to_other_node")]
45+
public Elastic.Clients.Elasticsearch.Cluster.Decision? CanRebalanceToOtherNode { get; init; }
46+
[JsonInclude, JsonPropertyName("can_remain_decisions")]
47+
public IReadOnlyCollection<Elastic.Clients.Elasticsearch.Cluster.AllocationDecision>? CanRemainDecisions { get; init; }
48+
[JsonInclude, JsonPropertyName("can_remain_on_current_node")]
49+
public Elastic.Clients.Elasticsearch.Cluster.Decision? CanRemainOnCurrentNode { get; init; }
50+
[JsonInclude, JsonPropertyName("cluster_info")]
51+
public Elastic.Clients.Elasticsearch.Cluster.ClusterInfo? ClusterInfo { get; init; }
52+
[JsonInclude, JsonPropertyName("configured_delay")]
53+
public Elastic.Clients.Elasticsearch.Duration? ConfiguredDelay { get; init; }
54+
[JsonInclude, JsonPropertyName("configured_delay_in_millis")]
55+
public long? ConfiguredDelayInMillis { get; init; }
56+
[JsonInclude, JsonPropertyName("current_node")]
57+
public Elastic.Clients.Elasticsearch.Cluster.CurrentNode? CurrentNode { get; init; }
58+
[JsonInclude, JsonPropertyName("current_state")]
59+
public string CurrentState { get; init; }
60+
[JsonInclude, JsonPropertyName("index")]
61+
public string Index { get; init; }
62+
[JsonInclude, JsonPropertyName("move_explanation")]
63+
public string? MoveExplanation { get; init; }
64+
[JsonInclude, JsonPropertyName("node_allocation_decisions")]
65+
public IReadOnlyCollection<Elastic.Clients.Elasticsearch.Cluster.NodeAllocationExplanation>? NodeAllocationDecisions { get; init; }
66+
[JsonInclude, JsonPropertyName("note")]
67+
public string? Note { get; init; }
68+
[JsonInclude, JsonPropertyName("primary")]
69+
public bool Primary { get; init; }
70+
[JsonInclude, JsonPropertyName("rebalance_explanation")]
71+
public string? RebalanceExplanation { get; init; }
72+
[JsonInclude, JsonPropertyName("remaining_delay")]
73+
public Elastic.Clients.Elasticsearch.Duration? RemainingDelay { get; init; }
74+
[JsonInclude, JsonPropertyName("remaining_delay_in_millis")]
75+
public long? RemainingDelayInMillis { get; init; }
76+
[JsonInclude, JsonPropertyName("shard")]
77+
public int Shard { get; init; }
78+
[JsonInclude, JsonPropertyName("unassigned_info")]
79+
public Elastic.Clients.Elasticsearch.Cluster.UnassignedInformation? UnassignedInfo { get; init; }
80+
}

0 commit comments

Comments
 (0)