diff --git a/src/Nest/Descriptors.Watcher.cs b/src/Nest/Descriptors.Watcher.cs
index a1d442440ac..8cb523783b6 100644
--- a/src/Nest/Descriptors.Watcher.cs
+++ b/src/Nest/Descriptors.Watcher.cs
@@ -216,6 +216,16 @@ protected PutWatchDescriptor(): base()
public PutWatchDescriptor Version(long? version) => Qs("version", version);
}
+ ///Descriptor for QueryWatches https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-query-watches.html
+ public partial class QueryWatchesDescriptor : RequestDescriptorBase, IQueryWatchesRequest
+ {
+ internal override ApiUrls ApiUrls => ApiUrlsLookups.WatcherQueryWatches;
+ protected override HttpMethod HttpMethod => HttpMethod.POST;
+ protected override bool SupportsBody => true;
+ // values part of the url path
+ // Request parameters
+ }
+
///Descriptor for Start https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html
public partial class StartWatcherDescriptor : RequestDescriptorBase, IStartWatcherRequest
{
diff --git a/src/Nest/ElasticClient.Watcher.cs b/src/Nest/ElasticClient.Watcher.cs
index 5014570bffb..fe9f5b1b0a4 100644
--- a/src/Nest/ElasticClient.Watcher.cs
+++ b/src/Nest/ElasticClient.Watcher.cs
@@ -208,6 +208,30 @@ internal WatcherNamespace(ElasticClient client): base(client)
///
public Task PutAsync(IPutWatchRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct);
///
+ /// POST request to the watcher.query_watches API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-query-watches.html
+ ///
+ public QueryWatchesResponse QueryWatches(Func selector = null) => QueryWatches(selector.InvokeOrDefault(new QueryWatchesDescriptor()));
+ ///
+ /// POST request to the watcher.query_watches API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-query-watches.html
+ ///
+ public Task QueryWatchesAsync(Func selector = null, CancellationToken ct = default) => QueryWatchesAsync(selector.InvokeOrDefault(new QueryWatchesDescriptor()), ct);
+ ///
+ /// POST request to the watcher.query_watches API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-query-watches.html
+ ///
+ public QueryWatchesResponse QueryWatches(IQueryWatchesRequest request) => DoRequest(request, request.RequestParameters);
+ ///
+ /// POST request to the watcher.query_watches API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-query-watches.html
+ ///
+ public Task QueryWatchesAsync(IQueryWatchesRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct);
+ ///
/// POST request to the watcher.start API, read more about this API online:
///
/// https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html
diff --git a/src/Nest/Requests.Watcher.cs b/src/Nest/Requests.Watcher.cs
index 8c6bb57400c..82857652dc8 100644
--- a/src/Nest/Requests.Watcher.cs
+++ b/src/Nest/Requests.Watcher.cs
@@ -327,6 +327,22 @@ public long? Version
}
}
+ [InterfaceDataContract]
+ public partial interface IQueryWatchesRequest : IRequest
+ {
+ }
+
+ ///Request for QueryWatches https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-query-watches.html
+ public partial class QueryWatchesRequest : PlainRequestBase, IQueryWatchesRequest
+ {
+ protected IQueryWatchesRequest Self => this;
+ internal override ApiUrls ApiUrls => ApiUrlsLookups.WatcherQueryWatches;
+ protected override HttpMethod HttpMethod => HttpMethod.POST;
+ protected override bool SupportsBody => true;
+ // values part of the url path
+ // Request parameters
+ }
+
[InterfaceDataContract]
public partial interface IStartWatcherRequest : IRequest
{
diff --git a/src/Nest/XPack/Watcher/Query/QueryWatchesRequest.cs b/src/Nest/XPack/Watcher/Query/QueryWatchesRequest.cs
new file mode 100644
index 00000000000..edf4d33f15b
--- /dev/null
+++ b/src/Nest/XPack/Watcher/Query/QueryWatchesRequest.cs
@@ -0,0 +1,98 @@
+// 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
+
+using System;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+
+namespace Nest
+{
+ [MapsApi("watcher.query_watches.json")]
+ [ReadAs(typeof(QueryWatchesRequest))]
+ public partial interface IQueryWatchesRequest
+ {
+ ///
+ /// The offset from the first result to fetch. Needs to be non-negative.
+ ///
+ [DataMember(Name = "from")]
+ int? From { get; set; }
+
+ ///
+ /// Optional, query filter watches to be returned.
+ ///
+ [DataMember(Name = "query")]
+ QueryContainer Query { get; set; }
+
+ ///
+ /// Sort values that can be used to start returning results "after" any document in the result list.
+ ///
+ [DataMember(Name = "search_after")]
+ IList