Skip to content

Commit 2d9502a

Browse files
authored
Add point in time APIs (#5137)
1 parent 3ffcda0 commit 2d9502a

14 files changed

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

src/Nest/Descriptors.NoNamespace.cs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ public partial class ClearScrollDescriptor : RequestDescriptorBase<ClearScrollDe
9494
// Request parameters
9595
}
9696

97+
///<summary>Descriptor for ClosePointInTime <para>https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</para></summary>
98+
public partial class ClosePointInTimeDescriptor : RequestDescriptorBase<ClosePointInTimeDescriptor, ClosePointInTimeRequestParameters, IClosePointInTimeRequest>, IClosePointInTimeRequest
99+
{
100+
internal override ApiUrls ApiUrls => ApiUrlsLookups.NoNamespaceClosePointInTime;
101+
// values part of the url path
102+
// Request parameters
103+
}
104+
97105
///<summary>Descriptor for Count <para>https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html</para></summary>
98106
public partial class CountDescriptor<TDocument> : RequestDescriptorBase<CountDescriptor<TDocument>, CountRequestParameters, ICountRequest<TDocument>>, ICountRequest<TDocument>
99107
{
@@ -1093,6 +1101,49 @@ public MultiTermVectorsDescriptor Fields<T>(params Expression<Func<T, object>>[]
10931101
public MultiTermVectorsDescriptor VersionType(VersionType? versiontype) => Qs("version_type", versiontype);
10941102
}
10951103

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

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
@@ -159,6 +159,20 @@ public partial class ClearScrollRequest : PlainRequestBase<ClearScrollRequestPar
159159
// Request parameters
160160
}
161161

162+
[InterfaceDataContract]
163+
public partial interface IClosePointInTimeRequest : IRequest<ClosePointInTimeRequestParameters>
164+
{
165+
}
166+
167+
///<summary>Request for ClosePointInTime <para>https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</para></summary>
168+
public partial class ClosePointInTimeRequest : PlainRequestBase<ClosePointInTimeRequestParameters>, IClosePointInTimeRequest
169+
{
170+
protected IClosePointInTimeRequest Self => this;
171+
internal override ApiUrls ApiUrls => ApiUrlsLookups.NoNamespaceClosePointInTime;
172+
// values part of the url path
173+
// Request parameters
174+
}
175+
162176
[InterfaceDataContract]
163177
public partial interface ICountRequest : IRequest<CountRequestParameters>
164178
{
@@ -2336,6 +2350,79 @@ public VersionType? VersionType
23362350
}
23372351
}
23382352

2353+
[InterfaceDataContract]
2354+
public partial interface IOpenPointInTimeRequest : IRequest<OpenPointInTimeRequestParameters>
2355+
{
2356+
[IgnoreDataMember]
2357+
Indices Index
2358+
{
2359+
get;
2360+
}
2361+
}
2362+
2363+
///<summary>Request for OpenPointInTime <para>https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html</para></summary>
2364+
public partial class OpenPointInTimeRequest : PlainRequestBase<OpenPointInTimeRequestParameters>, IOpenPointInTimeRequest
2365+
{
2366+
protected IOpenPointInTimeRequest Self => this;
2367+
internal override ApiUrls ApiUrls => ApiUrlsLookups.NoNamespaceOpenPointInTime;
2368+
///<summary>/_pit</summary>
2369+
public OpenPointInTimeRequest(): base()
2370+
{
2371+
}
2372+
2373+
///<summary>/{index}/_pit</summary>
2374+
///<param name = "index">Optional, accepts null</param>
2375+
public OpenPointInTimeRequest(Indices index): base(r => r.Optional("index", index))
2376+
{
2377+
}
2378+
2379+
// values part of the url path
2380+
[IgnoreDataMember]
2381+
Indices IOpenPointInTimeRequest.Index => Self.RouteValues.Get<Indices>("index");
2382+
// Request parameters
2383+
///<summary>Whether to expand wildcard expression to concrete indices that are open, closed or both.</summary>
2384+
public ExpandWildcards? ExpandWildcards
2385+
{
2386+
get => Q<ExpandWildcards? >("expand_wildcards");
2387+
set => Q("expand_wildcards", value);
2388+
}
2389+
2390+
///<summary>Whether specified concrete indices should be ignored when unavailable (missing or closed)</summary>
2391+
public bool? IgnoreUnavailable
2392+
{
2393+
get => Q<bool? >("ignore_unavailable");
2394+
set => Q("ignore_unavailable", value);
2395+
}
2396+
2397+
///<summary>Specific the time to live for the point in time</summary>
2398+
public string KeepAlive
2399+
{
2400+
get => Q<string>("keep_alive");
2401+
set => Q("keep_alive", value);
2402+
}
2403+
2404+
///<summary>Specify the node or shard the operation should be performed on (default: random)</summary>
2405+
public string Preference
2406+
{
2407+
get => Q<string>("preference");
2408+
set => Q("preference", value);
2409+
}
2410+
2411+
///<summary>
2412+
/// A document is routed to a particular shard in an index using the following formula
2413+
/// <para> shard_num = hash(_routing) % num_primary_shards</para>
2414+
/// <para>Elasticsearch will use the document id if not provided. </para>
2415+
/// <para>For requests that are constructed from/for a document NEST will automatically infer the routing key
2416+
/// if that document has a <see cref = "Nest.JoinField"/> or a routing mapping on for its type exists on <see cref = "Nest.ConnectionSettings"
2417+
////></para>
2418+
///</summary>
2419+
public Routing Routing
2420+
{
2421+
get => Q<Routing>("routing");
2422+
set => Q("routing", value);
2423+
}
2424+
}
2425+
23392426
[InterfaceDataContract]
23402427
public partial interface IPingRequest : IRequest<PingRequestParameters>
23412428
{
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)