Skip to content
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
30 changes: 13 additions & 17 deletions src/Elastic.Clients.Elasticsearch/Common/Infer/Fields/Fields.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,28 @@

namespace Elastic.Clients.Elasticsearch;

// TODO - Converter

internal sealed class FieldsConverter : JsonConverter<Fields>
{
public override Fields? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
reader.Read();

if (reader.TokenType != JsonTokenType.StartArray)
if (reader.TokenType == JsonTokenType.String)
{
return null;
Fields fields = reader.GetString();
return fields;
}

var fields = new List<Field>();
while (reader.Read())
else if (reader.TokenType == JsonTokenType.StartArray)
{
if (reader.TokenType == JsonTokenType.EndArray)
break;

var field = JsonSerializer.Deserialize(ref reader, typeof(Field), options);

if (field is Field f)
fields.Add(f);
var fields = new List<Field>();
while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
{
var field = JsonSerializer.Deserialize<Field>(ref reader, options);
fields.Add(field);
}
return new Fields(fields);
}

return new Fields(fields);
reader.Read();
return null;
}

public override void Write(Utf8JsonWriter writer, Fields value, JsonSerializerOptions options)
Expand Down
12 changes: 12 additions & 0 deletions src/Elastic.Clients.Elasticsearch/Common/Infer/Indices/Indices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ internal Indices(ManyIndices indices) : base(indices) { }

internal Indices(IEnumerable<IndexName> indices) : base(new ManyIndices(indices)) { }

internal Indices(IEnumerable<string> indices) : base(new ManyIndices(indices)) { }

/// <summary>All indices. Represents _all</summary>
public static Indices All { get; } = new Indices(new AllIndicesMarker());

Expand Down Expand Up @@ -153,6 +155,16 @@ internal sealed class IndicesJsonConverter : JsonConverter<Indices>
Indices indices = reader.GetString();
return indices;
}
else if (reader.TokenType == JsonTokenType.StartArray)
{
var indices = new List<string>();
while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
{
var index = reader.GetString();
indices.Add(index);
}
return new Indices(indices);
}

reader.Read();
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ internal static class ApiUrlsLookups
internal static ApiUrls NoNamespaceCount = new ApiUrls(new[] { "/_count", "/{index}/_count" });
internal static ApiUrls NoNamespaceCreate = new ApiUrls(new[] { "/{index}/_create/{id}" });
internal static ApiUrls NoNamespaceDelete = new ApiUrls(new[] { "/{index}/_doc/{id}" });
internal static ApiUrls EnrichDeletePolicy = new ApiUrls(new[] { "/_enrich/policy/{name}" });
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 EnrichStats = new ApiUrls(new[] { "/_enrich/_stats" });
internal static ApiUrls EqlDelete = new ApiUrls(new[] { "/_eql/search/{id}" });
internal static ApiUrls EqlGetStatus = new ApiUrls(new[] { "/_eql/search/status/{id}" });
internal static ApiUrls EqlSearch = new ApiUrls(new[] { "/{index}/_eql/search" });
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// 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.
//
// ------------------------------------------------

using Elastic.Transport;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.Enrich
{
public class EnrichDeletePolicyRequestParameters : RequestParameters<EnrichDeletePolicyRequestParameters>
{
}

public partial class EnrichDeletePolicyRequest : PlainRequestBase<EnrichDeletePolicyRequestParameters>
{
public EnrichDeletePolicyRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name))
{
}

internal override ApiUrls ApiUrls => ApiUrlsLookups.EnrichDeletePolicy;
protected override HttpMethod HttpMethod => HttpMethod.DELETE;
protected override bool SupportsBody => false;
}

public sealed partial class EnrichDeletePolicyRequestDescriptor : RequestDescriptorBase<EnrichDeletePolicyRequestDescriptor, EnrichDeletePolicyRequestParameters>
{
internal EnrichDeletePolicyRequestDescriptor(Action<EnrichDeletePolicyRequestDescriptor> configure) => configure.Invoke(this);
public EnrichDeletePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name))
{
}

internal EnrichDeletePolicyRequestDescriptor()
{
}

internal override ApiUrls ApiUrls => ApiUrlsLookups.EnrichDeletePolicy;
protected override HttpMethod HttpMethod => HttpMethod.DELETE;
protected override bool SupportsBody => false;
public EnrichDeletePolicyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name)
{
RouteValues.Required("name", name);
return Self;
}

protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// 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.
//
// ------------------------------------------------

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

#nullable restore
namespace Elastic.Clients.Elasticsearch.Enrich
{
public partial class EnrichDeletePolicyResponse : ElasticsearchResponseBase
{
[JsonInclude]
[JsonPropertyName("acknowledged")]
public bool Acknowledged { get; init; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// 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.
//
// ------------------------------------------------

using Elastic.Transport;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.Enrich
{
public class EnrichExecutePolicyRequestParameters : RequestParameters<EnrichExecutePolicyRequestParameters>
{
[JsonIgnore]
public bool? WaitForCompletion { get => Q<bool?>("wait_for_completion"); set => Q("wait_for_completion", value); }
}

public partial class EnrichExecutePolicyRequest : PlainRequestBase<EnrichExecutePolicyRequestParameters>
{
public EnrichExecutePolicyRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name))
{
}

internal override ApiUrls ApiUrls => ApiUrlsLookups.EnrichExecutePolicy;
protected override HttpMethod HttpMethod => HttpMethod.PUT;
protected override bool SupportsBody => false;
[JsonIgnore]
public bool? WaitForCompletion { get => Q<bool?>("wait_for_completion"); set => Q("wait_for_completion", value); }
}

public sealed partial class EnrichExecutePolicyRequestDescriptor : RequestDescriptorBase<EnrichExecutePolicyRequestDescriptor, EnrichExecutePolicyRequestParameters>
{
internal EnrichExecutePolicyRequestDescriptor(Action<EnrichExecutePolicyRequestDescriptor> configure) => configure.Invoke(this);
public EnrichExecutePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name))
{
}

internal EnrichExecutePolicyRequestDescriptor()
{
}

internal override ApiUrls ApiUrls => ApiUrlsLookups.EnrichExecutePolicy;
protected override HttpMethod HttpMethod => HttpMethod.PUT;
protected override bool SupportsBody => false;
public EnrichExecutePolicyRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion);
public EnrichExecutePolicyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name)
{
RouteValues.Required("name", name);
return Self;
}

protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// 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.
//
// ------------------------------------------------

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

#nullable restore
namespace Elastic.Clients.Elasticsearch.Enrich
{
public partial class EnrichExecutePolicyResponse : ElasticsearchResponseBase
{
[JsonInclude]
[JsonPropertyName("status")]
public Elastic.Clients.Elasticsearch.Enrich.ExecutePolicy.ExecuteEnrichPolicyStatus Status { get; init; }

[JsonInclude]
[JsonPropertyName("task_id")]
public Elastic.Clients.Elasticsearch.TaskId? TaskId { get; init; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// 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.
//
// ------------------------------------------------

using Elastic.Transport;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.Enrich
{
public class EnrichGetPolicyRequestParameters : RequestParameters<EnrichGetPolicyRequestParameters>
{
}

public partial class EnrichGetPolicyRequest : PlainRequestBase<EnrichGetPolicyRequestParameters>
{
public EnrichGetPolicyRequest()
{
}

public EnrichGetPolicyRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name))
{
}

internal override ApiUrls ApiUrls => ApiUrlsLookups.EnrichGetPolicy;
protected override HttpMethod HttpMethod => HttpMethod.GET;
protected override bool SupportsBody => false;
}

public sealed partial class EnrichGetPolicyRequestDescriptor : RequestDescriptorBase<EnrichGetPolicyRequestDescriptor, EnrichGetPolicyRequestParameters>
{
internal EnrichGetPolicyRequestDescriptor(Action<EnrichGetPolicyRequestDescriptor> configure) => configure.Invoke(this);
public EnrichGetPolicyRequestDescriptor()
{
}

internal override ApiUrls ApiUrls => ApiUrlsLookups.EnrichGetPolicy;
protected override HttpMethod HttpMethod => HttpMethod.GET;
protected override bool SupportsBody => false;
public EnrichGetPolicyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? name)
{
RouteValues.Optional("name", name);
return Self;
}

protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// 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.
//
// ------------------------------------------------

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

#nullable restore
namespace Elastic.Clients.Elasticsearch.Enrich
{
public partial class EnrichGetPolicyResponse : ElasticsearchResponseBase
{
[JsonInclude]
[JsonPropertyName("policies")]
public IReadOnlyCollection<Elastic.Clients.Elasticsearch.Enrich.Summary> Policies { get; init; }
}
}
Loading