Skip to content

[Backport 8.5] Add support for additional endpoints #7612

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

Merged
merged 1 commit into from
Apr 11, 2023
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
15 changes: 15 additions & 0 deletions src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,23 @@ internal static class ApiUrlLookup
internal static ApiUrls NoNamespaceBulk = new ApiUrls(new[] { "/_bulk", "/{index}/_bulk" });
internal static ApiUrls NoNamespaceClearScroll = new ApiUrls(new[] { "/_search/scroll" });
internal static ApiUrls NoNamespaceClosePointInTime = new ApiUrls(new[] { "/_pit" });
internal static ApiUrls ClusterAllocationExplain = new ApiUrls(new[] { "/_cluster/allocation/explain" });
internal static ApiUrls ClusterStats = new ApiUrls(new[] { "/_cluster/stats", "/_cluster/stats/nodes/{node_id}" });
internal static ApiUrls ClusterGetSettings = new ApiUrls(new[] { "/_cluster/settings" });
internal static ApiUrls ClusterHealth = new ApiUrls(new[] { "/_cluster/health", "/_cluster/health/{index}" });
internal static ApiUrls ClusterPendingTasks = new ApiUrls(new[] { "/_cluster/pending_tasks" });
internal static ApiUrls NoNamespaceCount = new ApiUrls(new[] { "/_count", "/{index}/_count" });
internal static ApiUrls NoNamespaceCreate = new ApiUrls(new[] { "/{index}/_create/{id}" });
internal static ApiUrls DanglingIndicesListDanglingIndices = new ApiUrls(new[] { "/_dangling" });
internal static ApiUrls NoNamespaceDeleteByQuery = new ApiUrls(new[] { "/{index}/_delete_by_query" });
internal static ApiUrls NoNamespaceDeleteByQueryRethrottle = new ApiUrls(new[] { "/_delete_by_query/{task_id}/_rethrottle" });
internal static ApiUrls NoNamespaceDelete = new ApiUrls(new[] { "/{index}/_doc/{id}" });
internal static ApiUrls NoNamespaceDeleteScript = new ApiUrls(new[] { "/_scripts/{id}" });
internal static ApiUrls EnrichDeletePolicy = new ApiUrls(new[] { "/_enrich/policy/{name}" });
internal static ApiUrls EnrichStats = new ApiUrls(new[] { "/_enrich/_stats" });
internal static ApiUrls EnrichExecutePolicy = new ApiUrls(new[] { "/_enrich/policy/{name}/_execute" });
internal static ApiUrls EnrichGetPolicy = new ApiUrls(new[] { "/_enrich/policy/{name}", "/_enrich/policy" });
internal static ApiUrls EnrichPutPolicy = new ApiUrls(new[] { "/_enrich/policy/{name}" });
internal static ApiUrls EqlDelete = new ApiUrls(new[] { "/_eql/search/{id}" });
internal static ApiUrls EqlGet = new ApiUrls(new[] { "/_eql/search/{id}" });
internal static ApiUrls EqlSearch = new ApiUrls(new[] { "/{index}/_eql/search" });
Expand All @@ -48,6 +58,7 @@ internal static class ApiUrlLookup
internal static ApiUrls NoNamespaceGetScriptLanguages = new ApiUrls(new[] { "/_script_language" });
internal static ApiUrls NoNamespaceGetScript = new ApiUrls(new[] { "/_scripts/{id}" });
internal static ApiUrls NoNamespaceGetSource = new ApiUrls(new[] { "/{index}/_source/{id}" });
internal static ApiUrls GraphExplore = new ApiUrls(new[] { "/{index}/_graph/explore" });
internal static ApiUrls IndexManagementClone = new ApiUrls(new[] { "/{index}/_clone/{target}" });
internal static ApiUrls IndexManagementClose = new ApiUrls(new[] { "/{index}/_close" });
internal static ApiUrls IndexManagementCreateDataStream = new ApiUrls(new[] { "/_data_stream/{name}" });
Expand Down Expand Up @@ -95,15 +106,18 @@ internal static class ApiUrlLookup
internal static ApiUrls NoNamespaceMget = new ApiUrls(new[] { "/_mget", "/{index}/_mget" });
internal static ApiUrls NoNamespaceMsearch = new ApiUrls(new[] { "/_msearch", "/{index}/_msearch" });
internal static ApiUrls NoNamespaceMsearchTemplate = new ApiUrls(new[] { "/_msearch/template", "/{index}/_msearch/template" });
internal static ApiUrls NoNamespaceMtermvectors = new ApiUrls(new[] { "/_mtermvectors", "/{index}/_mtermvectors" });
internal static ApiUrls NoNamespaceOpenPointInTime = new ApiUrls(new[] { "/{index}/_pit" });
internal static ApiUrls NoNamespacePing = new ApiUrls(new[] { "/" });
internal static ApiUrls NoNamespacePutScript = new ApiUrls(new[] { "/_scripts/{id}", "/_scripts/{id}/{context}" });
internal static ApiUrls NoNamespaceRankEval = new ApiUrls(new[] { "/_rank_eval", "/{index}/_rank_eval" });
internal static ApiUrls NoNamespaceReindex = new ApiUrls(new[] { "/_reindex" });
internal static ApiUrls NoNamespaceReindexRethrottle = new ApiUrls(new[] { "/_reindex/{task_id}/_rethrottle" });
internal static ApiUrls NoNamespaceRenderSearchTemplate = new ApiUrls(new[] { "/_render/template", "/_render/template/{id}" });
internal static ApiUrls NoNamespaceScroll = new ApiUrls(new[] { "/_search/scroll" });
internal static ApiUrls NoNamespaceSearch = new ApiUrls(new[] { "/_search", "/{index}/_search" });
internal static ApiUrls NoNamespaceSearchShards = new ApiUrls(new[] { "/_search_shards", "/{index}/_search_shards" });
internal static ApiUrls NoNamespaceSearchTemplate = new ApiUrls(new[] { "/_search/template", "/{index}/_search/template" });
internal static ApiUrls SqlClearCursor = new ApiUrls(new[] { "/_sql/close" });
internal static ApiUrls SqlDeleteAsync = new ApiUrls(new[] { "/_sql/async/delete/{id}" });
internal static ApiUrls SqlGetAsync = new ApiUrls(new[] { "/_sql/async/{id}" });
Expand All @@ -113,6 +127,7 @@ internal static class ApiUrlLookup
internal static ApiUrls TasksGet = new ApiUrls(new[] { "/_tasks/{task_id}" });
internal static ApiUrls TasksList = new ApiUrls(new[] { "/_tasks" });
internal static ApiUrls NoNamespaceTermsEnum = new ApiUrls(new[] { "/{index}/_terms_enum" });
internal static ApiUrls NoNamespaceTermvectors = new ApiUrls(new[] { "/{index}/_termvectors/{id}", "/{index}/_termvectors" });
internal static ApiUrls NoNamespaceUpdateByQuery = new ApiUrls(new[] { "/{index}/_update_by_query" });
internal static ApiUrls NoNamespaceUpdateByQueryRethrottle = new ApiUrls(new[] { "/_update_by_query/{task_id}/_rethrottle" });
internal static ApiUrls NoNamespaceUpdate = new ApiUrls(new[] { "/{index}/_update/{id}" });
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Fluent;
using Elastic.Clients.Elasticsearch.Requests;
using Elastic.Clients.Elasticsearch.Serialization;
using Elastic.Transport;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch.Cluster;

public sealed class AllocationExplainRequestParameters : RequestParameters
{
/// <summary>
/// <para>If true, returns information about disk usage and shard sizes.</para>
/// </summary>
public bool? IncludeDiskInfo { get => Q<bool?>("include_disk_info"); set => Q("include_disk_info", value); }

/// <summary>
/// <para>If true, returns YES decisions in explanation.</para>
/// </summary>
public bool? IncludeYesDecisions { get => Q<bool?>("include_yes_decisions"); set => Q("include_yes_decisions", value); }
}

/// <summary>
/// <para>Provides explanations for shard allocations in the cluster.</para>
/// </summary>
public sealed partial class AllocationExplainRequest : PlainRequest<AllocationExplainRequestParameters>
{
internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterAllocationExplain;

protected override HttpMethod StaticHttpMethod => HttpMethod.POST;

internal override bool SupportsBody => true;

/// <summary>
/// <para>If true, returns information about disk usage and shard sizes.</para>
/// </summary>
[JsonIgnore]
public bool? IncludeDiskInfo { get => Q<bool?>("include_disk_info"); set => Q("include_disk_info", value); }

/// <summary>
/// <para>If true, returns YES decisions in explanation.</para>
/// </summary>
[JsonIgnore]
public bool? IncludeYesDecisions { get => Q<bool?>("include_yes_decisions"); set => Q("include_yes_decisions", value); }

/// <summary>
/// <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>
/// </summary>
[JsonInclude, JsonPropertyName("current_node")]
public string? CurrentNode { get; set; }

/// <summary>
/// <para>Specifies the name of the index that you would like an explanation for.</para>
/// </summary>
[JsonInclude, JsonPropertyName("index")]
public Elastic.Clients.Elasticsearch.IndexName? Index { get; set; }

/// <summary>
/// <para>If true, returns explanation for the primary shard for the given shard ID.</para>
/// </summary>
[JsonInclude, JsonPropertyName("primary")]
public bool? Primary { get; set; }

/// <summary>
/// <para>Specifies the ID of the shard that you would like an explanation for.</para>
/// </summary>
[JsonInclude, JsonPropertyName("shard")]
public int? Shard { get; set; }
}

/// <summary>
/// <para>Provides explanations for shard allocations in the cluster.</para>
/// </summary>
public sealed partial class AllocationExplainRequestDescriptor : RequestDescriptor<AllocationExplainRequestDescriptor, AllocationExplainRequestParameters>
{
internal AllocationExplainRequestDescriptor(Action<AllocationExplainRequestDescriptor> configure) => configure.Invoke(this);

public AllocationExplainRequestDescriptor()
{
}

internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterAllocationExplain;

protected override HttpMethod StaticHttpMethod => HttpMethod.POST;

internal override bool SupportsBody => true;

public AllocationExplainRequestDescriptor IncludeDiskInfo(bool? includeDiskInfo = true) => Qs("include_disk_info", includeDiskInfo);
public AllocationExplainRequestDescriptor IncludeYesDecisions(bool? includeYesDecisions = true) => Qs("include_yes_decisions", includeYesDecisions);

private string? CurrentNodeValue { get; set; }
private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; }
private bool? PrimaryValue { get; set; }
private int? ShardValue { get; set; }

/// <summary>
/// <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>
/// </summary>
public AllocationExplainRequestDescriptor CurrentNode(string? currentNode)
{
CurrentNodeValue = currentNode;
return Self;
}

/// <summary>
/// <para>Specifies the name of the index that you would like an explanation for.</para>
/// </summary>
public AllocationExplainRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index)
{
IndexValue = index;
return Self;
}

/// <summary>
/// <para>If true, returns explanation for the primary shard for the given shard ID.</para>
/// </summary>
public AllocationExplainRequestDescriptor Primary(bool? primary = true)
{
PrimaryValue = primary;
return Self;
}

/// <summary>
/// <para>Specifies the ID of the shard that you would like an explanation for.</para>
/// </summary>
public AllocationExplainRequestDescriptor Shard(int? shard)
{
ShardValue = shard;
return Self;
}

protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
{
writer.WriteStartObject();
if (!string.IsNullOrEmpty(CurrentNodeValue))
{
writer.WritePropertyName("current_node");
writer.WriteStringValue(CurrentNodeValue);
}

if (IndexValue is not null)
{
writer.WritePropertyName("index");
JsonSerializer.Serialize(writer, IndexValue, options);
}

if (PrimaryValue.HasValue)
{
writer.WritePropertyName("primary");
writer.WriteBooleanValue(PrimaryValue.Value);
}

if (ShardValue.HasValue)
{
writer.WritePropertyName("shard");
writer.WriteNumberValue(ShardValue.Value);
}

writer.WriteEndObject();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Fluent;
using Elastic.Clients.Elasticsearch.Serialization;
using Elastic.Transport.Products.Elasticsearch;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch.Cluster;

public sealed partial class AllocationExplainResponse : ElasticsearchResponse
{
[JsonInclude, JsonPropertyName("allocate_explanation")]
public string? AllocateExplanation { get; init; }
[JsonInclude, JsonPropertyName("allocation_delay")]
public Elastic.Clients.Elasticsearch.Duration? AllocationDelay { get; init; }
[JsonInclude, JsonPropertyName("allocation_delay_in_millis")]
public long? AllocationDelayInMillis { get; init; }
[JsonInclude, JsonPropertyName("can_allocate")]
public Elastic.Clients.Elasticsearch.Cluster.Decision? CanAllocate { get; init; }
[JsonInclude, JsonPropertyName("can_move_to_other_node")]
public Elastic.Clients.Elasticsearch.Cluster.Decision? CanMoveToOtherNode { get; init; }
[JsonInclude, JsonPropertyName("can_rebalance_cluster")]
public Elastic.Clients.Elasticsearch.Cluster.Decision? CanRebalanceCluster { get; init; }
[JsonInclude, JsonPropertyName("can_rebalance_cluster_decisions")]
public IReadOnlyCollection<Elastic.Clients.Elasticsearch.Cluster.AllocationDecision>? CanRebalanceClusterDecisions { get; init; }
[JsonInclude, JsonPropertyName("can_rebalance_to_other_node")]
public Elastic.Clients.Elasticsearch.Cluster.Decision? CanRebalanceToOtherNode { get; init; }
[JsonInclude, JsonPropertyName("can_remain_decisions")]
public IReadOnlyCollection<Elastic.Clients.Elasticsearch.Cluster.AllocationDecision>? CanRemainDecisions { get; init; }
[JsonInclude, JsonPropertyName("can_remain_on_current_node")]
public Elastic.Clients.Elasticsearch.Cluster.Decision? CanRemainOnCurrentNode { get; init; }
[JsonInclude, JsonPropertyName("cluster_info")]
public Elastic.Clients.Elasticsearch.Cluster.ClusterInfo? ClusterInfo { get; init; }
[JsonInclude, JsonPropertyName("configured_delay")]
public Elastic.Clients.Elasticsearch.Duration? ConfiguredDelay { get; init; }
[JsonInclude, JsonPropertyName("configured_delay_in_millis")]
public long? ConfiguredDelayInMillis { get; init; }
[JsonInclude, JsonPropertyName("current_node")]
public Elastic.Clients.Elasticsearch.Cluster.CurrentNode? CurrentNode { get; init; }
[JsonInclude, JsonPropertyName("current_state")]
public string CurrentState { get; init; }
[JsonInclude, JsonPropertyName("index")]
public string Index { get; init; }
[JsonInclude, JsonPropertyName("move_explanation")]
public string? MoveExplanation { get; init; }
[JsonInclude, JsonPropertyName("node_allocation_decisions")]
public IReadOnlyCollection<Elastic.Clients.Elasticsearch.Cluster.NodeAllocationExplanation>? NodeAllocationDecisions { get; init; }
[JsonInclude, JsonPropertyName("note")]
public string? Note { get; init; }
[JsonInclude, JsonPropertyName("primary")]
public bool Primary { get; init; }
[JsonInclude, JsonPropertyName("rebalance_explanation")]
public string? RebalanceExplanation { get; init; }
[JsonInclude, JsonPropertyName("remaining_delay")]
public Elastic.Clients.Elasticsearch.Duration? RemainingDelay { get; init; }
[JsonInclude, JsonPropertyName("remaining_delay_in_millis")]
public long? RemainingDelayInMillis { get; init; }
[JsonInclude, JsonPropertyName("shard")]
public int Shard { get; init; }
[JsonInclude, JsonPropertyName("unassigned_info")]
public Elastic.Clients.Elasticsearch.Cluster.UnassignedInformation? UnassignedInfo { get; init; }
}
Loading