Skip to content

Commit 85c0854

Browse files
authored
Add point in time APIs (#5137) (#5145)
1 parent 66e3727 commit 85c0854

14 files changed

+484
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7b8637e3a680af6a3930b2e2fc9f4f1f121bd797
1+
fb84b6710d5ee62c00f51cd041d7318691195fc3

src/Nest/Descriptors.NoNamespace.cs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ public partial class ClearScrollDescriptor : RequestDescriptorBase<ClearScrollDe
102102
// Request parameters
103103
}
104104

105+
///<summary>Descriptor for ClosePointInTime <para>https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</para></summary>
106+
public partial class ClosePointInTimeDescriptor : RequestDescriptorBase<ClosePointInTimeDescriptor, ClosePointInTimeRequestParameters, IClosePointInTimeRequest>, IClosePointInTimeRequest
107+
{
108+
internal override ApiUrls ApiUrls => ApiUrlsLookups.NoNamespaceClosePointInTime;
109+
// values part of the url path
110+
// Request parameters
111+
}
112+
105113
///<summary>Descriptor for Count <para>https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html</para></summary>
106114
public partial class CountDescriptor<TDocument> : RequestDescriptorBase<CountDescriptor<TDocument>, CountRequestParameters, ICountRequest<TDocument>>, ICountRequest<TDocument>
107115
{
@@ -1099,6 +1107,49 @@ public MultiTermVectorsDescriptor Fields<T>(params Expression<Func<T, object>>[]
10991107
public MultiTermVectorsDescriptor VersionType(VersionType? versiontype) => Qs("version_type", versiontype);
11001108
}
11011109

1110+
///<summary>Descriptor for OpenPointInTime <para>https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</para></summary>
1111+
public partial class OpenPointInTimeDescriptor : RequestDescriptorBase<OpenPointInTimeDescriptor, OpenPointInTimeRequestParameters, IOpenPointInTimeRequest>, IOpenPointInTimeRequest
1112+
{
1113+
internal override ApiUrls ApiUrls => ApiUrlsLookups.NoNamespaceOpenPointInTime;
1114+
///<summary>/_pit</summary>
1115+
public OpenPointInTimeDescriptor(): base()
1116+
{
1117+
}
1118+
1119+
///<summary>/{index}/_pit</summary>
1120+
///<param name = "index">Optional, accepts null</param>
1121+
public OpenPointInTimeDescriptor(Indices index): base(r => r.Optional("index", index))
1122+
{
1123+
}
1124+
1125+
// values part of the url path
1126+
Indices IOpenPointInTimeRequest.Index => Self.RouteValues.Get<Indices>("index");
1127+
///<summary>A comma-separated list of index names to open point in time; use the special string `_all` or Indices.All to perform the operation on all indices</summary>
1128+
public OpenPointInTimeDescriptor Index(Indices index) => Assign(index, (a, v) => a.RouteValues.Optional("index", v));
1129+
///<summary>a shortcut into calling Index(typeof(TOther))</summary>
1130+
public OpenPointInTimeDescriptor Index<TOther>()
1131+
where TOther : class => Assign(typeof(TOther), (a, v) => a.RouteValues.Optional("index", (Indices)v));
1132+
///<summary>A shortcut into calling Index(Indices.All)</summary>
1133+
public OpenPointInTimeDescriptor AllIndices() => Index(Indices.All);
1134+
// Request parameters
1135+
///<summary>Whether to expand wildcard expression to concrete indices that are open, closed or both.</summary>
1136+
public OpenPointInTimeDescriptor ExpandWildcards(ExpandWildcards? expandwildcards) => Qs("expand_wildcards", expandwildcards);
1137+
///<summary>Whether specified concrete indices should be ignored when unavailable (missing or closed)</summary>
1138+
public OpenPointInTimeDescriptor IgnoreUnavailable(bool? ignoreunavailable = true) => Qs("ignore_unavailable", ignoreunavailable);
1139+
///<summary>Specific the time to live for the point in time</summary>
1140+
public OpenPointInTimeDescriptor KeepAlive(string keepalive) => Qs("keep_alive", keepalive);
1141+
///<summary>Specify the node or shard the operation should be performed on (default: random)</summary>
1142+
public OpenPointInTimeDescriptor Preference(string preference) => Qs("preference", preference);
1143+
///<summary>
1144+
/// A document is routed to a particular shard in an index using the following formula
1145+
/// <para> shard_num = hash(_routing) % num_primary_shards</para>
1146+
/// <para>Elasticsearch will use the document id if not provided. </para>
1147+
/// <para>For requests that are constructed from/for a document NEST will automatically infer the routing key
1148+
/// if that document has a <see cref = "Nest.JoinField"/> or a routing mapping on for its type exists on <see cref = "Nest.ConnectionSettings"/></para>
1149+
///</summary>
1150+
public OpenPointInTimeDescriptor Routing(Routing routing) => Qs("routing", routing);
1151+
}
1152+
11021153
///<summary>Descriptor for Ping <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html</para></summary>
11031154
public partial class PingDescriptor : RequestDescriptorBase<PingDescriptor, PingRequestParameters, IPingRequest>, IPingRequest
11041155
{

src/Nest/ElasticClient.NoNamespace.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,30 @@ partial void SetupNamespaces()
288288
/// </summary>
289289
public Task<ClearScrollResponse> ClearScrollAsync(IClearScrollRequest request, CancellationToken ct = default) => DoRequestAsync<IClearScrollRequest, ClearScrollResponse>(request, request.RequestParameters, ct);
290290
/// <summary>
291+
/// <c>DELETE</c> request to the <c>close_point_in_time</c> API, read more about this API online:
292+
/// <para></para>
293+
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</a>
294+
/// </summary>
295+
public ClosePointInTimeResponse ClosePointInTime(Func<ClosePointInTimeDescriptor, IClosePointInTimeRequest> selector = null) => ClosePointInTime(selector.InvokeOrDefault(new ClosePointInTimeDescriptor()));
296+
/// <summary>
297+
/// <c>DELETE</c> request to the <c>close_point_in_time</c> API, read more about this API online:
298+
/// <para></para>
299+
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</a>
300+
/// </summary>
301+
public Task<ClosePointInTimeResponse> ClosePointInTimeAsync(Func<ClosePointInTimeDescriptor, IClosePointInTimeRequest> selector = null, CancellationToken ct = default) => ClosePointInTimeAsync(selector.InvokeOrDefault(new ClosePointInTimeDescriptor()), ct);
302+
/// <summary>
303+
/// <c>DELETE</c> request to the <c>close_point_in_time</c> API, read more about this API online:
304+
/// <para></para>
305+
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</a>
306+
/// </summary>
307+
public ClosePointInTimeResponse ClosePointInTime(IClosePointInTimeRequest request) => DoRequest<IClosePointInTimeRequest, ClosePointInTimeResponse>(request, request.RequestParameters);
308+
/// <summary>
309+
/// <c>DELETE</c> request to the <c>close_point_in_time</c> API, read more about this API online:
310+
/// <para></para>
311+
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</a>
312+
/// </summary>
313+
public Task<ClosePointInTimeResponse> ClosePointInTimeAsync(IClosePointInTimeRequest request, CancellationToken ct = default) => DoRequestAsync<IClosePointInTimeRequest, ClosePointInTimeResponse>(request, request.RequestParameters, ct);
314+
/// <summary>
291315
/// <c>POST</c> request to the <c>count</c> API, read more about this API online:
292316
/// <para></para>
293317
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html</a>
@@ -774,6 +798,30 @@ public Task<IndexResponse> IndexAsync<TDocument>(IIndexRequest<TDocument> reques
774798
/// </summary>
775799
public Task<MultiTermVectorsResponse> MultiTermVectorsAsync(IMultiTermVectorsRequest request, CancellationToken ct = default) => DoRequestAsync<IMultiTermVectorsRequest, MultiTermVectorsResponse>(request, request.RequestParameters, ct);
776800
/// <summary>
801+
/// <c>POST</c> request to the <c>open_point_in_time</c> API, read more about this API online:
802+
/// <para></para>
803+
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</a>
804+
/// </summary>
805+
public OpenPointInTimeResponse OpenPointInTime(Indices index = null, Func<OpenPointInTimeDescriptor, IOpenPointInTimeRequest> selector = null) => OpenPointInTime(selector.InvokeOrDefault(new OpenPointInTimeDescriptor().Index(index: index)));
806+
/// <summary>
807+
/// <c>POST</c> request to the <c>open_point_in_time</c> API, read more about this API online:
808+
/// <para></para>
809+
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</a>
810+
/// </summary>
811+
public Task<OpenPointInTimeResponse> OpenPointInTimeAsync(Indices index = null, Func<OpenPointInTimeDescriptor, IOpenPointInTimeRequest> selector = null, CancellationToken ct = default) => OpenPointInTimeAsync(selector.InvokeOrDefault(new OpenPointInTimeDescriptor().Index(index: index)), ct);
812+
/// <summary>
813+
/// <c>POST</c> request to the <c>open_point_in_time</c> API, read more about this API online:
814+
/// <para></para>
815+
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</a>
816+
/// </summary>
817+
public OpenPointInTimeResponse OpenPointInTime(IOpenPointInTimeRequest request) => DoRequest<IOpenPointInTimeRequest, OpenPointInTimeResponse>(request, request.RequestParameters);
818+
/// <summary>
819+
/// <c>POST</c> request to the <c>open_point_in_time</c> API, read more about this API online:
820+
/// <para></para>
821+
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</a>
822+
/// </summary>
823+
public Task<OpenPointInTimeResponse> OpenPointInTimeAsync(IOpenPointInTimeRequest request, CancellationToken ct = default) => DoRequestAsync<IOpenPointInTimeRequest, OpenPointInTimeResponse>(request, request.RequestParameters, ct);
824+
/// <summary>
777825
/// <c>HEAD</c> request to the <c>ping</c> API, read more about this API online:
778826
/// <para></para>
779827
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html</a>

src/Nest/IElasticClient.Generated.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,30 @@ NodesNamespace Nodes
185185
/// </summary>
186186
Task<ClearScrollResponse> ClearScrollAsync(IClearScrollRequest request, CancellationToken ct = default);
187187
/// <summary>
188+
/// <c>DELETE</c> request to the <c>close_point_in_time</c> API, read more about this API online:
189+
/// <para></para>
190+
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</a>
191+
/// </summary>
192+
ClosePointInTimeResponse ClosePointInTime(Func<ClosePointInTimeDescriptor, IClosePointInTimeRequest> selector = null);
193+
/// <summary>
194+
/// <c>DELETE</c> request to the <c>close_point_in_time</c> API, read more about this API online:
195+
/// <para></para>
196+
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</a>
197+
/// </summary>
198+
Task<ClosePointInTimeResponse> ClosePointInTimeAsync(Func<ClosePointInTimeDescriptor, IClosePointInTimeRequest> selector = null, CancellationToken ct = default);
199+
/// <summary>
200+
/// <c>DELETE</c> request to the <c>close_point_in_time</c> API, read more about this API online:
201+
/// <para></para>
202+
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</a>
203+
/// </summary>
204+
ClosePointInTimeResponse ClosePointInTime(IClosePointInTimeRequest request);
205+
/// <summary>
206+
/// <c>DELETE</c> request to the <c>close_point_in_time</c> API, read more about this API online:
207+
/// <para></para>
208+
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</a>
209+
/// </summary>
210+
Task<ClosePointInTimeResponse> ClosePointInTimeAsync(IClosePointInTimeRequest request, CancellationToken ct = default);
211+
/// <summary>
188212
/// <c>POST</c> request to the <c>count</c> API, read more about this API online:
189213
/// <para></para>
190214
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html</a>
@@ -671,6 +695,30 @@ Task<IndexResponse> IndexAsync<TDocument>(IIndexRequest<TDocument> request, Canc
671695
/// </summary>
672696
Task<MultiTermVectorsResponse> MultiTermVectorsAsync(IMultiTermVectorsRequest request, CancellationToken ct = default);
673697
/// <summary>
698+
/// <c>POST</c> request to the <c>open_point_in_time</c> API, read more about this API online:
699+
/// <para></para>
700+
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</a>
701+
/// </summary>
702+
OpenPointInTimeResponse OpenPointInTime(Indices index = null, Func<OpenPointInTimeDescriptor, IOpenPointInTimeRequest> selector = null);
703+
/// <summary>
704+
/// <c>POST</c> request to the <c>open_point_in_time</c> API, read more about this API online:
705+
/// <para></para>
706+
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</a>
707+
/// </summary>
708+
Task<OpenPointInTimeResponse> OpenPointInTimeAsync(Indices index = null, Func<OpenPointInTimeDescriptor, IOpenPointInTimeRequest> selector = null, CancellationToken ct = default);
709+
/// <summary>
710+
/// <c>POST</c> request to the <c>open_point_in_time</c> API, read more about this API online:
711+
/// <para></para>
712+
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</a>
713+
/// </summary>
714+
OpenPointInTimeResponse OpenPointInTime(IOpenPointInTimeRequest request);
715+
/// <summary>
716+
/// <c>POST</c> request to the <c>open_point_in_time</c> API, read more about this API online:
717+
/// <para></para>
718+
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html">https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</a>
719+
/// </summary>
720+
Task<OpenPointInTimeResponse> OpenPointInTimeAsync(IOpenPointInTimeRequest request, CancellationToken ct = default);
721+
/// <summary>
674722
/// <c>HEAD</c> request to the <c>ping</c> API, read more about this API online:
675723
/// <para></para>
676724
/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html</a>

src/Nest/Requests.NoNamespace.cs

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,20 @@ public partial class ClearScrollRequest : PlainRequestBase<ClearScrollRequestPar
167167
// Request parameters
168168
}
169169

170+
[InterfaceDataContract]
171+
public partial interface IClosePointInTimeRequest : IRequest<ClosePointInTimeRequestParameters>
172+
{
173+
}
174+
175+
///<summary>Request for ClosePointInTime <para>https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</para></summary>
176+
public partial class ClosePointInTimeRequest : PlainRequestBase<ClosePointInTimeRequestParameters>, IClosePointInTimeRequest
177+
{
178+
protected IClosePointInTimeRequest Self => this;
179+
internal override ApiUrls ApiUrls => ApiUrlsLookups.NoNamespaceClosePointInTime;
180+
// values part of the url path
181+
// Request parameters
182+
}
183+
170184
[InterfaceDataContract]
171185
public partial interface ICountRequest : IRequest<CountRequestParameters>
172186
{
@@ -2337,6 +2351,79 @@ public VersionType? VersionType
23372351
}
23382352
}
23392353

2354+
[InterfaceDataContract]
2355+
public partial interface IOpenPointInTimeRequest : IRequest<OpenPointInTimeRequestParameters>
2356+
{
2357+
[IgnoreDataMember]
2358+
Indices Index
2359+
{
2360+
get;
2361+
}
2362+
}
2363+
2364+
///<summary>Request for OpenPointInTime <para>https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</para></summary>
2365+
public partial class OpenPointInTimeRequest : PlainRequestBase<OpenPointInTimeRequestParameters>, IOpenPointInTimeRequest
2366+
{
2367+
protected IOpenPointInTimeRequest Self => this;
2368+
internal override ApiUrls ApiUrls => ApiUrlsLookups.NoNamespaceOpenPointInTime;
2369+
///<summary>/_pit</summary>
2370+
public OpenPointInTimeRequest(): base()
2371+
{
2372+
}
2373+
2374+
///<summary>/{index}/_pit</summary>
2375+
///<param name = "index">Optional, accepts null</param>
2376+
public OpenPointInTimeRequest(Indices index): base(r => r.Optional("index", index))
2377+
{
2378+
}
2379+
2380+
// values part of the url path
2381+
[IgnoreDataMember]
2382+
Indices IOpenPointInTimeRequest.Index => Self.RouteValues.Get<Indices>("index");
2383+
// Request parameters
2384+
///<summary>Whether to expand wildcard expression to concrete indices that are open, closed or both.</summary>
2385+
public ExpandWildcards? ExpandWildcards
2386+
{
2387+
get => Q<ExpandWildcards? >("expand_wildcards");
2388+
set => Q("expand_wildcards", value);
2389+
}
2390+
2391+
///<summary>Whether specified concrete indices should be ignored when unavailable (missing or closed)</summary>
2392+
public bool? IgnoreUnavailable
2393+
{
2394+
get => Q<bool? >("ignore_unavailable");
2395+
set => Q("ignore_unavailable", value);
2396+
}
2397+
2398+
///<summary>Specific the time to live for the point in time</summary>
2399+
public string KeepAlive
2400+
{
2401+
get => Q<string>("keep_alive");
2402+
set => Q("keep_alive", value);
2403+
}
2404+
2405+
///<summary>Specify the node or shard the operation should be performed on (default: random)</summary>
2406+
public string Preference
2407+
{
2408+
get => Q<string>("preference");
2409+
set => Q("preference", value);
2410+
}
2411+
2412+
///<summary>
2413+
/// A document is routed to a particular shard in an index using the following formula
2414+
/// <para> shard_num = hash(_routing) % num_primary_shards</para>
2415+
/// <para>Elasticsearch will use the document id if not provided. </para>
2416+
/// <para>For requests that are constructed from/for a document NEST will automatically infer the routing key
2417+
/// if that document has a <see cref = "Nest.JoinField"/> or a routing mapping on for its type exists on <see cref = "Nest.ConnectionSettings"
2418+
////></para>
2419+
///</summary>
2420+
public Routing Routing
2421+
{
2422+
get => Q<Routing>("routing");
2423+
set => Q("routing", value);
2424+
}
2425+
}
2426+
23402427
[InterfaceDataContract]
23412428
public partial interface IPingRequest : IRequest<PingRequestParameters>
23422429
{
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+
5+
using System.Runtime.Serialization;
6+
7+
namespace Nest
8+
{
9+
[MapsApi("close_point_in_time.json")]
10+
public partial interface IClosePointInTimeRequest
11+
{
12+
/// <summary>
13+
/// The ID of the point in time to close.
14+
/// </summary>
15+
[DataMember(Name = "id")]
16+
string Id { get; set; }
17+
}
18+
19+
/// <inheritdoc cref="ClosePointInTimeRequest" />
20+
public partial class ClosePointInTimeRequest
21+
{
22+
/// <inheritdoc />
23+
public string Id { get; set; }
24+
}
25+
26+
public partial class ClosePointInTimeDescriptor
27+
{
28+
string IClosePointInTimeRequest.Id { get; set; }
29+
30+
/// <inheritdoc cref="IClosePointInTimeRequest.Id" />
31+
public ClosePointInTimeDescriptor Id(string id) => Assign(id, (a, v) => a.Id = v);
32+
}
33+
}

0 commit comments

Comments
 (0)