Skip to content

Commit 5260861

Browse files
committed
Favor long on id parameters fix #570
1 parent 1eccd2a commit 5260861

File tree

20 files changed

+62
-51
lines changed

20 files changed

+62
-51
lines changed

src/Nest/ConvenienceExtensions/DeleteExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static class DeleteExtensions
1717
/// <param name="client"></param>
1818
/// <param name="id">The id as int of the document you want to delete</param>
1919
/// <param name="selector">An optional descriptor to further describe the delete operation</param>
20-
public static IDeleteResponse Delete<T>(this IElasticClient client, int id, Func<DeleteDescriptor<T>, DeleteDescriptor<T>> selector = null) where T : class
20+
public static IDeleteResponse Delete<T>(this IElasticClient client, long id, Func<DeleteDescriptor<T>, DeleteDescriptor<T>> selector = null) where T : class
2121
{
2222
selector = selector ?? (s => s);
2323
return client.Delete<T>(s => selector(s.Id(id)));
@@ -45,7 +45,7 @@ public static IDeleteResponse Delete<T>(this IElasticClient client, string id, F
4545
/// <param name="client"></param>
4646
/// <param name="id">The id as int of the document you want to delete</param>
4747
/// <param name="selector">An optional descriptor to further describe the delete operation</param>
48-
public static Task<IDeleteResponse> DeleteAsync<T>(this IElasticClient client, int id, Func<DeleteDescriptor<T>, DeleteDescriptor<T>> selector = null) where T : class
48+
public static Task<IDeleteResponse> DeleteAsync<T>(this IElasticClient client, long id, Func<DeleteDescriptor<T>, DeleteDescriptor<T>> selector = null) where T : class
4949
{
5050
selector = selector ?? (s => s);
5151
return client.DeleteAsync<T>(s => selector(s.Id(id)));

src/Nest/ConvenienceExtensions/GetExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ public static IGetResponse<T> Get<T>(this IElasticClient client, string id, stri
2828
/// </summary>
2929
/// <typeparam name="T">The type used to infer the default index and typename</typeparam>
3030
/// <param name="client"></param>
31-
/// <param name="id">The int id of the document we want the fetch</param>
31+
/// <param name="id">The long id of the document we want the fetch</param>
3232
/// <param name="index">Optionally override the inferred index name for T</param>
3333
/// <param name="type">Optionally override the inferred typename for T</param>
34-
public static IGetResponse<T> Get<T>(this IElasticClient client, int id, string index = null, string type = null)
34+
public static IGetResponse<T> Get<T>(this IElasticClient client, long id, string index = null, string type = null)
3535
where T : class
3636
{
3737
return client.Get<T>(s => s.Id(id).Index(index).Type(type));
@@ -58,10 +58,10 @@ public static Task<IGetResponse<T>> GetAsync<T>(this IElasticClient client, stri
5858
/// </summary>
5959
/// <typeparam name="T">The type used to infer the default index and typename</typeparam>
6060
/// <param name="client"></param>
61-
/// <param name="id">The int id of the document we want the fetch</param>
61+
/// <param name="id">The long id of the document we want the fetch</param>
6262
/// <param name="index">Optionally override the inferred index name for T</param>
6363
/// <param name="type">Optionally override the inferred typename for T</param>
64-
public static Task<IGetResponse<T>> GetAsync<T>(this IElasticClient client, int id, string index = null, string type = null)
64+
public static Task<IGetResponse<T>> GetAsync<T>(this IElasticClient client, long id, string index = null, string type = null)
6565
where T : class
6666
{
6767
return client.GetAsync<T>(s => s.Id(id).Index(index).Type(type));

src/Nest/ConvenienceExtensions/GetManyExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static IEnumerable<IMultiGetHit<T>> GetMany<T>(this IElasticClient client
3939
/// <param name="ids">IEnumerable of ids as ints for the documents to fetch</param>
4040
/// <param name="index">Optionally override the default inferred index name for T</param>
4141
/// <param name="type">Optionally overiide the default inferred typename for T</param>
42-
public static IEnumerable<IMultiGetHit<T>> GetMany<T>(this IElasticClient client, IEnumerable<int> ids, string index = null, string type = null)
42+
public static IEnumerable<IMultiGetHit<T>> GetMany<T>(this IElasticClient client, IEnumerable<long> ids, string index = null, string type = null)
4343
where T : class
4444
{
4545
return client.GetMany<T>(ids.Select(i => i.ToString(CultureInfo.InvariantCulture)), index, type);
@@ -74,7 +74,7 @@ public static Task<IEnumerable<IMultiGetHit<T>>> GetManyAsync<T>(this IElasticCl
7474
/// <param name="ids">IEnumerable of ids as ints for the documents to fetch</param>
7575
/// <param name="index">Optionally override the default inferred index name for T</param>
7676
/// <param name="type">Optionally overiide the default inferred typename for T</param>
77-
public static Task<IEnumerable<IMultiGetHit<T>>> GetManyAsync<T>(this IElasticClient client, IEnumerable<int> ids, string index = null, string type = null)
77+
public static Task<IEnumerable<IMultiGetHit<T>>> GetManyAsync<T>(this IElasticClient client, IEnumerable<long> ids, string index = null, string type = null)
7878
where T : class
7979
{
8080
return client.GetManyAsync<T>(ids.Select(i => i.ToString(CultureInfo.InvariantCulture)), index, type);

src/Nest/ConvenienceExtensions/SourceExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace Nest
44
{
55
/// <summary>
66
/// Provides convenience extension methods that make it easier to get the _source for
7-
/// a given document given a string or int id.
7+
/// a given document given a string or long id.
88
/// </summary>
99
public static class SourceExtensions
1010
{
@@ -34,7 +34,7 @@ public static T Source<T>(this IElasticClient client, string id, string index =
3434
/// <param name="id">id as int of the document we want the _source from</param>
3535
/// <param name="index">Optionally override the inferred index name for T</param>
3636
/// <param name="type">Optionally override the inferred type name for T</param>
37-
public static T Source<T>(this IElasticClient client, int id, string index = null, string type = null)
37+
public static T Source<T>(this IElasticClient client, long id, string index = null, string type = null)
3838
where T : class
3939
{
4040
return client.Source<T>(s => s.Id(id).Index(index).Type(type));
@@ -66,7 +66,7 @@ public static Task<T> SourceAsync<T>(this IElasticClient client, string id, stri
6666
/// <param name="id">id as int of the document we want the _source from</param>
6767
/// <param name="index">Optionally override the inferred index name for T</param>
6868
/// <param name="type">Optionally override the inferred type name for T</param>
69-
public static Task<T> SourceAsync<T>(this IElasticClient client, int id, string index = null, string type = null)
69+
public static Task<T> SourceAsync<T>(this IElasticClient client, long id, string index = null, string type = null)
7070
where T : class
7171
{
7272
return client.SourceAsync<T>(s => s.Id(id).Index(index).Type(type));

src/Nest/ConvenienceExtensions/SourceManyExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static IEnumerable<T> SourceMany<T>(this IElasticClient client, IEnumerab
4545
/// <param name="ids">A list of ids as int</param>
4646
/// <param name="index">Optionally override the default inferred indexname for T</param>
4747
/// <param name="type">Optionally override the default inferred indexname for T</param>
48-
public static IEnumerable<T> SourceMany<T>(this IElasticClient client, IEnumerable<int> ids, string index = null, string type = null)
48+
public static IEnumerable<T> SourceMany<T>(this IElasticClient client, IEnumerable<long> ids, string index = null, string type = null)
4949
where T : class
5050
{
5151
return client.SourceMany<T>(ids.Select(i => i.ToString(CultureInfo.InvariantCulture)), index, type);
@@ -86,7 +86,7 @@ public static Task<IEnumerable<T>> SourceManyAsync<T>(this IElasticClient client
8686
/// <param name="ids">A list of ids as int</param>
8787
/// <param name="index">Optionally override the default inferred indexname for T</param>
8888
/// <param name="type">Optionally override the default inferred indexname for T</param>
89-
public static Task<IEnumerable<T>> SourceManyAsync<T>(this IElasticClient client, IEnumerable<int> ids, string index = null, string type = null)
89+
public static Task<IEnumerable<T>> SourceManyAsync<T>(this IElasticClient client, IEnumerable<long> ids, string index = null, string type = null)
9090
where T : class
9191
{
9292
return client.SourceManyAsync<T>(ids.Select(i => i.ToString(CultureInfo.InvariantCulture)), index, type);

src/Nest/DSL/BulkCreateDescriptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public BulkCreateDescriptor<T> Type(Type type)
5656
/// <summary>
5757
/// Manually set the id for the newly created object
5858
/// </summary>
59-
public BulkCreateDescriptor<T> Id(int id)
59+
public BulkCreateDescriptor<T> Id(long id)
6060
{
6161
return this.Id(id.ToString(CultureInfo.InvariantCulture));
6262
}

src/Nest/DSL/BulkDeleteDescriptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public BulkDeleteDescriptor<T> Type(Type type)
5656
/// <summary>
5757
/// Manually set the id for the newly created object
5858
/// </summary>
59-
public BulkDeleteDescriptor<T> Id(int id)
59+
public BulkDeleteDescriptor<T> Id(long id)
6060
{
6161
return this.Id(id.ToString(CultureInfo.InvariantCulture));
6262
}

src/Nest/DSL/BulkDescriptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public BulkDescriptor DeleteMany<T>(IEnumerable<string> ids, Func<BulkDeleteDesc
107107
/// </summary>
108108
/// <param name="ids">Enumerable of int ids to delete</param>
109109
/// <param name="bulkDeleteSelector">A func called on each ids to describe the individual delete operation</param>
110-
public BulkDescriptor DeleteMany<T>(IEnumerable<int> ids, Func<BulkDeleteDescriptor<T>, string, BulkDeleteDescriptor<T>> bulkDeleteSelector = null) where T : class
110+
public BulkDescriptor DeleteMany<T>(IEnumerable<long> ids, Func<BulkDeleteDescriptor<T>, string, BulkDeleteDescriptor<T>> bulkDeleteSelector = null) where T : class
111111
{
112112
return this.DeleteMany(ids.Select(i=>i.ToString(CultureInfo.InvariantCulture)), bulkDeleteSelector);
113113
}

src/Nest/DSL/BulkIndexDescriptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public BulkIndexDescriptor<T> Type(Type type)
5656
/// <summary>
5757
/// Manually set the id for the newly created object
5858
/// </summary>
59-
public BulkIndexDescriptor<T> Id(int id)
59+
public BulkIndexDescriptor<T> Id(long id)
6060
{
6161
return this.Id(id.ToString(CultureInfo.InvariantCulture));
6262
}

src/Nest/DSL/BulkUpdateDescriptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public BulkUpdateDescriptor<T, K> Type(Type type)
7575
/// <summary>
7676
/// Manually set the id for the newly created object
7777
/// </summary>
78-
public BulkUpdateDescriptor<T, K> Id(int id)
78+
public BulkUpdateDescriptor<T, K> Id(long id)
7979
{
8080
return this.Id(id.ToString(CultureInfo.InvariantCulture));
8181
}

0 commit comments

Comments
 (0)