diff --git a/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Eql.cs b/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Eql.cs
index 00f6df1945f..17131583926 100644
--- a/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Eql.cs
+++ b/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Eql.cs
@@ -43,7 +43,7 @@
namespace Elasticsearch.Net.Specification.EqlApi
{
///Request options for Delete https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html
- public class DeleteRequestParameters : RequestParameters
+ public class EqlDeleteRequestParameters : RequestParameters
{
public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE;
public override bool SupportsBody => false;
diff --git a/src/Elasticsearch.Net/ElasticLowLevelClient.Eql.cs b/src/Elasticsearch.Net/ElasticLowLevelClient.Eql.cs
index 3a37712944e..929e33f8116 100644
--- a/src/Elasticsearch.Net/ElasticLowLevelClient.Eql.cs
+++ b/src/Elasticsearch.Net/ElasticLowLevelClient.Eql.cs
@@ -64,13 +64,13 @@ internal LowLevelEqlNamespace(ElasticLowLevelClient client): base(client)
///DELETE on /_eql/search/{id} https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html
///The async search ID
///Request specific configuration such as querystring parameters & request specific connection settings.
- public TResponse Delete(string id, DeleteRequestParameters requestParameters = null)
+ public TResponse Delete(string id, EqlDeleteRequestParameters requestParameters = null)
where TResponse : class, IElasticsearchResponse, new() => DoRequest(DELETE, Url($"_eql/search/{id:id}"), null, RequestParams(requestParameters));
///DELETE on /_eql/search/{id} https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html
///The async search ID
///Request specific configuration such as querystring parameters & request specific connection settings.
[MapsApi("eql.delete", "id")]
- public Task DeleteAsync(string id, DeleteRequestParameters requestParameters = null, CancellationToken ctx = default)
+ public Task DeleteAsync(string id, EqlDeleteRequestParameters requestParameters = null, CancellationToken ctx = default)
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(DELETE, Url($"_eql/search/{id:id}"), ctx, null, RequestParams(requestParameters));
///GET on /_eql/search/{id} https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html
///The async search ID
diff --git a/src/Nest/Descriptors.Eql.cs b/src/Nest/Descriptors.Eql.cs
index 7d1efc74f53..20f0f09bc5f 100644
--- a/src/Nest/Descriptors.Eql.cs
+++ b/src/Nest/Descriptors.Eql.cs
@@ -48,6 +48,27 @@
// ReSharper disable RedundantNameQualifier
namespace Nest
{
+ ///Descriptor for Delete https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html
+ public partial class EqlDeleteDescriptor : RequestDescriptorBase, IEqlDeleteRequest
+ {
+ internal override ApiUrls ApiUrls => ApiUrlsLookups.EqlDelete;
+ ////_eql/search/{id}
+ ///this parameter is required
+ public EqlDeleteDescriptor(Id id): base(r => r.Required("id", id))
+ {
+ }
+
+ ///Used for serialization purposes, making sure we have a parameterless constructor
+ [SerializationConstructor]
+ protected EqlDeleteDescriptor(): base()
+ {
+ }
+
+ // values part of the url path
+ Id IEqlDeleteRequest.Id => Self.RouteValues.Get("id");
+ // Request parameters
+ }
+
///Descriptor for Get https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html
public partial class EqlGetDescriptor : RequestDescriptorBase, IEqlGetRequest
{
diff --git a/src/Nest/ElasticClient.Eql.cs b/src/Nest/ElasticClient.Eql.cs
index c911ad93ae4..e1c18d58174 100644
--- a/src/Nest/ElasticClient.Eql.cs
+++ b/src/Nest/ElasticClient.Eql.cs
@@ -54,6 +54,30 @@ internal EqlNamespace(ElasticClient client): base(client)
{
}
+ ///
+ /// DELETE request to the eql.delete API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html
+ ///
+ public EqlDeleteResponse Delete(Id id, Func selector = null) => Delete(selector.InvokeOrDefault(new EqlDeleteDescriptor(id: id)));
+ ///
+ /// DELETE request to the eql.delete API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html
+ ///
+ public Task DeleteAsync(Id id, Func selector = null, CancellationToken ct = default) => DeleteAsync(selector.InvokeOrDefault(new EqlDeleteDescriptor(id: id)), ct);
+ ///
+ /// DELETE request to the eql.delete API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html
+ ///
+ public EqlDeleteResponse Delete(IEqlDeleteRequest request) => DoRequest(request, request.RequestParameters);
+ ///
+ /// DELETE request to the eql.delete API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html
+ ///
+ public Task DeleteAsync(IEqlDeleteRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct);
///
/// GET request to the eql.get API, read more about this API online:
///
diff --git a/src/Nest/Requests.Eql.cs b/src/Nest/Requests.Eql.cs
index ac80de19778..377841cb9d9 100644
--- a/src/Nest/Requests.Eql.cs
+++ b/src/Nest/Requests.Eql.cs
@@ -49,6 +49,39 @@
// ReSharper disable RedundantNameQualifier
namespace Nest
{
+ [InterfaceDataContract]
+ public partial interface IEqlDeleteRequest : IRequest
+ {
+ [IgnoreDataMember]
+ Id Id
+ {
+ get;
+ }
+ }
+
+ ///Request for Delete https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html
+ public partial class EqlDeleteRequest : PlainRequestBase, IEqlDeleteRequest
+ {
+ protected IEqlDeleteRequest Self => this;
+ internal override ApiUrls ApiUrls => ApiUrlsLookups.EqlDelete;
+ ////_eql/search/{id}
+ ///this parameter is required
+ public EqlDeleteRequest(Id id): base(r => r.Required("id", id))
+ {
+ }
+
+ ///Used for serialization purposes, making sure we have a parameterless constructor
+ [SerializationConstructor]
+ protected EqlDeleteRequest(): base()
+ {
+ }
+
+ // values part of the url path
+ [IgnoreDataMember]
+ Id IEqlDeleteRequest.Id => Self.RouteValues.Get("id");
+ // Request parameters
+ }
+
[InterfaceDataContract]
public partial interface IEqlGetRequest : IRequest
{
diff --git a/src/Nest/XPack/Eql/Delete/EqlDeleteRequest.cs b/src/Nest/XPack/Eql/Delete/EqlDeleteRequest.cs
new file mode 100644
index 00000000000..76e8213227e
--- /dev/null
+++ b/src/Nest/XPack/Eql/Delete/EqlDeleteRequest.cs
@@ -0,0 +1,39 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+namespace Nest
+{
+ ///
+ /// Request to deletes an async EQL search or a stored synchronous EQL search.
+ /// The delete API also deletes results for the search.
+ ///
+ [MapsApi("eql.delete.json")]
+ [ReadAs(typeof(EqlDeleteRequest))]
+ public partial interface IEqlDeleteRequest { }
+
+ ///
+ public partial class EqlDeleteRequest
+ {
+ }
+
+ ///
+ public partial class EqlDeleteDescriptor
+ {
+ }
+}
diff --git a/src/Nest/XPack/Eql/Delete/EqlDeleteResponse.cs b/src/Nest/XPack/Eql/Delete/EqlDeleteResponse.cs
new file mode 100644
index 00000000000..9138a6b5e2c
--- /dev/null
+++ b/src/Nest/XPack/Eql/Delete/EqlDeleteResponse.cs
@@ -0,0 +1,23 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+namespace Nest
+{
+ public class EqlDeleteResponse : AcknowledgedResponseBase { }
+}
diff --git a/src/Nest/_Generated/ApiUrlsLookup.generated.cs b/src/Nest/_Generated/ApiUrlsLookup.generated.cs
index c6c8081df92..726ae9dd223 100644
--- a/src/Nest/_Generated/ApiUrlsLookup.generated.cs
+++ b/src/Nest/_Generated/ApiUrlsLookup.generated.cs
@@ -106,6 +106,7 @@ internal static class ApiUrlsLookups
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 EqlGet = new ApiUrls(new[]{"_eql/search/{id}"});
internal static ApiUrls EqlSearchStatus = new ApiUrls(new[]{"_eql/search/status/{id}"});
internal static ApiUrls EqlSearch = new ApiUrls(new[]{"{index}/_eql/search"});
diff --git a/tests/Tests/XPack/Eql/Delete/EqlDeleteUrlTests.cs b/tests/Tests/XPack/Eql/Delete/EqlDeleteUrlTests.cs
new file mode 100644
index 00000000000..8e2a5b851f3
--- /dev/null
+++ b/tests/Tests/XPack/Eql/Delete/EqlDeleteUrlTests.cs
@@ -0,0 +1,36 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using System.Threading.Tasks;
+using Elastic.Elasticsearch.Xunit.XunitPlumbing;
+using Nest;
+using Tests.Framework.EndpointTests;
+using static Tests.Framework.EndpointTests.UrlTester;
+
+namespace Tests.XPack.Eql.Delete
+{
+ public class EqlDeleteUrlTests : UrlTestsBase
+ {
+ [U] public override async Task Urls() => await DELETE("/_eql/search/search_id")
+ .Fluent(c => c.Eql.Delete("search_id", f => f))
+ .Request(c => c.Eql.Delete(new EqlDeleteRequest("search_id")))
+ .FluentAsync(c => c.Eql.DeleteAsync("search_id", f => f))
+ .RequestAsync(c => c.Eql.DeleteAsync(new EqlDeleteRequest("search_id")));
+ }
+}
diff --git a/tests/Tests/XPack/Eql/EqlSearchApiCoordinatedTests.cs b/tests/Tests/XPack/Eql/EqlSearchApiCoordinatedTests.cs
index 6fd4b6c2ae2..dff546e3afc 100644
--- a/tests/Tests/XPack/Eql/EqlSearchApiCoordinatedTests.cs
+++ b/tests/Tests/XPack/Eql/EqlSearchApiCoordinatedTests.cs
@@ -17,7 +17,6 @@
* under the License.
*/
-using System;
using System.Linq;
using System.Threading.Tasks;
using Elastic.Elasticsearch.Xunit.XunitPlumbing;
@@ -38,6 +37,7 @@ public class EqlSearchApiCoordinatedTests : CoordinatedIntegrationTestBase c.Eql.GetAsync(r),
uniqueValueSelector: values => values.ExtendedValue("id")
)
+ },
+ {DeleteStep, u =>
+ u.Calls(
+ v => new EqlDeleteRequest(v),
+ (v, d) => d,
+ (v, c, f) => c.Eql.Delete(v, f),
+ (v, c, f) => c.Eql.DeleteAsync(v, f),
+ (v, c, r) => c.Eql.Delete(r),
+ (v, c, r) => c.Eql.DeleteAsync(r),
+ uniqueValueSelector: values => values.ExtendedValue("id")
+ )
}
}) { }
@@ -134,5 +145,11 @@ [I] public async Task EqlGetResponse() => await Assert>(GetS
firstEvent.Id.Should().NotBeNullOrEmpty();
firstEvent.Source.Event.Category.Should().BeOneOf(Log.EventCategories);
});
+
+ [I] public async Task EqlDeleteResponse() => await Assert(DeleteStep, r =>
+ {
+ r.ShouldBeValid();
+ r.Acknowledged.Should().BeTrue();
+ });
}
}