diff --git a/src/CodeGeneration/ApiGenerator/Configuration/CodeConfiguration.cs b/src/CodeGeneration/ApiGenerator/Configuration/CodeConfiguration.cs
index 9d8d2f4fadf..ce052f1c562 100644
--- a/src/CodeGeneration/ApiGenerator/Configuration/CodeConfiguration.cs
+++ b/src/CodeGeneration/ApiGenerator/Configuration/CodeConfiguration.cs
@@ -55,11 +55,6 @@ public static class CodeConfiguration
"data_frame_transform_deprecated.start_transform.json",
"data_frame_transform_deprecated.stop_transform.json",
"data_frame_transform_deprecated.update_transform.json",
- "enrich.delete_policy.json",
- "enrich.execute_policy.json",
- "enrich.get_policy.json",
- "enrich.put_policy.json",
- "enrich.stats.json",
"transform.delete_transform.json",
"transform.get_transform.json",
"transform.get_transform_stats.json",
diff --git a/src/CodeGeneration/ApiGenerator/RestSpecification/_Patches/enrich.get_policy.patch.json b/src/CodeGeneration/ApiGenerator/RestSpecification/_Patches/enrich.get_policy.patch.json
new file mode 100644
index 00000000000..5045167b875
--- /dev/null
+++ b/src/CodeGeneration/ApiGenerator/RestSpecification/_Patches/enrich.get_policy.patch.json
@@ -0,0 +1,14 @@
+{
+ "enrich.get_policy": {
+ "documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-get-policy.html",
+ "stability" : "stable",
+ "url": {
+ "parts": {
+ "name": {
+ "type" : "list",
+ "description" : "A comma-separated list of enrich policy names"
+ }
+ }
+ }
+ }
+}
diff --git a/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Enrich.cs b/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Enrich.cs
new file mode 100644
index 00000000000..6b08d815b42
--- /dev/null
+++ b/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Enrich.cs
@@ -0,0 +1,62 @@
+// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
+// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
+// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
+// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
+// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
+// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
+// -----------------------------------------------
+//
+// This file is automatically generated
+// Please do not edit these files manually
+// Run the following in the root of the repos:
+//
+// *NIX : ./build.sh codegen
+// Windows : build.bat codegen
+//
+// -----------------------------------------------
+// ReSharper disable RedundantUsingDirective
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Linq.Expressions;
+
+// ReSharper disable once CheckNamespace
+namespace Elasticsearch.Net.Specification.EnrichApi
+{
+ ///Request options for DeletePolicy https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-delete-policy.html
+ public class DeleteEnrichPolicyRequestParameters : RequestParameters
+ {
+ public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE;
+ }
+
+ ///Request options for ExecutePolicy https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-execute-policy.html
+ public class ExecuteEnrichPolicyRequestParameters : RequestParameters
+ {
+ public override HttpMethod DefaultHttpMethod => HttpMethod.PUT;
+ ///Should the request should block until the execution is complete.
+ public bool? WaitForCompletion
+ {
+ get => Q("wait_for_completion");
+ set => Q("wait_for_completion", value);
+ }
+ }
+
+ ///Request options for GetPolicy https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-get-policy.html
+ public class GetEnrichPolicyRequestParameters : RequestParameters
+ {
+ public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
+ }
+
+ ///Request options for PutPolicy https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-put-policy.html
+ public class PutEnrichPolicyRequestParameters : RequestParameters
+ {
+ public override HttpMethod DefaultHttpMethod => HttpMethod.PUT;
+ }
+
+ ///Request options for Stats https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-stats.html
+ public class EnrichStatsRequestParameters : RequestParameters
+ {
+ public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
+ }
+}
\ No newline at end of file
diff --git a/src/Elasticsearch.Net/ElasticLowLevelClient.Enrich.cs b/src/Elasticsearch.Net/ElasticLowLevelClient.Enrich.cs
new file mode 100644
index 00000000000..c2a564cc0ef
--- /dev/null
+++ b/src/Elasticsearch.Net/ElasticLowLevelClient.Enrich.cs
@@ -0,0 +1,111 @@
+// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
+// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
+// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
+// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
+// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
+// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
+// -----------------------------------------------
+//
+// This file is automatically generated
+// Please do not edit these files manually
+// Run the following in the root of the repos:
+//
+// *NIX : ./build.sh codegen
+// Windows : build.bat codegen
+//
+// -----------------------------------------------
+// ReSharper disable RedundantUsingDirective
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+using static Elasticsearch.Net.HttpMethod;
+
+// ReSharper disable InterpolatedStringExpressionIsNotIFormattable
+// ReSharper disable once CheckNamespace
+// ReSharper disable InterpolatedStringExpressionIsNotIFormattable
+// ReSharper disable RedundantExtendsListEntry
+namespace Elasticsearch.Net.Specification.EnrichApi
+{
+ ///
+ /// Enrich APIs.
+ /// Not intended to be instantiated directly. Use the property
+ /// on .
+ ///
+ ///
+ public class LowLevelEnrichNamespace : NamespacedClientProxy
+ {
+ internal LowLevelEnrichNamespace(ElasticLowLevelClient client): base(client)
+ {
+ }
+
+ ///DELETE on /_enrich/policy/{name} https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-delete-policy.html
+ ///The name of the enrich policy
+ ///Request specific configuration such as querystring parameters & request specific connection settings.
+ public TResponse DeletePolicy(string name, DeleteEnrichPolicyRequestParameters requestParameters = null)
+ where TResponse : class, IElasticsearchResponse, new() => DoRequest(DELETE, Url($"_enrich/policy/{name:name}"), null, RequestParams(requestParameters));
+ ///DELETE on /_enrich/policy/{name} https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-delete-policy.html
+ ///The name of the enrich policy
+ ///Request specific configuration such as querystring parameters & request specific connection settings.
+ [MapsApi("enrich.delete_policy", "name")]
+ public Task DeletePolicyAsync(string name, DeleteEnrichPolicyRequestParameters requestParameters = null, CancellationToken ctx = default)
+ where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(DELETE, Url($"_enrich/policy/{name:name}"), ctx, null, RequestParams(requestParameters));
+ ///PUT on /_enrich/policy/{name}/_execute https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-execute-policy.html
+ ///The name of the enrich policy
+ ///Request specific configuration such as querystring parameters & request specific connection settings.
+ public TResponse ExecutePolicy(string name, ExecuteEnrichPolicyRequestParameters requestParameters = null)
+ where TResponse : class, IElasticsearchResponse, new() => DoRequest(PUT, Url($"_enrich/policy/{name:name}/_execute"), null, RequestParams(requestParameters));
+ ///PUT on /_enrich/policy/{name}/_execute https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-execute-policy.html
+ ///The name of the enrich policy
+ ///Request specific configuration such as querystring parameters & request specific connection settings.
+ [MapsApi("enrich.execute_policy", "name")]
+ public Task ExecutePolicyAsync(string name, ExecuteEnrichPolicyRequestParameters requestParameters = null, CancellationToken ctx = default)
+ where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(PUT, Url($"_enrich/policy/{name:name}/_execute"), ctx, null, RequestParams(requestParameters));
+ ///GET on /_enrich/policy/{name} https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-get-policy.html
+ ///A comma-separated list of enrich policy names
+ ///Request specific configuration such as querystring parameters & request specific connection settings.
+ public TResponse GetPolicy(string name, GetEnrichPolicyRequestParameters requestParameters = null)
+ where TResponse : class, IElasticsearchResponse, new() => DoRequest(GET, Url($"_enrich/policy/{name:name}"), null, RequestParams(requestParameters));
+ ///GET on /_enrich/policy/{name} https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-get-policy.html
+ ///A comma-separated list of enrich policy names
+ ///Request specific configuration such as querystring parameters & request specific connection settings.
+ [MapsApi("enrich.get_policy", "name")]
+ public Task GetPolicyAsync(string name, GetEnrichPolicyRequestParameters requestParameters = null, CancellationToken ctx = default)
+ where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(GET, Url($"_enrich/policy/{name:name}"), ctx, null, RequestParams(requestParameters));
+ ///GET on /_enrich/policy/ https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-get-policy.html
+ ///Request specific configuration such as querystring parameters & request specific connection settings.
+ public TResponse GetPolicy(GetEnrichPolicyRequestParameters requestParameters = null)
+ where TResponse : class, IElasticsearchResponse, new() => DoRequest(GET, "_enrich/policy/", null, RequestParams(requestParameters));
+ ///GET on /_enrich/policy/ https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-get-policy.html
+ ///Request specific configuration such as querystring parameters & request specific connection settings.
+ [MapsApi("enrich.get_policy", "")]
+ public Task GetPolicyAsync(GetEnrichPolicyRequestParameters requestParameters = null, CancellationToken ctx = default)
+ where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(GET, "_enrich/policy/", ctx, null, RequestParams(requestParameters));
+ ///PUT on /_enrich/policy/{name} https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-put-policy.html
+ ///The name of the enrich policy
+ ///The enrich policy to register
+ ///Request specific configuration such as querystring parameters & request specific connection settings.
+ public TResponse PutPolicy(string name, PostData body, PutEnrichPolicyRequestParameters requestParameters = null)
+ where TResponse : class, IElasticsearchResponse, new() => DoRequest(PUT, Url($"_enrich/policy/{name:name}"), body, RequestParams(requestParameters));
+ ///PUT on /_enrich/policy/{name} https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-put-policy.html
+ ///The name of the enrich policy
+ ///The enrich policy to register
+ ///Request specific configuration such as querystring parameters & request specific connection settings.
+ [MapsApi("enrich.put_policy", "name, body")]
+ public Task PutPolicyAsync(string name, PostData body, PutEnrichPolicyRequestParameters requestParameters = null, CancellationToken ctx = default)
+ where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(PUT, Url($"_enrich/policy/{name:name}"), ctx, body, RequestParams(requestParameters));
+ ///GET on /_enrich/_stats https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-stats.html
+ ///Request specific configuration such as querystring parameters & request specific connection settings.
+ public TResponse Stats(EnrichStatsRequestParameters requestParameters = null)
+ where TResponse : class, IElasticsearchResponse, new() => DoRequest(GET, "_enrich/_stats", null, RequestParams(requestParameters));
+ ///GET on /_enrich/_stats https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-stats.html
+ ///Request specific configuration such as querystring parameters & request specific connection settings.
+ [MapsApi("enrich.stats", "")]
+ public Task StatsAsync(EnrichStatsRequestParameters requestParameters = null, CancellationToken ctx = default)
+ where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(GET, "_enrich/_stats", ctx, null, RequestParams(requestParameters));
+ }
+}
\ No newline at end of file
diff --git a/src/Elasticsearch.Net/ElasticLowLevelClient.NoNamespace.cs b/src/Elasticsearch.Net/ElasticLowLevelClient.NoNamespace.cs
index 4c63957d28d..34ed62f6d6d 100644
--- a/src/Elasticsearch.Net/ElasticLowLevelClient.NoNamespace.cs
+++ b/src/Elasticsearch.Net/ElasticLowLevelClient.NoNamespace.cs
@@ -26,6 +26,7 @@
using Elasticsearch.Net.Specification.CatApi;
using Elasticsearch.Net.Specification.ClusterApi;
using Elasticsearch.Net.Specification.CrossClusterReplicationApi;
+using Elasticsearch.Net.Specification.EnrichApi;
using Elasticsearch.Net.Specification.GraphApi;
using Elasticsearch.Net.Specification.IndexLifecycleManagementApi;
using Elasticsearch.Net.Specification.IndicesApi;
@@ -71,6 +72,12 @@ public LowLevelCrossClusterReplicationNamespace CrossClusterReplication
private set;
}
+ public LowLevelEnrichNamespace Enrich
+ {
+ get;
+ private set;
+ }
+
public LowLevelGraphNamespace Graph
{
get;
@@ -172,6 +179,7 @@ partial void SetupNamespaces()
Cat = new LowLevelCatNamespace(this);
Cluster = new LowLevelClusterNamespace(this);
CrossClusterReplication = new LowLevelCrossClusterReplicationNamespace(this);
+ Enrich = new LowLevelEnrichNamespace(this);
Graph = new LowLevelGraphNamespace(this);
IndexLifecycleManagement = new LowLevelIndexLifecycleManagementNamespace(this);
Indices = new LowLevelIndicesNamespace(this);
diff --git a/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs b/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs
index 3e59975485c..b4f09d5fef7 100644
--- a/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs
+++ b/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs
@@ -26,6 +26,7 @@
using Elasticsearch.Net.Specification.CatApi;
using Elasticsearch.Net.Specification.ClusterApi;
using Elasticsearch.Net.Specification.CrossClusterReplicationApi;
+using Elasticsearch.Net.Specification.EnrichApi;
using Elasticsearch.Net.Specification.GraphApi;
using Elasticsearch.Net.Specification.IndexLifecycleManagementApi;
using Elasticsearch.Net.Specification.IndicesApi;
@@ -68,6 +69,12 @@ LowLevelCrossClusterReplicationNamespace CrossClusterReplication
get;
}
+ ///Enrich APIs
+ LowLevelEnrichNamespace Enrich
+ {
+ get;
+ }
+
///Graph APIs
LowLevelGraphNamespace Graph
{
diff --git a/src/Nest/Descriptors.Enrich.cs b/src/Nest/Descriptors.Enrich.cs
new file mode 100644
index 00000000000..1be22f8f7e8
--- /dev/null
+++ b/src/Nest/Descriptors.Enrich.cs
@@ -0,0 +1,127 @@
+// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
+// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
+// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
+// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
+// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
+// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
+// -----------------------------------------------
+//
+// This file is automatically generated
+// Please do not edit these files manually
+// Run the following in the root of the repos:
+//
+// *NIX : ./build.sh codegen
+// Windows : build.bat codegen
+//
+// -----------------------------------------------
+// ReSharper disable RedundantUsingDirective
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Linq.Expressions;
+using Elasticsearch.Net;
+using Elasticsearch.Net.Utf8Json;
+using Elasticsearch.Net.Specification.EnrichApi;
+
+// ReSharper disable RedundantBaseConstructorCall
+// ReSharper disable UnusedTypeParameter
+// ReSharper disable PartialMethodWithSinglePart
+// ReSharper disable RedundantNameQualifier
+namespace Nest
+{
+ ///Descriptor for DeletePolicy https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-delete-policy.html
+ public partial class DeleteEnrichPolicyDescriptor : RequestDescriptorBase, IDeleteEnrichPolicyRequest
+ {
+ internal override ApiUrls ApiUrls => ApiUrlsLookups.EnrichDeletePolicy;
+ ////_enrich/policy/{name}
+ ///this parameter is required
+ public DeleteEnrichPolicyDescriptor(Name name): base(r => r.Required("name", name))
+ {
+ }
+
+ ///Used for serialization purposes, making sure we have a parameterless constructor
+ [SerializationConstructor]
+ protected DeleteEnrichPolicyDescriptor(): base()
+ {
+ }
+
+ // values part of the url path
+ Name IDeleteEnrichPolicyRequest.Name => Self.RouteValues.Get("name");
+ // Request parameters
+ }
+
+ ///Descriptor for ExecutePolicy https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-execute-policy.html
+ public partial class ExecuteEnrichPolicyDescriptor : RequestDescriptorBase, IExecuteEnrichPolicyRequest
+ {
+ internal override ApiUrls ApiUrls => ApiUrlsLookups.EnrichExecutePolicy;
+ ////_enrich/policy/{name}/_execute
+ ///this parameter is required
+ public ExecuteEnrichPolicyDescriptor(Name name): base(r => r.Required("name", name))
+ {
+ }
+
+ ///Used for serialization purposes, making sure we have a parameterless constructor
+ [SerializationConstructor]
+ protected ExecuteEnrichPolicyDescriptor(): base()
+ {
+ }
+
+ // values part of the url path
+ Name IExecuteEnrichPolicyRequest.Name => Self.RouteValues.Get("name");
+ // Request parameters
+ ///Should the request should block until the execution is complete.
+ public ExecuteEnrichPolicyDescriptor WaitForCompletion(bool? waitforcompletion = true) => Qs("wait_for_completion", waitforcompletion);
+ }
+
+ ///Descriptor for GetPolicy https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-get-policy.html
+ public partial class GetEnrichPolicyDescriptor : RequestDescriptorBase, IGetEnrichPolicyRequest
+ {
+ internal override ApiUrls ApiUrls => ApiUrlsLookups.EnrichGetPolicy;
+ ////_enrich/policy/{name}
+ ///Optional, accepts null
+ public GetEnrichPolicyDescriptor(Names name): base(r => r.Optional("name", name))
+ {
+ }
+
+ ////_enrich/policy/
+ public GetEnrichPolicyDescriptor(): base()
+ {
+ }
+
+ // values part of the url path
+ Names IGetEnrichPolicyRequest.Name => Self.RouteValues.Get("name");
+ ///A comma-separated list of enrich policy names
+ public GetEnrichPolicyDescriptor Name(Names name) => Assign(name, (a, v) => a.RouteValues.Optional("name", v));
+ // Request parameters
+ }
+
+ ///Descriptor for PutPolicy https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-put-policy.html
+ public partial class PutEnrichPolicyDescriptor : RequestDescriptorBase, PutEnrichPolicyRequestParameters, IPutEnrichPolicyRequest>, IPutEnrichPolicyRequest
+ {
+ internal override ApiUrls ApiUrls => ApiUrlsLookups.EnrichPutPolicy;
+ ////_enrich/policy/{name}
+ ///this parameter is required
+ public PutEnrichPolicyDescriptor(Name name): base(r => r.Required("name", name))
+ {
+ }
+
+ ///Used for serialization purposes, making sure we have a parameterless constructor
+ [SerializationConstructor]
+ protected PutEnrichPolicyDescriptor(): base()
+ {
+ }
+
+ // values part of the url path
+ Name IPutEnrichPolicyRequest.Name => Self.RouteValues.Get("name");
+ // Request parameters
+ }
+
+ ///Descriptor for Stats https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-stats.html
+ public partial class EnrichStatsDescriptor : RequestDescriptorBase, IEnrichStatsRequest
+ {
+ internal override ApiUrls ApiUrls => ApiUrlsLookups.EnrichStats;
+ // values part of the url path
+ // Request parameters
+ }
+}
\ No newline at end of file
diff --git a/src/Nest/ElasticClient.Enrich.cs b/src/Nest/ElasticClient.Enrich.cs
new file mode 100644
index 00000000000..af2d8424f22
--- /dev/null
+++ b/src/Nest/ElasticClient.Enrich.cs
@@ -0,0 +1,162 @@
+// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
+// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
+// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
+// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
+// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
+// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
+// -----------------------------------------------
+//
+// This file is automatically generated
+// Please do not edit these files manually
+// Run the following in the root of the repos:
+//
+// *NIX : ./build.sh codegen
+// Windows : build.bat codegen
+//
+// -----------------------------------------------
+// ReSharper disable RedundantUsingDirective
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net.Specification.EnrichApi;
+
+// ReSharper disable once CheckNamespace
+// ReSharper disable RedundantTypeArgumentsOfMethod
+namespace Nest.Specification.EnrichApi
+{
+ ///
+ /// Enrich APIs.
+ /// Not intended to be instantiated directly. Use the property
+ /// on .
+ ///
+ ///
+ public class EnrichNamespace : NamespacedClientProxy
+ {
+ internal EnrichNamespace(ElasticClient client): base(client)
+ {
+ }
+
+ ///
+ /// DELETE request to the enrich.delete_policy API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-delete-policy.html
+ ///
+ public DeleteEnrichPolicyResponse DeletePolicy(Name name, Func selector = null) => DeletePolicy(selector.InvokeOrDefault(new DeleteEnrichPolicyDescriptor(name: name)));
+ ///
+ /// DELETE request to the enrich.delete_policy API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-delete-policy.html
+ ///
+ public Task DeletePolicyAsync(Name name, Func selector = null, CancellationToken ct = default) => DeletePolicyAsync(selector.InvokeOrDefault(new DeleteEnrichPolicyDescriptor(name: name)), ct);
+ ///
+ /// DELETE request to the enrich.delete_policy API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-delete-policy.html
+ ///
+ public DeleteEnrichPolicyResponse DeletePolicy(IDeleteEnrichPolicyRequest request) => DoRequest(request, request.RequestParameters);
+ ///
+ /// DELETE request to the enrich.delete_policy API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-delete-policy.html
+ ///
+ public Task DeletePolicyAsync(IDeleteEnrichPolicyRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct);
+ ///
+ /// PUT request to the enrich.execute_policy API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-execute-policy.html
+ ///
+ public ExecuteEnrichPolicyResponse ExecutePolicy(Name name, Func selector = null) => ExecutePolicy(selector.InvokeOrDefault(new ExecuteEnrichPolicyDescriptor(name: name)));
+ ///
+ /// PUT request to the enrich.execute_policy API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-execute-policy.html
+ ///
+ public Task ExecutePolicyAsync(Name name, Func selector = null, CancellationToken ct = default) => ExecutePolicyAsync(selector.InvokeOrDefault(new ExecuteEnrichPolicyDescriptor(name: name)), ct);
+ ///
+ /// PUT request to the enrich.execute_policy API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-execute-policy.html
+ ///
+ public ExecuteEnrichPolicyResponse ExecutePolicy(IExecuteEnrichPolicyRequest request) => DoRequest(request, request.RequestParameters);
+ ///
+ /// PUT request to the enrich.execute_policy API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-execute-policy.html
+ ///
+ public Task ExecutePolicyAsync(IExecuteEnrichPolicyRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct);
+ ///
+ /// GET request to the enrich.get_policy API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-get-policy.html
+ ///
+ public GetEnrichPolicyResponse GetPolicy(Names name = null, Func selector = null) => GetPolicy(selector.InvokeOrDefault(new GetEnrichPolicyDescriptor().Name(name: name)));
+ ///
+ /// GET request to the enrich.get_policy API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-get-policy.html
+ ///
+ public Task GetPolicyAsync(Names name = null, Func selector = null, CancellationToken ct = default) => GetPolicyAsync(selector.InvokeOrDefault(new GetEnrichPolicyDescriptor().Name(name: name)), ct);
+ ///
+ /// GET request to the enrich.get_policy API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-get-policy.html
+ ///
+ public GetEnrichPolicyResponse GetPolicy(IGetEnrichPolicyRequest request) => DoRequest(request, request.RequestParameters);
+ ///
+ /// GET request to the enrich.get_policy API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-get-policy.html
+ ///
+ public Task GetPolicyAsync(IGetEnrichPolicyRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct);
+ ///
+ /// PUT request to the enrich.put_policy API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-put-policy.html
+ ///
+ public PutEnrichPolicyResponse PutPolicy(Name name, Func, IPutEnrichPolicyRequest> selector)
+ where TDocument : class => PutPolicy(selector.InvokeOrDefault(new PutEnrichPolicyDescriptor(name: name)));
+ ///
+ /// PUT request to the enrich.put_policy API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-put-policy.html
+ ///
+ public Task PutPolicyAsync(Name name, Func, IPutEnrichPolicyRequest> selector, CancellationToken ct = default)
+ where TDocument : class => PutPolicyAsync(selector.InvokeOrDefault(new PutEnrichPolicyDescriptor(name: name)), ct);
+ ///
+ /// PUT request to the enrich.put_policy API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-put-policy.html
+ ///
+ public PutEnrichPolicyResponse PutPolicy(IPutEnrichPolicyRequest request) => DoRequest(request, request.RequestParameters);
+ ///
+ /// PUT request to the enrich.put_policy API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-put-policy.html
+ ///
+ public Task PutPolicyAsync(IPutEnrichPolicyRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct);
+ ///
+ /// GET request to the enrich.stats API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-stats.html
+ ///
+ public EnrichStatsResponse Stats(Func selector = null) => Stats(selector.InvokeOrDefault(new EnrichStatsDescriptor()));
+ ///
+ /// GET request to the enrich.stats API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-stats.html
+ ///
+ public Task StatsAsync(Func selector = null, CancellationToken ct = default) => StatsAsync(selector.InvokeOrDefault(new EnrichStatsDescriptor()), ct);
+ ///
+ /// GET request to the enrich.stats API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-stats.html
+ ///
+ public EnrichStatsResponse Stats(IEnrichStatsRequest request) => DoRequest(request, request.RequestParameters);
+ ///
+ /// GET request to the enrich.stats API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-stats.html
+ ///
+ public Task StatsAsync(IEnrichStatsRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct);
+ }
+}
\ No newline at end of file
diff --git a/src/Nest/ElasticClient.NoNamespace.cs b/src/Nest/ElasticClient.NoNamespace.cs
index 603d45bcdf8..85f8b2d4dc5 100644
--- a/src/Nest/ElasticClient.NoNamespace.cs
+++ b/src/Nest/ElasticClient.NoNamespace.cs
@@ -22,6 +22,7 @@
using Nest.Specification.CatApi;
using Nest.Specification.ClusterApi;
using Nest.Specification.CrossClusterReplicationApi;
+using Nest.Specification.EnrichApi;
using Nest.Specification.GraphApi;
using Nest.Specification.IndexLifecycleManagementApi;
using Nest.Specification.IndicesApi;
@@ -68,6 +69,13 @@ public CrossClusterReplicationNamespace CrossClusterReplication
private set;
}
+ ///Enrich APIs
+ public EnrichNamespace Enrich
+ {
+ get;
+ private set;
+ }
+
///Graph APIs
public GraphNamespace Graph
{
@@ -185,6 +193,7 @@ partial void SetupNamespaces()
Cat = new CatNamespace(this);
Cluster = new ClusterNamespace(this);
CrossClusterReplication = new CrossClusterReplicationNamespace(this);
+ Enrich = new EnrichNamespace(this);
Graph = new GraphNamespace(this);
IndexLifecycleManagement = new IndexLifecycleManagementNamespace(this);
Indices = new IndicesNamespace(this);
diff --git a/src/Nest/IElasticClient.Generated.cs b/src/Nest/IElasticClient.Generated.cs
index cdc9bf3a4fb..4fb484d0ba4 100644
--- a/src/Nest/IElasticClient.Generated.cs
+++ b/src/Nest/IElasticClient.Generated.cs
@@ -24,6 +24,7 @@
using Nest.Specification.CatApi;
using Nest.Specification.ClusterApi;
using Nest.Specification.CrossClusterReplicationApi;
+using Nest.Specification.EnrichApi;
using Nest.Specification.GraphApi;
using Nest.Specification.IndexLifecycleManagementApi;
using Nest.Specification.IndicesApi;
@@ -66,6 +67,12 @@ CrossClusterReplicationNamespace CrossClusterReplication
get;
}
+ ///Enrich APIs
+ EnrichNamespace Enrich
+ {
+ get;
+ }
+
///Graph APIs
GraphNamespace Graph
{
diff --git a/src/Nest/Ingest/ProcessorFormatter.cs b/src/Nest/Ingest/ProcessorFormatter.cs
index 7cc498310f2..11f03e37e71 100644
--- a/src/Nest/Ingest/ProcessorFormatter.cs
+++ b/src/Nest/Ingest/ProcessorFormatter.cs
@@ -40,6 +40,7 @@ internal class ProcessorFormatter : IJsonFormatter
{ "pipeline", 28 },
{ "drop", 29 },
{ "circle", 30 },
+ { "enrich", 31 },
};
public IProcessor Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver)
@@ -153,6 +154,9 @@ public IProcessor Deserialize(ref JsonReader reader, IJsonFormatterResolver form
case 30:
processor = Deserialize(ref reader, formatterResolver);
break;
+ case 31:
+ processor = Deserialize(ref reader, formatterResolver);
+ break;
}
}
else
@@ -192,6 +196,9 @@ public void Serialize(ref JsonWriter writer, IProcessor value, IJsonFormatterRes
case "dot_expander":
Serialize(ref writer, value, formatterResolver);
break;
+ case "enrich":
+ Serialize(ref writer, value, formatterResolver);
+ break;
case "fail":
Serialize(ref writer, value, formatterResolver);
break;
diff --git a/src/Nest/Ingest/Processors/EnrichProcessor.cs b/src/Nest/Ingest/Processors/EnrichProcessor.cs
new file mode 100644
index 00000000000..6a53a1ba418
--- /dev/null
+++ b/src/Nest/Ingest/Processors/EnrichProcessor.cs
@@ -0,0 +1,139 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Runtime.Serialization;
+using Elasticsearch.Net.Utf8Json;
+
+namespace Nest
+{
+ ///
+ /// The enrich processor can enrich documents with data from another index.
+ ///
+ [InterfaceDataContract]
+ public interface IEnrichProcessor : IProcessor
+ {
+ ///
+ /// The field in the input document that matches the policies match_field used to retrieve the enrichment data.
+ ///
+ [DataMember(Name = "field")]
+ Field Field { get; set; }
+
+ ///
+ /// The name of the enrich policy to use.
+ ///
+ [DataMember(Name = "policy_name")]
+ string PolicyName { get; set; }
+
+ ///
+ /// Field added to incoming documents to contain enrich data. This field contains both the match_field and enrich_fields specified
+ /// in the enrich policy.
+ ///
+ [DataMember(Name = "target_field")]
+ Field TargetField { get; set; }
+
+ ///
+ /// If true and does not exist, the processor quietly exits without modifying the document
+ ///
+ [DataMember(Name = "ignore_missing")]
+ bool? IgnoreMissing { get; set; }
+
+ ///
+ /// If processor will update fields with pre-existing non-null-valued field. When set to false, such fields will not be touched.
+ ///
+ [DataMember(Name = "override")]
+ bool? Override { get; set; }
+
+ ///
+ /// The maximum number of matched documents to include under the configured . The will be turned into a
+ /// json array if max_matches is higher than 1, otherwise target_field will become a json object. In order to avoid documents getting
+ /// too large, the maximum allowed value is 128.
+ ///
+ [DataMember(Name = "max_matches")]
+ int? MaxMatches { get; set; }
+
+ ///
+ /// A spatial relation operator used to match the geo_shape of incoming documents to documents in the enrich index.
+ /// This option is only used for geo_match enrich policy types. The geo_shape strategy mapping parameter determines which spatial
+ /// relation operators are available.
+ ///
+ [DataMember(Name = "shape_relation")]
+ GeoShapeRelation? ShapeRelation { get; set; }
+ }
+
+ ///
+ public class EnrichProcessor : ProcessorBase, IEnrichProcessor
+ {
+ ///
+ public Field Field { get; set; }
+
+ ///
+ public string PolicyName { get; set; }
+
+ ///
+ public Field TargetField { get; set; }
+
+ ///
+ public bool? IgnoreMissing { get; set; }
+
+ ///
+ public bool? Override { get; set; }
+
+ ///
+ public int? MaxMatches { get; set; }
+
+ ///
+ public GeoShapeRelation? ShapeRelation { get; set; }
+
+ protected override string Name => "enrich";
+ }
+
+ ///
+ public class EnrichProcessorDescriptor : ProcessorDescriptorBase, IEnrichProcessor>, IEnrichProcessor
+ where T : class
+ {
+ protected override string Name => "enrich";
+ Field IEnrichProcessor.Field { get; set; }
+ Field IEnrichProcessor.TargetField { get; set; }
+ string IEnrichProcessor.PolicyName { get; set; }
+ bool? IEnrichProcessor.IgnoreMissing { get; set; }
+ bool? IEnrichProcessor.Override { get; set; }
+ int? IEnrichProcessor.MaxMatches { get; set; }
+ GeoShapeRelation? IEnrichProcessor.ShapeRelation { get; set; }
+
+ ///
+ public EnrichProcessorDescriptor Field(Field field) => Assign(field, (a, v) => a.Field = v);
+
+ ///
+ public EnrichProcessorDescriptor Field(Expression> objectPath) =>
+ Assign(objectPath, (a, v) => a.Field = v);
+
+ ///
+ public EnrichProcessorDescriptor PolicyName(string policyName) =>
+ Assign(policyName, (a, v) => a.PolicyName = v);
+
+ ///
+ public EnrichProcessorDescriptor TargetField(Field field) => Assign(field, (a, v) => a.TargetField = v);
+
+ ///
+ public EnrichProcessorDescriptor TargetField(Expression> objectPath) =>
+ Assign(objectPath, (a, v) => a.TargetField = v);
+
+ ///
+ public EnrichProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) =>
+ Assign(ignoreMissing, (a, v) => a.IgnoreMissing = v);
+
+ ///
+ public EnrichProcessorDescriptor Override(bool? @override = true) =>
+ Assign(@override, (a, v) => a.Override = v);
+
+ ///
+ public EnrichProcessorDescriptor MaxMatches(int? maxMatches) =>
+ Assign(maxMatches, (a, v) => a.MaxMatches = v);
+
+ ///
+ public EnrichProcessorDescriptor ShapeRelation(GeoShapeRelation? relation) =>
+ Assign(relation, (a, v) => a.ShapeRelation = v);
+ }
+}
diff --git a/src/Nest/Ingest/ProcessorsDescriptor.cs b/src/Nest/Ingest/ProcessorsDescriptor.cs
index d0ba1098eb7..d9213e71aa9 100644
--- a/src/Nest/Ingest/ProcessorsDescriptor.cs
+++ b/src/Nest/Ingest/ProcessorsDescriptor.cs
@@ -18,12 +18,15 @@ public ProcessorsDescriptor() : base(new List()) { }
public ProcessorsDescriptor Attachment(Func, IAttachmentProcessor> selector) where T : class =>
Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new AttachmentProcessorDescriptor())));
+ ///
public ProcessorsDescriptor Append(Func, IAppendProcessor> selector) where T : class =>
Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new AppendProcessorDescriptor())));
+ ///
public ProcessorsDescriptor Convert(Func, IConvertProcessor> selector) where T : class =>
Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new ConvertProcessorDescriptor())));
+ ///
public ProcessorsDescriptor Date(Func, IDateProcessor> selector) where T : class =>
Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new DateProcessorDescriptor())));
@@ -42,6 +45,11 @@ public ProcessorsDescriptor DateIndexName(Func(Func, IDotExpanderProcessor> selector) where T : class =>
Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new DotExpanderProcessorDescriptor())));
+ ///
+ public ProcessorsDescriptor Enrich(Func, IEnrichProcessor> selector) where T : class =>
+ Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new EnrichProcessorDescriptor())));
+
+ ///
public ProcessorsDescriptor Fail(Func selector) =>
Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new FailProcessorDescriptor())));
@@ -66,16 +74,19 @@ public ProcessorsDescriptor Grok(Func, IGrokProces
public ProcessorsDescriptor Gsub(Func, IGsubProcessor> selector) where T : class =>
Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new GsubProcessorDescriptor())));
-
+ ///
public ProcessorsDescriptor Join(Func, IJoinProcessor> selector) where T : class =>
Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new JoinProcessorDescriptor())));
+ ///
public ProcessorsDescriptor Lowercase(Func, ILowercaseProcessor> selector) where T : class =>
Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new LowercaseProcessorDescriptor())));
+ ///
public ProcessorsDescriptor Remove(Func, IRemoveProcessor> selector) where T : class =>
Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new RemoveProcessorDescriptor())));
+ ///
public ProcessorsDescriptor Rename(Func, IRenameProcessor> selector) where T : class =>
Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new RenameProcessorDescriptor())));
@@ -96,13 +107,15 @@ public ProcessorsDescriptor Set(Func, ISetProcessor
public ProcessorsDescriptor Sort(Func, ISortProcessor> selector) where T : class =>
Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new SortProcessorDescriptor())));
+ ///
public ProcessorsDescriptor Split(Func, ISplitProcessor> selector) where T : class =>
Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new SplitProcessorDescriptor())));
-
+ ///
public ProcessorsDescriptor Trim(Func, ITrimProcessor> selector) where T : class =>
Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new TrimProcessorDescriptor())));
+ ///
public ProcessorsDescriptor Uppercase(Func, IUppercaseProcessor> selector) where T : class =>
Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new UppercaseProcessorDescriptor())));
@@ -128,9 +141,7 @@ public ProcessorsDescriptor UserAgent(Func, I
public ProcessorsDescriptor Kv(Func, IKeyValueProcessor> selector) where T : class =>
Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new KeyValueProcessorDescriptor())));
- ///
- /// URL-decodes a string
- ///
+ ///
public ProcessorsDescriptor UrlDecode(Func, IUrlDecodeProcessor> selector) where T : class =>
Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new UrlDecodeProcessorDescriptor())));
diff --git a/src/Nest/Requests.Enrich.cs b/src/Nest/Requests.Enrich.cs
new file mode 100644
index 00000000000..5b16155ac81
--- /dev/null
+++ b/src/Nest/Requests.Enrich.cs
@@ -0,0 +1,184 @@
+// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
+// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
+// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
+// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
+// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
+// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
+// -----------------------------------------------
+//
+// This file is automatically generated
+// Please do not edit these files manually
+// Run the following in the root of the repos:
+//
+// *NIX : ./build.sh codegen
+// Windows : build.bat codegen
+//
+// -----------------------------------------------
+// ReSharper disable RedundantUsingDirective
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Linq.Expressions;
+using System.Runtime.Serialization;
+using Elasticsearch.Net;
+using Elasticsearch.Net.Utf8Json;
+using Elasticsearch.Net.Specification.EnrichApi;
+
+// ReSharper disable RedundantBaseConstructorCall
+// ReSharper disable UnusedTypeParameter
+// ReSharper disable PartialMethodWithSinglePart
+// ReSharper disable RedundantNameQualifier
+namespace Nest
+{
+ [InterfaceDataContract]
+ public partial interface IDeleteEnrichPolicyRequest : IRequest
+ {
+ [IgnoreDataMember]
+ Name Name
+ {
+ get;
+ }
+ }
+
+ ///Request for DeletePolicy https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-delete-policy.html
+ public partial class DeleteEnrichPolicyRequest : PlainRequestBase, IDeleteEnrichPolicyRequest
+ {
+ protected IDeleteEnrichPolicyRequest Self => this;
+ internal override ApiUrls ApiUrls => ApiUrlsLookups.EnrichDeletePolicy;
+ ////_enrich/policy/{name}
+ ///this parameter is required
+ public DeleteEnrichPolicyRequest(Name name): base(r => r.Required("name", name))
+ {
+ }
+
+ ///Used for serialization purposes, making sure we have a parameterless constructor
+ [SerializationConstructor]
+ protected DeleteEnrichPolicyRequest(): base()
+ {
+ }
+
+ // values part of the url path
+ [IgnoreDataMember]
+ Name IDeleteEnrichPolicyRequest.Name => Self.RouteValues.Get("name");
+ // Request parameters
+ }
+
+ [InterfaceDataContract]
+ public partial interface IExecuteEnrichPolicyRequest : IRequest
+ {
+ [IgnoreDataMember]
+ Name Name
+ {
+ get;
+ }
+ }
+
+ ///Request for ExecutePolicy https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-execute-policy.html
+ public partial class ExecuteEnrichPolicyRequest : PlainRequestBase, IExecuteEnrichPolicyRequest
+ {
+ protected IExecuteEnrichPolicyRequest Self => this;
+ internal override ApiUrls ApiUrls => ApiUrlsLookups.EnrichExecutePolicy;
+ ////_enrich/policy/{name}/_execute
+ ///this parameter is required
+ public ExecuteEnrichPolicyRequest(Name name): base(r => r.Required("name", name))
+ {
+ }
+
+ ///Used for serialization purposes, making sure we have a parameterless constructor
+ [SerializationConstructor]
+ protected ExecuteEnrichPolicyRequest(): base()
+ {
+ }
+
+ // values part of the url path
+ [IgnoreDataMember]
+ Name IExecuteEnrichPolicyRequest.Name => Self.RouteValues.Get("name");
+ // Request parameters
+ ///Should the request should block until the execution is complete.
+ public bool? WaitForCompletion
+ {
+ get => Q("wait_for_completion");
+ set => Q("wait_for_completion", value);
+ }
+ }
+
+ [InterfaceDataContract]
+ public partial interface IGetEnrichPolicyRequest : IRequest
+ {
+ [IgnoreDataMember]
+ Names Name
+ {
+ get;
+ }
+ }
+
+ ///Request for GetPolicy https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-get-policy.html
+ public partial class GetEnrichPolicyRequest : PlainRequestBase, IGetEnrichPolicyRequest
+ {
+ protected IGetEnrichPolicyRequest Self => this;
+ internal override ApiUrls ApiUrls => ApiUrlsLookups.EnrichGetPolicy;
+ ////_enrich/policy/{name}
+ ///Optional, accepts null
+ public GetEnrichPolicyRequest(Names name): base(r => r.Optional("name", name))
+ {
+ }
+
+ ////_enrich/policy/
+ public GetEnrichPolicyRequest(): base()
+ {
+ }
+
+ // values part of the url path
+ [IgnoreDataMember]
+ Names IGetEnrichPolicyRequest.Name => Self.RouteValues.Get("name");
+ // Request parameters
+ }
+
+ [InterfaceDataContract]
+ public partial interface IPutEnrichPolicyRequest : IRequest
+ {
+ [IgnoreDataMember]
+ Name Name
+ {
+ get;
+ }
+ }
+
+ ///Request for PutPolicy https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-put-policy.html
+ public partial class PutEnrichPolicyRequest : PlainRequestBase, IPutEnrichPolicyRequest
+ {
+ protected IPutEnrichPolicyRequest Self => this;
+ internal override ApiUrls ApiUrls => ApiUrlsLookups.EnrichPutPolicy;
+ ////_enrich/policy/{name}
+ ///this parameter is required
+ public PutEnrichPolicyRequest(Name name): base(r => r.Required("name", name))
+ {
+ }
+
+ ///Used for serialization purposes, making sure we have a parameterless constructor
+ [SerializationConstructor]
+ protected PutEnrichPolicyRequest(): base()
+ {
+ }
+
+ // values part of the url path
+ [IgnoreDataMember]
+ Name IPutEnrichPolicyRequest.Name => Self.RouteValues.Get("name");
+ // Request parameters
+ }
+
+ [InterfaceDataContract]
+ public partial interface IEnrichStatsRequest : IRequest
+ {
+ }
+
+ ///Request for Stats https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-stats.html
+ public partial class EnrichStatsRequest : PlainRequestBase, IEnrichStatsRequest
+ {
+ protected IEnrichStatsRequest Self => this;
+ internal override ApiUrls ApiUrls => ApiUrlsLookups.EnrichStats;
+ // values part of the url path
+ // Request parameters
+ }
+}
\ No newline at end of file
diff --git a/src/Nest/Requests.cs b/src/Nest/Requests.cs
index 0efff1fed5b..53889d6a062 100644
--- a/src/Nest/Requests.cs
+++ b/src/Nest/Requests.cs
@@ -26,6 +26,7 @@
using Elasticsearch.Net.Specification.CatApi;
using Elasticsearch.Net.Specification.ClusterApi;
using Elasticsearch.Net.Specification.CrossClusterReplicationApi;
+using Elasticsearch.Net.Specification.EnrichApi;
using Elasticsearch.Net.Specification.GraphApi;
using Elasticsearch.Net.Specification.IndexLifecycleManagementApi;
using Elasticsearch.Net.Specification.IndicesApi;
diff --git a/src/Nest/XPack/Enrich/DeletePolicy/DeleteEnrichPolicyRequest.cs b/src/Nest/XPack/Enrich/DeletePolicy/DeleteEnrichPolicyRequest.cs
new file mode 100644
index 00000000000..3a5a519aa3b
--- /dev/null
+++ b/src/Nest/XPack/Enrich/DeletePolicy/DeleteEnrichPolicyRequest.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace Nest
+{
+ ///
+ /// Deletes an enrich policy
+ ///
+ [MapsApi("enrich.delete_policy")]
+ [ReadAs(typeof(DeleteEnrichPolicyRequest))]
+ public partial interface IDeleteEnrichPolicyRequest
+ {
+ }
+
+ ///
+ public partial class DeleteEnrichPolicyRequest : IDeleteEnrichPolicyRequest
+ {
+ }
+
+ ///
+ public partial class DeleteEnrichPolicyDescriptor
+ {
+ }
+}
diff --git a/src/Nest/XPack/Enrich/DeletePolicy/DeleteEnrichPolicyResponse.cs b/src/Nest/XPack/Enrich/DeletePolicy/DeleteEnrichPolicyResponse.cs
new file mode 100644
index 00000000000..ab38b7b90da
--- /dev/null
+++ b/src/Nest/XPack/Enrich/DeletePolicy/DeleteEnrichPolicyResponse.cs
@@ -0,0 +1,4 @@
+namespace Nest
+{
+ public class DeleteEnrichPolicyResponse : AcknowledgedResponseBase { }
+}
diff --git a/src/Nest/XPack/Enrich/EnrichPolicy.cs b/src/Nest/XPack/Enrich/EnrichPolicy.cs
new file mode 100644
index 00000000000..1fe6bbd542c
--- /dev/null
+++ b/src/Nest/XPack/Enrich/EnrichPolicy.cs
@@ -0,0 +1,87 @@
+using System;
+using System.Linq.Expressions;
+using System.Runtime.Serialization;
+using Elasticsearch.Net.Utf8Json;
+
+namespace Nest
+{
+ ///
+ /// An enrich policy
+ ///
+ [InterfaceDataContract]
+ [ReadAs(typeof(EnrichPolicy))]
+ public interface IEnrichPolicy
+ {
+ ///
+ /// Source indices used to create the enrich index.
+ /// If multiple indices are provided, they must share a common , which the enrich processor can use
+ /// to match incoming documents.
+ ///
+ [DataMember(Name = "indices")]
+ [JsonFormatter(typeof(IndicesFormatter))]
+ Indices Indices { get; set; }
+
+ ///
+ /// Field in the source indices used to match incoming documents.
+ ///
+ [DataMember(Name = "match_field")]
+ Field MatchField { get; set; }
+
+ ///
+ /// Fields to add to matching incoming documents. These fields must be present in the source indices.
+ ///
+ [DataMember(Name = "enrich_fields")]
+ Fields EnrichFields { get; set; }
+
+ ///
+ /// Query type used to filter documents in the enrich index for matching.
+ ///
+ [DataMember(Name = "query")]
+ string Query { get; set; }
+ }
+
+
+ ///
+ [DataContract]
+ public class EnrichPolicy : IEnrichPolicy
+ {
+ ///
+ public Indices Indices { get; set; }
+
+ ///
+ public Field MatchField { get; set; }
+
+ ///
+ public Fields EnrichFields { get; set; }
+
+ ///
+ public string Query { get; set; }
+ }
+
+ public class EnrichPolicyDescriptor : DescriptorBase, IEnrichPolicy>, IEnrichPolicy where TDocument : class
+ {
+ Indices IEnrichPolicy.Indices { get; set; }
+ Field IEnrichPolicy.MatchField { get; set; }
+ Fields IEnrichPolicy.EnrichFields { get; set; }
+ string IEnrichPolicy.Query { get; set; }
+
+ ///
+ public EnrichPolicyDescriptor Indices(Indices indices) => Assign(indices, (a, v) => a.Indices = v);
+
+ ///
+ public EnrichPolicyDescriptor MatchField(Field matchField) => Assign(matchField, (a, v) => a.MatchField = v);
+
+ ///
+ public EnrichPolicyDescriptor MatchField(Expression> objectPath) => Assign(objectPath, (a, v) => a.MatchField = v);
+
+ ///
+ public EnrichPolicyDescriptor EnrichFields(Fields enrichFields) => Assign(enrichFields, (a, v) => a.EnrichFields = v);
+
+ ///
+ public EnrichPolicyDescriptor EnrichFields(Func, IPromise> fields) =>
+ Assign(fields, (a, v) => a.EnrichFields = v?.Invoke(new FieldsDescriptor())?.Value);
+
+ ///
+ public EnrichPolicyDescriptor Query(string query) => Assign(query, (a, v) => a.Query = v);
+ }
+}
diff --git a/src/Nest/XPack/Enrich/ExecutePolicy/ExecuteEnrichPolicyRequest.cs b/src/Nest/XPack/Enrich/ExecutePolicy/ExecuteEnrichPolicyRequest.cs
new file mode 100644
index 00000000000..05fede7106e
--- /dev/null
+++ b/src/Nest/XPack/Enrich/ExecutePolicy/ExecuteEnrichPolicyRequest.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace Nest
+{
+ ///
+ /// Executes an enrich policy
+ ///
+ [MapsApi("enrich.execute_policy")]
+ [ReadAs(typeof(ExecuteEnrichPolicyRequest))]
+ public partial interface IExecuteEnrichPolicyRequest
+ {
+ }
+
+ ///
+ public partial class ExecuteEnrichPolicyRequest : IExecuteEnrichPolicyRequest
+ {
+ }
+
+ ///
+ public partial class ExecuteEnrichPolicyDescriptor
+ {
+ }
+}
diff --git a/src/Nest/XPack/Enrich/ExecutePolicy/ExecuteEnrichPolicyResponse.cs b/src/Nest/XPack/Enrich/ExecutePolicy/ExecuteEnrichPolicyResponse.cs
new file mode 100644
index 00000000000..b3963ab16ab
--- /dev/null
+++ b/src/Nest/XPack/Enrich/ExecutePolicy/ExecuteEnrichPolicyResponse.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Runtime.Serialization;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+ public class ExecuteEnrichPolicyResponse : ResponseBase
+ {
+ [DataMember(Name = "task_id")]
+ public TaskId TaskId { get; internal set; }
+
+ [DataMember(Name = "status")]
+ public ExecuteEnrichPolicyStatus Status { get; internal set; }
+ }
+
+ public class ExecuteEnrichPolicyStatus
+ {
+ [DataMember(Name = "phase")]
+ public EnrichPolicyPhase Phase { get; internal set; }
+ }
+
+ [StringEnum]
+ public enum EnrichPolicyPhase
+ {
+ [EnumMember(Value = "SCHEDULED")]
+ Scheduled,
+ [EnumMember(Value = "RUNNING")]
+ Running,
+ [EnumMember(Value = "COMPLETE")]
+ Complete,
+ [EnumMember(Value = "FAILED")]
+ Failed
+ }
+}
diff --git a/src/Nest/XPack/Enrich/GetPolicy/GetEnrichPolicyRequest.cs b/src/Nest/XPack/Enrich/GetPolicy/GetEnrichPolicyRequest.cs
new file mode 100644
index 00000000000..4d5d17688a8
--- /dev/null
+++ b/src/Nest/XPack/Enrich/GetPolicy/GetEnrichPolicyRequest.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace Nest
+{
+ ///
+ /// Gets one or more enrich policies
+ ///
+ [MapsApi("enrich.get_policy")]
+ [ReadAs(typeof(GetEnrichPolicyRequest))]
+ public partial interface IGetEnrichPolicyRequest
+ {
+ }
+
+ ///
+ public partial class GetEnrichPolicyRequest : IGetEnrichPolicyRequest
+ {
+ }
+
+ ///
+ public partial class GetEnrichPolicyDescriptor
+ {
+ }
+}
diff --git a/src/Nest/XPack/Enrich/GetPolicy/GetEnrichPolicyResponse.cs b/src/Nest/XPack/Enrich/GetPolicy/GetEnrichPolicyResponse.cs
new file mode 100644
index 00000000000..312163325f2
--- /dev/null
+++ b/src/Nest/XPack/Enrich/GetPolicy/GetEnrichPolicyResponse.cs
@@ -0,0 +1,12 @@
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+ public class GetEnrichPolicyResponse : ResponseBase
+ {
+ [DataMember(Name = "policies")]
+ public IReadOnlyCollection Policies { get; internal set; } = EmptyReadOnly.Collection;
+ }
+}
diff --git a/src/Nest/XPack/Enrich/NamedPolicy.cs b/src/Nest/XPack/Enrich/NamedPolicy.cs
new file mode 100644
index 00000000000..608dd9c716a
--- /dev/null
+++ b/src/Nest/XPack/Enrich/NamedPolicy.cs
@@ -0,0 +1,25 @@
+using System.Runtime.Serialization;
+
+namespace Nest
+{
+ public class NamedPolicy : EnrichPolicy
+ {
+ [DataMember(Name = "name")]
+ public string Name { get; set; }
+ }
+
+ public class NamedPolicyMetadata
+ {
+ [DataMember(Name = "config")]
+ public NamedPolicyConfig Config { get; internal set; }
+ }
+
+ public class NamedPolicyConfig
+ {
+ [DataMember(Name = "geo_match")]
+ public NamedPolicy GeoMatch { get; internal set; }
+
+ [DataMember(Name = "match")]
+ public NamedPolicy Match { get; internal set; }
+ }
+}
diff --git a/src/Nest/XPack/Enrich/PutPolicy/PutEnrichPolicyRequest.cs b/src/Nest/XPack/Enrich/PutPolicy/PutEnrichPolicyRequest.cs
new file mode 100644
index 00000000000..05cf34a28f8
--- /dev/null
+++ b/src/Nest/XPack/Enrich/PutPolicy/PutEnrichPolicyRequest.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace Nest
+{
+ ///
+ /// Creates an enrich policy
+ ///
+ [MapsApi("enrich.put_policy")]
+ [ReadAs(typeof(PutEnrichPolicyRequest))]
+ public partial interface IPutEnrichPolicyRequest
+ {
+ ///
+ /// Matches enrich data to incoming documents based on a precise value, such as an email address or ID, using a term query.
+ ///
+ [DataMember(Name = "match")]
+ IEnrichPolicy Match { get; set; }
+
+ ///
+ /// Matches enrich data to incoming documents based on a geographic location using a geo_shape query.
+ ///
+ [DataMember(Name = "geo_match")]
+ IEnrichPolicy GeoMatch { get; set; }
+ }
+
+ ///
+ public partial class PutEnrichPolicyRequest
+ {
+ ///
+ public IEnrichPolicy Match { get; set; }
+ ///
+ public IEnrichPolicy GeoMatch { get; set; }
+ }
+
+ ///
+ public partial class PutEnrichPolicyDescriptor where TDocument : class
+ {
+ IEnrichPolicy IPutEnrichPolicyRequest.GeoMatch { get; set; }
+ IEnrichPolicy IPutEnrichPolicyRequest.Match { get; set; }
+
+ public PutEnrichPolicyDescriptor Match(Func, IEnrichPolicy> selector) =>
+ Assign(selector?.Invoke(new EnrichPolicyDescriptor()), (a, v) => a.Match = v);
+
+ public PutEnrichPolicyDescriptor GeoMatch(Func, IEnrichPolicy> selector) =>
+ Assign(selector?.Invoke(new EnrichPolicyDescriptor()), (a, v) => a.GeoMatch = v);
+ }
+}
diff --git a/src/Nest/XPack/Enrich/PutPolicy/PutEnrichPolicyResponse.cs b/src/Nest/XPack/Enrich/PutPolicy/PutEnrichPolicyResponse.cs
new file mode 100644
index 00000000000..fe73ab3bcf2
--- /dev/null
+++ b/src/Nest/XPack/Enrich/PutPolicy/PutEnrichPolicyResponse.cs
@@ -0,0 +1,4 @@
+namespace Nest
+{
+ public class PutEnrichPolicyResponse : AcknowledgedResponseBase { }
+}
diff --git a/src/Nest/XPack/Enrich/Stats/EnrichStatsRequest.cs b/src/Nest/XPack/Enrich/Stats/EnrichStatsRequest.cs
new file mode 100644
index 00000000000..bfd48762bd6
--- /dev/null
+++ b/src/Nest/XPack/Enrich/Stats/EnrichStatsRequest.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace Nest
+{
+ ///
+ /// A request to get statistics about enrich
+ ///
+ [MapsApi("enrich.stats")]
+ [ReadAs(typeof(EnrichStatsRequest))]
+ public partial interface IEnrichStatsRequest
+ {
+ }
+
+ ///
+ public partial class EnrichStatsRequest : IEnrichStatsRequest
+ {
+ }
+
+ ///
+ public partial class EnrichStatsDescriptor
+ {
+ }
+}
diff --git a/src/Nest/XPack/Enrich/Stats/EnrichStatsResponse.cs b/src/Nest/XPack/Enrich/Stats/EnrichStatsResponse.cs
new file mode 100644
index 00000000000..4324cd45a53
--- /dev/null
+++ b/src/Nest/XPack/Enrich/Stats/EnrichStatsResponse.cs
@@ -0,0 +1,42 @@
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+ public class EnrichStatsResponse : ResponseBase
+ {
+ [DataMember(Name = "executing_policies")]
+ public IReadOnlyCollection ExecutingPolicies { get; internal set; } = EmptyReadOnly.Collection;
+
+ [DataMember(Name = "coordinator_stats")]
+ public IReadOnlyCollection CoordinatorStats { get; internal set; } = EmptyReadOnly.Collection;
+ }
+
+ public class ExecutingPolicy
+ {
+ [DataMember(Name = "name")]
+ public string Name { get; internal set; }
+
+ [DataMember(Name = "task")]
+ public TaskInfo Task { get; internal set; }
+ }
+
+ public class CoordinatorStats
+ {
+ [DataMember(Name = "node_id")]
+ public string NodeId { get; internal set; }
+
+ [DataMember(Name = "queue_size")]
+ public int QueueSize { get; internal set; }
+
+ [DataMember(Name = "remote_requests_current")]
+ public int RemoteRequestsCurrent { get; internal set; }
+
+ [DataMember(Name = "remote_requests_total")]
+ public long RemoteRequestsTotal { get; internal set; }
+
+ [DataMember(Name = "executed_searches_total")]
+ public long ExecutedSearchesTotal { get; internal set; }
+ }
+}
diff --git a/src/Nest/XPack/Info/XPackInfo/XPackInfoResponse.cs b/src/Nest/XPack/Info/XPackInfo/XPackInfoResponse.cs
index cae00a5a98c..83d186a73d7 100644
--- a/src/Nest/XPack/Info/XPackInfo/XPackInfoResponse.cs
+++ b/src/Nest/XPack/Info/XPackInfo/XPackInfoResponse.cs
@@ -44,15 +44,25 @@ public class MinimalLicenseInformation
public class XPackFeatures
{
+ [DataMember(Name = "analytics")]
+ public XPackFeature Analytics { get; internal set; }
+
[DataMember(Name = "ccr")]
public XPackFeature Ccr { get; internal set; }
+ [DataMember(Name = "enrich")]
+ public XPackFeature Enrich { get; internal set; }
+
+ [Obsolete("Changed to Transform in 7.5.0")]
[DataMember(Name = "data_frame")]
public XPackFeature DataFrame { get; internal set; }
[DataMember(Name = "flattened")]
public XPackFeature Flattened { get; internal set; }
+ [DataMember(Name = "frozen_indices")]
+ public XPackFeature FrozenIndices { get; internal set; }
+
[DataMember(Name = "data_science")]
public XPackFeature DataScience { get; internal set; }
@@ -78,17 +88,26 @@ public class XPackFeatures
[DataMember(Name = "security")]
public XPackFeature Security { get; internal set; }
+ [DataMember(Name = "slm")]
+ public XPackFeature SnapshotLifecycleManagement { get; internal set; }
+
+ [DataMember(Name = "spatial")]
+ public XPackFeature Spatial { get; internal set; }
+
[DataMember(Name = "sql")]
public XPackFeature Sql { get; internal set; }
+ [DataMember(Name = "transform")]
+ public XPackFeature Transform { get; internal set; }
+
[DataMember(Name = "vectors")]
public XPackFeature Vectors { get; internal set; }
+ [DataMember(Name = "voting_only")]
+ public XPackFeature VotingOnly { get; internal set; }
+
[DataMember(Name = "watcher")]
public XPackFeature Watcher { get; internal set; }
-
- [DataMember(Name = "slm")]
- public XPackFeature SnapshotLifecycleManagement { get; internal set; }
}
public class XPackFeature
diff --git a/src/Nest/XPack/Info/XPackUsage/XPackUsageResponse.cs b/src/Nest/XPack/Info/XPackUsage/XPackUsageResponse.cs
index b0fa6b0eee1..12acb1e3515 100644
--- a/src/Nest/XPack/Info/XPackUsage/XPackUsageResponse.cs
+++ b/src/Nest/XPack/Info/XPackUsage/XPackUsageResponse.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Elasticsearch.Net;
@@ -46,6 +47,7 @@ public class XPackUsageResponse : ResponseBase
[DataMember(Name = "rollup")]
public XPackUsage Rollup { get; internal set; }
+ [Obsolete("Changed to Transform in 7.5.0")]
[DataMember(Name = "data_frame")]
public XPackUsage DataFrame { get; internal set; }
@@ -79,6 +81,9 @@ public class XPackUsageResponse : ResponseBase
[DataMember(Name = "security")]
public SecurityUsage Security { get; internal set; }
+ [DataMember(Name = "transform")]
+ public XPackUsage Transform { get; internal set; }
+
[DataMember(Name = "vectors")]
public VectorUsage Vectors { get; internal set; }
@@ -87,6 +92,9 @@ public class XPackUsageResponse : ResponseBase
[DataMember(Name = "slm")]
public SlmUsage SnapshotLifecycleManagement { get; internal set; }
+
+ [DataMember(Name = "enrich")]
+ public XPackUsage Enrich { get; set; }
}
public class SlmUsage : XPackUsage
diff --git a/src/Nest/_Generated/ApiUrlsLookup.generated.cs b/src/Nest/_Generated/ApiUrlsLookup.generated.cs
index 18cb1fdbc7f..4112c57ad01 100644
--- a/src/Nest/_Generated/ApiUrlsLookup.generated.cs
+++ b/src/Nest/_Generated/ApiUrlsLookup.generated.cs
@@ -66,6 +66,11 @@ internal static class ApiUrlsLookups
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 NoNamespaceDeleteScript = new ApiUrls(new[]{"_scripts/{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 NoNamespaceDocumentExists = new ApiUrls(new[]{"{index}/_doc/{id}"});
internal static ApiUrls NoNamespaceSourceExists = new ApiUrls(new[]{"{index}/_source/{id}"});
internal static ApiUrls NoNamespaceExplain = new ApiUrls(new[]{"{index}/_explain/{id}"});
diff --git a/src/Tests/Tests/Ingest/ProcessorAssertions.cs b/src/Tests/Tests/Ingest/ProcessorAssertions.cs
index 8039fa3729b..ea815161b71 100644
--- a/src/Tests/Tests/Ingest/ProcessorAssertions.cs
+++ b/src/Tests/Tests/Ingest/ProcessorAssertions.cs
@@ -125,6 +125,33 @@ public class Date : ProcessorAssertion
public override string Key => "date";
}
+ [SkipVersion("<7.5.0", "Introduced in 7.5.0")]
+ public class Enrich : ProcessorAssertion
+ {
+ public static string PolicyName = "enrich_processor_policy";
+
+ public override Func>> Fluent => d => d.Enrich(f => f
+ .PolicyName(PolicyName)
+ .Field(f => f.Name)
+ .TargetField("target_field")
+ );
+
+ public override IProcessor Initializer => new EnrichProcessor
+ {
+ PolicyName = PolicyName,
+ Field = Infer.Field(f => f.Name),
+ TargetField = "target_field"
+ };
+
+ public override object Json => new
+ {
+ policy_name = PolicyName,
+ field = "name",
+ target_field = "target_field"
+ };
+ public override string Key => "enrich";
+ }
+
public class Fail : ProcessorAssertion
{
public override Func>> Fluent => d => d.Fail(f => f.Message("an error message"));
diff --git a/src/Tests/Tests/Ingest/PutPipeline/PutPipelineApiTests.cs b/src/Tests/Tests/Ingest/PutPipeline/PutPipelineApiTests.cs
index 5784555ee14..6e60d9d89bd 100644
--- a/src/Tests/Tests/Ingest/PutPipeline/PutPipelineApiTests.cs
+++ b/src/Tests/Tests/Ingest/PutPipeline/PutPipelineApiTests.cs
@@ -2,7 +2,10 @@
using Elasticsearch.Net;
using FluentAssertions;
using Nest;
+using Tests.Configuration;
+using Tests.Core.Extensions;
using Tests.Core.ManagedElasticsearch.Clusters;
+using Tests.Domain;
using Tests.Framework.EndpointTests;
using Tests.Framework.EndpointTests.TestState;
@@ -23,6 +26,31 @@ public PutPipelineApiTests(WritableCluster cluster, EndpointUsage usage) : base(
processors = ProcessorAssertions.AllAsJson
};
+ protected override void IntegrationSetup(IElasticClient client, CallUniqueValues values)
+ {
+ if (TestConfiguration.Instance.InRange(">=7.5.0"))
+ {
+ var putPolicyResponse = client.Enrich.PutPolicy(ProcessorAssertions.Enrich.PolicyName, p => p
+ .Match(m => m
+ .Indices(typeof(Project))
+ .MatchField(f => f.Name)
+ .EnrichFields(f => f
+ .Field(ff => ff.Description)
+ .Field(ff => ff.Tags)
+ )
+ )
+ );
+
+ if (!putPolicyResponse.IsValid)
+ throw new Exception($"Failure setting up integration test: {putPolicyResponse.DebugInformation}");
+
+ var executePolicyResponse = client.Enrich.ExecutePolicy(ProcessorAssertions.Enrich.PolicyName);
+
+ if (!executePolicyResponse.IsValid)
+ throw new Exception($"Failure setting up integration test: {executePolicyResponse.DebugInformation}");
+ }
+ }
+
protected override int ExpectStatusCode => 200;
protected override Func Fluent => d => d
diff --git a/src/Tests/Tests/XPack/Enrich/DeletePolicy/DeletePolicyApiTests.cs b/src/Tests/Tests/XPack/Enrich/DeletePolicy/DeletePolicyApiTests.cs
new file mode 100644
index 00000000000..a5e4e96e327
--- /dev/null
+++ b/src/Tests/Tests/XPack/Enrich/DeletePolicy/DeletePolicyApiTests.cs
@@ -0,0 +1,59 @@
+using System;
+using Elastic.Xunit.XunitPlumbing;
+using Elasticsearch.Net;
+using FluentAssertions;
+using Nest;
+using Tests.Core.ManagedElasticsearch.Clusters;
+using Tests.Core.Xunit;
+using Tests.Domain;
+using Tests.Framework.EndpointTests;
+using Tests.Framework.EndpointTests.TestState;
+using static Elasticsearch.Net.HttpMethod;
+
+namespace Tests.XPack.Enrich.DeletePolicy
+{
+ [SkipVersion("<7.5.0", "Introduced in 7.5.0")]
+ public class DeletePolicyApiTests
+ : ApiIntegrationTestBase
+ {
+ public DeletePolicyApiTests(XPackCluster cluster, EndpointUsage usage) : base(cluster, usage) { }
+
+ protected override bool ExpectIsValid => true;
+ protected override int ExpectStatusCode => 200;
+ protected override HttpMethod HttpMethod => DELETE;
+
+ protected override void IntegrationSetup(IElasticClient client, CallUniqueValues values)
+ {
+ foreach (var callUniqueValue in values)
+ {
+ var putPolicyResponse = client.Enrich.PutPolicy(callUniqueValue.Value, p => p
+ .Match(m => m
+ .Indices(typeof(Project))
+ .MatchField(f => f.Name)
+ .EnrichFields(f => f
+ .Field(ff => ff.Description)
+ .Field(ff => ff.Tags)
+ )
+ )
+ );
+
+ if (!putPolicyResponse.IsValid)
+ throw new Exception($"Failure setting up integration test: {putPolicyResponse.DebugInformation}");
+ }
+ }
+
+ protected override DeleteEnrichPolicyRequest Initializer => new DeleteEnrichPolicyRequest(CallIsolatedValue);
+
+ protected override string UrlPath => $"/_enrich/policy/{CallIsolatedValue}";
+
+ protected override LazyResponses ClientUsage() => Calls(
+ (client, f) => client.Enrich.DeletePolicy(CallIsolatedValue, f),
+ (client, f) => client.Enrich.DeletePolicyAsync(CallIsolatedValue, f),
+ (client, r) => client.Enrich.DeletePolicy(r),
+ (client, r) => client.Enrich.DeletePolicyAsync(r)
+ );
+
+ protected override void ExpectResponse(DeleteEnrichPolicyResponse response) =>
+ response.Acknowledged.Should().BeTrue();
+ }
+}
diff --git a/src/Tests/Tests/XPack/Enrich/DeletePolicy/DeletePolicyUrlTests.cs b/src/Tests/Tests/XPack/Enrich/DeletePolicy/DeletePolicyUrlTests.cs
new file mode 100644
index 00000000000..73af3fcec23
--- /dev/null
+++ b/src/Tests/Tests/XPack/Enrich/DeletePolicy/DeletePolicyUrlTests.cs
@@ -0,0 +1,17 @@
+using System.Threading.Tasks;
+using Elastic.Xunit.XunitPlumbing;
+using Nest;
+using Tests.Framework.EndpointTests;
+using static Tests.Framework.EndpointTests.UrlTester;
+
+namespace Tests.XPack.Enrich.DeletePolicy
+{
+ public class DeletePolicyUrlTests : UrlTestsBase
+ {
+ [U] public override async Task Urls() => await DELETE("/_enrich/policy/policy_name")
+ .Fluent(c => c.Enrich.DeletePolicy("policy_name", f => f))
+ .Request(c => c.Enrich.DeletePolicy(new DeleteEnrichPolicyRequest("policy_name")))
+ .FluentAsync(c => c.Enrich.DeletePolicyAsync("policy_name", f => f))
+ .RequestAsync(c => c.Enrich.DeletePolicyAsync(new DeleteEnrichPolicyRequest("policy_name")));
+ }
+}
diff --git a/src/Tests/Tests/XPack/Enrich/ExecutePolicy/ExecutePolicyApiTests.cs b/src/Tests/Tests/XPack/Enrich/ExecutePolicy/ExecutePolicyApiTests.cs
new file mode 100644
index 00000000000..9ebe407ad9d
--- /dev/null
+++ b/src/Tests/Tests/XPack/Enrich/ExecutePolicy/ExecutePolicyApiTests.cs
@@ -0,0 +1,58 @@
+using System;
+using Elastic.Xunit.XunitPlumbing;
+using Elasticsearch.Net;
+using FluentAssertions;
+using Nest;
+using Tests.Core.ManagedElasticsearch.Clusters;
+using Tests.Domain;
+using Tests.Framework.EndpointTests;
+using Tests.Framework.EndpointTests.TestState;
+using static Elasticsearch.Net.HttpMethod;
+
+namespace Tests.XPack.Enrich.ExecutePolicy
+{
+ [SkipVersion("<7.5.0", "Introduced in 7.5.0")]
+ public class ExecutePolicyApiTests
+ : ApiIntegrationTestBase
+ {
+ public ExecutePolicyApiTests(XPackCluster cluster, EndpointUsage usage) : base(cluster, usage) { }
+
+ protected override bool ExpectIsValid => true;
+ protected override int ExpectStatusCode => 200;
+ protected override HttpMethod HttpMethod => PUT;
+
+ protected override void IntegrationSetup(IElasticClient client, CallUniqueValues values)
+ {
+ foreach (var callUniqueValue in values)
+ {
+ var putPolicyResponse = client.Enrich.PutPolicy(callUniqueValue.Value, p => p
+ .Match(m => m
+ .Indices(typeof(Project))
+ .MatchField(f => f.Name)
+ .EnrichFields(f => f
+ .Field(ff => ff.Description)
+ .Field(ff => ff.Tags)
+ )
+ )
+ );
+
+ if (!putPolicyResponse.IsValid)
+ throw new Exception($"Failure setting up integration test: {putPolicyResponse.DebugInformation}");
+ }
+ }
+
+ protected override ExecuteEnrichPolicyRequest Initializer => new ExecuteEnrichPolicyRequest(CallIsolatedValue);
+
+ protected override string UrlPath => $"/_enrich/policy/{CallIsolatedValue}/_execute";
+
+ protected override LazyResponses ClientUsage() => Calls(
+ (client, f) => client.Enrich.ExecutePolicy(CallIsolatedValue, f),
+ (client, f) => client.Enrich.ExecutePolicyAsync(CallIsolatedValue, f),
+ (client, r) => client.Enrich.ExecutePolicy(r),
+ (client, r) => client.Enrich.ExecutePolicyAsync(r)
+ );
+
+ protected override void ExpectResponse(ExecuteEnrichPolicyResponse response) =>
+ response.Status.Phase.Should().Be(EnrichPolicyPhase.Complete);
+ }
+}
diff --git a/src/Tests/Tests/XPack/Enrich/ExecutePolicy/ExecutePolicyUrlTests.cs b/src/Tests/Tests/XPack/Enrich/ExecutePolicy/ExecutePolicyUrlTests.cs
new file mode 100644
index 00000000000..d19627c8625
--- /dev/null
+++ b/src/Tests/Tests/XPack/Enrich/ExecutePolicy/ExecutePolicyUrlTests.cs
@@ -0,0 +1,17 @@
+using System.Threading.Tasks;
+using Elastic.Xunit.XunitPlumbing;
+using Nest;
+using Tests.Framework.EndpointTests;
+using static Tests.Framework.EndpointTests.UrlTester;
+
+namespace Tests.XPack.Enrich.ExecutePolicy
+{
+ public class ExecutePolicyUrlTests : UrlTestsBase
+ {
+ [U] public override async Task Urls() => await PUT("/_enrich/policy/policy_name/_execute")
+ .Fluent(c => c.Enrich.ExecutePolicy("policy_name"))
+ .Request(c => c.Enrich.ExecutePolicy(new ExecuteEnrichPolicyRequest("policy_name")))
+ .FluentAsync(c => c.Enrich.ExecutePolicyAsync("policy_name"))
+ .RequestAsync(c => c.Enrich.ExecutePolicyAsync(new ExecuteEnrichPolicyRequest("policy_name")));
+ }
+}
diff --git a/src/Tests/Tests/XPack/Enrich/GetPolicy/GetPolicyApiTests.cs b/src/Tests/Tests/XPack/Enrich/GetPolicy/GetPolicyApiTests.cs
new file mode 100644
index 00000000000..bee33d280d9
--- /dev/null
+++ b/src/Tests/Tests/XPack/Enrich/GetPolicy/GetPolicyApiTests.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Linq;
+using Elastic.Xunit.XunitPlumbing;
+using Elasticsearch.Net;
+using FluentAssertions;
+using Nest;
+using Tests.Core.ManagedElasticsearch.Clusters;
+using Tests.Domain;
+using Tests.Framework.EndpointTests;
+using Tests.Framework.EndpointTests.TestState;
+using static Elasticsearch.Net.HttpMethod;
+
+namespace Tests.XPack.Enrich.GetPolicy
+{
+ [SkipVersion("<7.5.0", "Introduced in 7.5.0")]
+ public class GetPolicyApiTests
+ : ApiIntegrationTestBase
+ {
+ private static readonly string PolicyName = "example_policy";
+
+ public GetPolicyApiTests(XPackCluster cluster, EndpointUsage usage) : base(cluster, usage) { }
+
+ protected override bool ExpectIsValid => true;
+ protected override int ExpectStatusCode => 200;
+ protected override HttpMethod HttpMethod => GET;
+
+ protected override GetEnrichPolicyRequest Initializer => new GetEnrichPolicyRequest(PolicyName);
+
+ protected override string UrlPath => $"/_enrich/policy/{PolicyName}";
+
+ protected override void IntegrationSetup(IElasticClient client, CallUniqueValues values)
+ {
+ var putPolicyResponse = client.Enrich.PutPolicy(PolicyName, p => p
+ .Match(m => m
+ .Indices(typeof(Project))
+ .MatchField(f => f.Name)
+ .EnrichFields(f => f
+ .Field(ff => ff.Description)
+ .Field(ff => ff.Tags)
+ )
+ )
+ );
+
+ if (!putPolicyResponse.IsValid)
+ throw new Exception($"Failure setting up integration test: {putPolicyResponse.DebugInformation}");
+ }
+
+ protected override LazyResponses ClientUsage() => Calls(
+ (client, f) => client.Enrich.GetPolicy(PolicyName, f),
+ (client, f) => client.Enrich.GetPolicyAsync(PolicyName, f),
+ (client, r) => client.Enrich.GetPolicy(r),
+ (client, r) => client.Enrich.GetPolicyAsync(r)
+ );
+
+ protected override void ExpectResponse(GetEnrichPolicyResponse response)
+ {
+ response.Policies.Should().HaveCount(1);
+ var policyConfig = response.Policies.First().Config;
+
+ policyConfig.Match.Should().NotBeNull();
+ policyConfig.Match.Name.Should().Be(PolicyName);
+ policyConfig.Match.Indices.Should().Be((Nest.Indices)"project");
+ policyConfig.Match.MatchField.Should().Be("name");
+ policyConfig.Match.EnrichFields.Should().HaveCount(2).And.Contain(new Field[] { "description", "tags" });
+ }
+ }
+}
diff --git a/src/Tests/Tests/XPack/Enrich/GetPolicy/GetPolicyUrlTests.cs b/src/Tests/Tests/XPack/Enrich/GetPolicy/GetPolicyUrlTests.cs
new file mode 100644
index 00000000000..f37ab6d1341
--- /dev/null
+++ b/src/Tests/Tests/XPack/Enrich/GetPolicy/GetPolicyUrlTests.cs
@@ -0,0 +1,32 @@
+using System.Threading.Tasks;
+using Elastic.Xunit.XunitPlumbing;
+using Nest;
+using Tests.Framework.EndpointTests;
+using static Tests.Framework.EndpointTests.UrlTester;
+
+namespace Tests.XPack.Enrich.GetEnrichPolicy
+{
+ public class GetEnrichPolicyUrlTests : UrlTestsBase
+ {
+ [U] public override async Task Urls()
+ {
+ await GET("/_enrich/policy/policy_name")
+ .Fluent(c => c.Enrich.GetPolicy("policy_name", f => f))
+ .Request(c => c.Enrich.GetPolicy(new GetEnrichPolicyRequest("policy_name")))
+ .FluentAsync(c => c.Enrich.GetPolicyAsync("policy_name", f => f))
+ .RequestAsync(c => c.Enrich.GetPolicyAsync(new GetEnrichPolicyRequest("policy_name")));
+
+ await GET("/_enrich/policy/policy_name_1%2Cpolicy_name_2")
+ .Fluent(c => c.Enrich.GetPolicy(new [] { "policy_name_1", "policy_name_2" }))
+ .Request(c => c.Enrich.GetPolicy(new GetEnrichPolicyRequest(new [] { "policy_name_1", "policy_name_2" })))
+ .FluentAsync(c => c.Enrich.GetPolicyAsync(new [] { "policy_name_1", "policy_name_2" }))
+ .RequestAsync(c => c.Enrich.GetPolicyAsync(new GetEnrichPolicyRequest(new [] { "policy_name_1", "policy_name_2" })));
+
+ await GET("/_enrich/policy/")
+ .Fluent(c => c.Enrich.GetPolicy())
+ .Request(c => c.Enrich.GetPolicy(new GetEnrichPolicyRequest()))
+ .FluentAsync(c => c.Enrich.GetPolicyAsync())
+ .RequestAsync(c => c.Enrich.GetPolicyAsync(new GetEnrichPolicyRequest()));
+ }
+ }
+}
diff --git a/src/Tests/Tests/XPack/Enrich/PutPolicy/PutPolicyApiTests.cs b/src/Tests/Tests/XPack/Enrich/PutPolicy/PutPolicyApiTests.cs
new file mode 100644
index 00000000000..23e671e3fde
--- /dev/null
+++ b/src/Tests/Tests/XPack/Enrich/PutPolicy/PutPolicyApiTests.cs
@@ -0,0 +1,72 @@
+using System;
+using Elastic.Xunit.XunitPlumbing;
+using Elasticsearch.Net;
+using FluentAssertions;
+using Nest;
+using Tests.Core.ManagedElasticsearch.Clusters;
+using Tests.Domain;
+using Tests.Framework.EndpointTests;
+using Tests.Framework.EndpointTests.TestState;
+using static Elasticsearch.Net.HttpMethod;
+using static Nest.Infer;
+
+namespace Tests.XPack.Enrich.PutPolicy
+{
+ [SkipVersion("<7.5.0", "Introduced in 7.5.0")]
+ public class PutPolicyApiTests
+ : ApiIntegrationTestBase, PutEnrichPolicyRequest>
+ {
+ public PutPolicyApiTests(XPackCluster cluster, EndpointUsage usage) : base(cluster, usage) { }
+
+ protected override bool ExpectIsValid => true;
+ protected override int ExpectStatusCode => 200;
+ protected override HttpMethod HttpMethod => PUT;
+
+ protected override object ExpectJson => new
+ {
+ match = new
+ {
+ indices = new[] { "project" },
+ match_field = "name",
+ enrich_fields = new[] { "description", "tags" }
+ }
+ };
+
+ protected override PutEnrichPolicyRequest Initializer => new PutEnrichPolicyRequest(CallIsolatedValue)
+ {
+ Match = new EnrichPolicy
+ {
+ Indices = typeof(Project),
+ MatchField = Field(f => f.Name),
+ EnrichFields = Fields(
+ f => f.Description,
+ f => f.Tags
+ )
+ }
+ };
+
+ protected override PutEnrichPolicyDescriptor NewDescriptor() => new PutEnrichPolicyDescriptor(CallIsolatedValue);
+
+ protected override Func, IPutEnrichPolicyRequest> Fluent => f => f
+ .Match(m => m
+ .Indices(typeof(Project))
+ .MatchField(f => f.Name)
+ .EnrichFields(f => f
+ .Field(ff => ff.Description)
+ .Field(ff => ff.Tags)
+ )
+ );
+
+ protected override string UrlPath => $"/_enrich/policy/{CallIsolatedValue}";
+
+ protected override LazyResponses ClientUsage() => Calls(
+ (client, f) => client.Enrich.PutPolicy(CallIsolatedValue, f),
+ (client, f) => client.Enrich.PutPolicyAsync(CallIsolatedValue, f),
+ (client, r) => client.Enrich.PutPolicy(r),
+ (client, r) => client.Enrich.PutPolicyAsync(r)
+ );
+
+ protected override void ExpectResponse(PutEnrichPolicyResponse response) =>
+ response.Acknowledged.Should().BeTrue();
+ }
+}
diff --git a/src/Tests/Tests/XPack/Enrich/PutPolicy/PutPolicyUrlTests.cs b/src/Tests/Tests/XPack/Enrich/PutPolicy/PutPolicyUrlTests.cs
new file mode 100644
index 00000000000..7875f0531d9
--- /dev/null
+++ b/src/Tests/Tests/XPack/Enrich/PutPolicy/PutPolicyUrlTests.cs
@@ -0,0 +1,17 @@
+using System.Threading.Tasks;
+using Elastic.Xunit.XunitPlumbing;
+using Nest;
+using Tests.Framework.EndpointTests;
+using static Tests.Framework.EndpointTests.UrlTester;
+
+namespace Tests.XPack.Enrich.PutPolicy
+{
+ public class PutPolicyUrlTests : UrlTestsBase
+ {
+ [U] public override async Task Urls() => await PUT("/_enrich/policy/policy_name")
+ .Fluent(c => c.Enrich.PutPolicy