@@ -7,7 +7,7 @@ namespace Nest
7
7
public partial interface IElasticClient
8
8
{
9
9
/// <summary>
10
- /// The bulk API makes it possible to perform many index/delete operations in a single API call.
10
+ /// The bulk API makes it possible to perform many index/delete operations in a single API call.
11
11
/// This can greatly increase the indexing speed.
12
12
/// <para> </para>http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-bulk.html
13
13
/// </summary>
@@ -28,23 +28,33 @@ public partial interface IElasticClient
28
28
public partial class ElasticClient
29
29
{
30
30
/// <inheritdoc/>
31
- public IBulkResponse Bulk ( IBulkRequest request ) =>
31
+ public IBulkResponse Bulk ( IBulkRequest request ) =>
32
32
this . Dispatcher . Dispatch < IBulkRequest , BulkRequestParameters , BulkResponse > (
33
33
request , this . LowLevelDispatch . BulkDispatch < BulkResponse >
34
34
) ;
35
35
36
36
/// <inheritdoc/>
37
- public IBulkResponse Bulk ( Func < BulkDescriptor , IBulkRequest > selector = null ) =>
38
- this . Bulk ( selector . InvokeOrDefault ( new BulkDescriptor ( ) ) ) ;
37
+ public IBulkResponse Bulk ( Func < BulkDescriptor , IBulkRequest > selector = null )
38
+ {
39
+ // selector should not be nullable, but we can't change it for backwards compatibility reasons
40
+ if ( selector == null )
41
+ throw new ArgumentNullException ( nameof ( selector ) ) ;
42
+ return this . Bulk ( selector . InvokeOrDefault ( new BulkDescriptor ( ) ) ) ;
43
+ }
39
44
40
45
/// <inheritdoc/>
41
- public Task < IBulkResponse > BulkAsync ( IBulkRequest request ) =>
46
+ public Task < IBulkResponse > BulkAsync ( IBulkRequest request ) =>
42
47
this . Dispatcher . DispatchAsync < IBulkRequest , BulkRequestParameters , BulkResponse , IBulkResponse > (
43
48
request , this . LowLevelDispatch . BulkDispatchAsync < BulkResponse >
44
49
) ;
45
50
46
51
/// <inheritdoc/>
47
- public Task < IBulkResponse > BulkAsync ( Func < BulkDescriptor , IBulkRequest > selector = null ) =>
48
- this . BulkAsync ( selector . InvokeOrDefault ( new BulkDescriptor ( ) ) ) ;
52
+ public Task < IBulkResponse > BulkAsync ( Func < BulkDescriptor , IBulkRequest > selector = null )
53
+ {
54
+ // selector should not be nullable, but we can't change it for backwards compatibility reasons
55
+ if ( selector == null )
56
+ throw new ArgumentNullException ( nameof ( selector ) ) ;
57
+ return this . BulkAsync ( selector . InvokeOrDefault ( new BulkDescriptor ( ) ) ) ;
58
+ }
49
59
}
50
- }
60
+ }
0 commit comments