diff --git a/src/ApiGenerator/Domain/Specification/UrlPart.cs b/src/ApiGenerator/Domain/Specification/UrlPart.cs
index 0e9587400f7..bdf370310ac 100644
--- a/src/ApiGenerator/Domain/Specification/UrlPart.cs
+++ b/src/ApiGenerator/Domain/Specification/UrlPart.cs
@@ -95,6 +95,7 @@ public string HighLevelTypeName
case "application":
case "repository":
case "snapshot":
+ case "target_snapshot":
case "user":
case "username":
case "realms":
diff --git a/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Snapshot.cs b/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Snapshot.cs
index 71c80036cbd..2aa6166e53f 100644
--- a/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Snapshot.cs
+++ b/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Snapshot.cs
@@ -45,7 +45,7 @@ public TimeSpan Timeout
}
///Request options for Clone https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html
- public class CloneRequestParameters : RequestParameters
+ public class CloneSnapshotRequestParameters : RequestParameters
{
public override HttpMethod DefaultHttpMethod => HttpMethod.PUT;
public override bool SupportsBody => true;
diff --git a/src/Elasticsearch.Net/ElasticLowLevelClient.Snapshot.cs b/src/Elasticsearch.Net/ElasticLowLevelClient.Snapshot.cs
index 3d9d9496cf9..b139df46920 100644
--- a/src/Elasticsearch.Net/ElasticLowLevelClient.Snapshot.cs
+++ b/src/Elasticsearch.Net/ElasticLowLevelClient.Snapshot.cs
@@ -62,7 +62,7 @@ public Task CleanupRepositoryAsync(string repository, Post
///The name of the cloned snapshot to create
///The snapshot clone definition
///Request specific configuration such as querystring parameters & request specific connection settings.
- public TResponse Clone(string repository, string snapshot, string targetSnapshot, PostData body, CloneRequestParameters requestParameters = null)
+ public TResponse Clone(string repository, string snapshot, string targetSnapshot, PostData body, CloneSnapshotRequestParameters requestParameters = null)
where TResponse : class, IElasticsearchResponse, new() => DoRequest(PUT, Url($"_snapshot/{repository:repository}/{snapshot:snapshot}/_clone/{targetSnapshot:targetSnapshot}"), body, RequestParams(requestParameters));
///PUT on /_snapshot/{repository}/{snapshot}/_clone/{target_snapshot} https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html
///A repository name
@@ -71,7 +71,7 @@ public TResponse Clone(string repository, string snapshot, string tar
///The snapshot clone definition
///Request specific configuration such as querystring parameters & request specific connection settings.
[MapsApi("snapshot.clone", "repository, snapshot, target_snapshot, body")]
- public Task CloneAsync(string repository, string snapshot, string targetSnapshot, PostData body, CloneRequestParameters requestParameters = null, CancellationToken ctx = default)
+ public Task CloneAsync(string repository, string snapshot, string targetSnapshot, PostData body, CloneSnapshotRequestParameters requestParameters = null, CancellationToken ctx = default)
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(PUT, Url($"_snapshot/{repository:repository}/{snapshot:snapshot}/_clone/{targetSnapshot:targetSnapshot}"), ctx, body, RequestParams(requestParameters));
///PUT on /_snapshot/{repository}/{snapshot} https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html
///A repository name
diff --git a/src/Nest/Descriptors.Snapshot.cs b/src/Nest/Descriptors.Snapshot.cs
index 1519c562d6e..e59d5fb1dd2 100644
--- a/src/Nest/Descriptors.Snapshot.cs
+++ b/src/Nest/Descriptors.Snapshot.cs
@@ -55,6 +55,33 @@ protected CleanupRepositoryDescriptor(): base()
public CleanupRepositoryDescriptor Timeout(Time timeout) => Qs("timeout", timeout);
}
+ ///Descriptor for Clone https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html
+ public partial class CloneSnapshotDescriptor : RequestDescriptorBase, ICloneSnapshotRequest
+ {
+ internal override ApiUrls ApiUrls => ApiUrlsLookups.SnapshotClone;
+ ////_snapshot/{repository}/{snapshot}/_clone/{target_snapshot}
+ ///this parameter is required
+ ///this parameter is required
+ ///this parameter is required
+ public CloneSnapshotDescriptor(Name repository, Name snapshot, Name targetSnapshot): base(r => r.Required("repository", repository).Required("snapshot", snapshot).Required("target_snapshot", targetSnapshot))
+ {
+ }
+
+ ///Used for serialization purposes, making sure we have a parameterless constructor
+ [SerializationConstructor]
+ protected CloneSnapshotDescriptor(): base()
+ {
+ }
+
+ // values part of the url path
+ Name ICloneSnapshotRequest.RepositoryName => Self.RouteValues.Get("repository");
+ Name ICloneSnapshotRequest.Snapshot => Self.RouteValues.Get("snapshot");
+ Name ICloneSnapshotRequest.TargetSnapshot => Self.RouteValues.Get("target_snapshot");
+ // Request parameters
+ ///Explicit operation timeout for connection to master node
+ public CloneSnapshotDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout);
+ }
+
///Descriptor for Snapshot https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html
public partial class SnapshotDescriptor : RequestDescriptorBase, ISnapshotRequest
{
diff --git a/src/Nest/ElasticClient.Snapshot.cs b/src/Nest/ElasticClient.Snapshot.cs
index 9315775b5a2..bbe797cd1c6 100644
--- a/src/Nest/ElasticClient.Snapshot.cs
+++ b/src/Nest/ElasticClient.Snapshot.cs
@@ -61,6 +61,30 @@ internal SnapshotNamespace(ElasticClient client): base(client)
///
public Task CleanupRepositoryAsync(ICleanupRepositoryRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct);
///
+ /// PUT request to the snapshot.clone API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html
+ ///
+ public CloneSnapshotResponse Clone(Name repository, Name snapshot, Name targetSnapshot, Func selector) => Clone(selector.InvokeOrDefault(new CloneSnapshotDescriptor(repository: repository, snapshot: snapshot, targetSnapshot: targetSnapshot)));
+ ///
+ /// PUT request to the snapshot.clone API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html
+ ///
+ public Task CloneAsync(Name repository, Name snapshot, Name targetSnapshot, Func selector, CancellationToken ct = default) => CloneAsync(selector.InvokeOrDefault(new CloneSnapshotDescriptor(repository: repository, snapshot: snapshot, targetSnapshot: targetSnapshot)), ct);
+ ///
+ /// PUT request to the snapshot.clone API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html
+ ///
+ public CloneSnapshotResponse Clone(ICloneSnapshotRequest request) => DoRequest(request, request.RequestParameters);
+ ///
+ /// PUT request to the snapshot.clone API, read more about this API online:
+ ///
+ /// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html
+ ///
+ public Task CloneAsync(ICloneSnapshotRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct);
+ ///
/// PUT request to the snapshot.create API, read more about this API online:
///
/// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html
diff --git a/src/Nest/Modules/SnapshotAndRestore/Snapshot/Clone/CloneSnapshotRequest.cs b/src/Nest/Modules/SnapshotAndRestore/Snapshot/Clone/CloneSnapshotRequest.cs
new file mode 100644
index 00000000000..c7cd0773f2c
--- /dev/null
+++ b/src/Nest/Modules/SnapshotAndRestore/Snapshot/Clone/CloneSnapshotRequest.cs
@@ -0,0 +1,39 @@
+// 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.Runtime.Serialization;
+
+namespace Nest
+{
+ [MapsApi("snapshot.clone.json")]
+ [ReadAs(typeof(CloneSnapshotRequest))]
+ public partial interface ICloneSnapshotRequest
+ {
+ ///
+ /// The indices to clone.
+ ///
+ [DataMember(Name = "indices")]
+ Indices Indices { get; set; }
+ }
+
+ public partial class CloneSnapshotRequest
+ {
+ ///
+ public Indices Indices { get; set; }
+ }
+
+ public partial class CloneSnapshotDescriptor
+ {
+ Indices ICloneSnapshotRequest.Indices { get; set; }
+
+ ///
+ public CloneSnapshotDescriptor Index(IndexName index) => Indices(index);
+
+ ///
+ public CloneSnapshotDescriptor Index() where T : class => Indices(typeof(T));
+
+ ///
+ public CloneSnapshotDescriptor Indices(Indices indices) => Assign(indices, (a, v) => a.Indices = v);
+ }
+}
diff --git a/src/Nest/Modules/SnapshotAndRestore/Snapshot/Clone/CloneSnapshotResponse.cs b/src/Nest/Modules/SnapshotAndRestore/Snapshot/Clone/CloneSnapshotResponse.cs
new file mode 100644
index 00000000000..2a8ea165c1d
--- /dev/null
+++ b/src/Nest/Modules/SnapshotAndRestore/Snapshot/Clone/CloneSnapshotResponse.cs
@@ -0,0 +1,8 @@
+// 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
+
+namespace Nest
+{
+ public class CloneSnapshotResponse : AcknowledgedResponseBase { }
+}
diff --git a/src/Nest/Requests.Snapshot.cs b/src/Nest/Requests.Snapshot.cs
index eb7ba17971d..0626c75ca2f 100644
--- a/src/Nest/Requests.Snapshot.cs
+++ b/src/Nest/Requests.Snapshot.cs
@@ -77,6 +77,63 @@ public Time Timeout
}
}
+ [InterfaceDataContract]
+ public partial interface ICloneSnapshotRequest : IRequest
+ {
+ [IgnoreDataMember]
+ Name RepositoryName
+ {
+ get;
+ }
+
+ [IgnoreDataMember]
+ Name Snapshot
+ {
+ get;
+ }
+
+ [IgnoreDataMember]
+ Name TargetSnapshot
+ {
+ get;
+ }
+ }
+
+ ///Request for Clone https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html
+ public partial class CloneSnapshotRequest : PlainRequestBase, ICloneSnapshotRequest
+ {
+ protected ICloneSnapshotRequest Self => this;
+ internal override ApiUrls ApiUrls => ApiUrlsLookups.SnapshotClone;
+ ////_snapshot/{repository}/{snapshot}/_clone/{target_snapshot}
+ ///this parameter is required
+ ///this parameter is required
+ ///this parameter is required
+ public CloneSnapshotRequest(Name repository, Name snapshot, Name targetSnapshot): base(r => r.Required("repository", repository).Required("snapshot", snapshot).Required("target_snapshot", targetSnapshot))
+ {
+ }
+
+ ///Used for serialization purposes, making sure we have a parameterless constructor
+ [SerializationConstructor]
+ protected CloneSnapshotRequest(): base()
+ {
+ }
+
+ // values part of the url path
+ [IgnoreDataMember]
+ Name ICloneSnapshotRequest.RepositoryName => Self.RouteValues.Get("repository");
+ [IgnoreDataMember]
+ Name ICloneSnapshotRequest.Snapshot => Self.RouteValues.Get("snapshot");
+ [IgnoreDataMember]
+ Name ICloneSnapshotRequest.TargetSnapshot => Self.RouteValues.Get("target_snapshot");
+ // Request parameters
+ ///Explicit operation timeout for connection to master node
+ public Time MasterTimeout
+ {
+ get => Q