Skip to content

Commit 607ccdb

Browse files
committed
Add XML docs for index inference on BulkAll (#4017)
This commit adds additional XML docs to indicate that Index on BulkAllRequest<T> will be inferred from T. When a default index has not been mapped for T on ConnectionSettings, using DefaultMappingFor<T>(m => m.IndexName("some_index")), an exception will be thrown. Closes #3951 (cherry picked from commit 11d3ba3)
1 parent 623c724 commit 607ccdb

File tree

2 files changed

+38
-10
lines changed

2 files changed

+38
-10
lines changed

src/Nest/Document/Multiple/BulkAll/BulkAllRequest.cs

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ namespace Nest
77
{
88
public interface IBulkAllRequest<T> where T : class
99
{
10-
/// <summary> In case of a HTTP 429 (Too Many Requests) response status code, how many times should we automatically back off before failing</summary>
10+
/// <summary>
11+
/// In case of a HTTP 429 (Too Many Requests) response status code, how many times should we automatically back
12+
/// off before failing
13+
/// </summary>
1114
int? BackOffRetries { get; set; }
1215

1316
/// <summary> In case of a HTTP 429 (Too Many Requests) response status code, how long should we wait before retrying</summary>
@@ -22,7 +25,8 @@ public interface IBulkAllRequest<T> where T : class
2225

2326
/// <summary>
2427
/// By default, <see cref="BulkAllObservable{T}" /> calls <see cref="BulkDescriptor.IndexMany{T}" /> on the buffer.
25-
/// There might be case where you'd like more control over the bulk operation. By setting this callback, you are in complete control
28+
/// There might be case where you'd like more control over the bulk operation. By setting this callback, you are in
29+
/// complete control
2630
/// of describing how the buffer should be translated to a bulk operation.
2731
/// </summary>
2832
Action<BulkDescriptor, IList<T>> BufferToBulk { get; set; }
@@ -43,12 +47,18 @@ public interface IBulkAllRequest<T> where T : class
4347

4448
/// <summary>
4549
/// If a bulk operation fails because it receives documents it can not retry they will be fed to this callback.
46-
/// If <see cref="ContinueAfterDroppedDocuments" /> is set to <c>true</c> processing will continue, so this callback can be used
50+
/// If <see cref="ContinueAfterDroppedDocuments" /> is set to <c>true</c> processing will continue, so this callback can be
51+
/// used
4752
/// to feed into a dead letter queue. Otherwise bulk all indexing will be halted.
4853
/// </summary>
4954
Action<IBulkResponseItem, T> DroppedDocumentCallback { get; set; }
5055

51-
///<summary>Default index for items which don't provide one</summary>
56+
/// <summary>
57+
/// The index to use for items that don't specify one. By default, will be inferred from <typeparamref name="T" />.
58+
/// If no default index has been mapped for <typeparamref name="T" />
59+
/// using <see cref="ConnectionSettingsBase{TConnectionSettings}.DefaultMappingFor{TDocument}" />
60+
/// on <see cref="Nest.ConnectionSettings" />, an exception will be thrown.
61+
/// </summary>
5262
IndexName Index { get; set; }
5363

5464
///<summary>The maximum number of bulk operations we want to have in flight at a time</summary>
@@ -253,16 +263,24 @@ public BulkAllDescriptor<T> RetryDocumentPredicate(Func<IBulkResponseItem, T, bo
253263
/// Simple back pressure implementation that makes sure the minimum max concurrency between producer and consumer
254264
/// is not amplified by the greedier of the two by more then a given back pressure factor
255265
/// When set each scroll request will additionally wait on <see cref="ProducerConsumerBackPressure.WaitAsync" /> as well as
256-
/// <see cref="MaxDegreeOfParallelism" /> if set. Not that the consumer has to call <see cref="ProducerConsumerBackPressure.Release" />
266+
/// <see cref="MaxDegreeOfParallelism" /> if set. Not that the consumer has to call
267+
/// <see cref="ProducerConsumerBackPressure.Release" />
257268
/// on the same instance every time it is done.
258269
/// </summary>
259-
/// <param name="maxConcurrency">The minimum maximum concurrency which would be the bottleneck of the producer consumer pipeline</param>
260-
/// <param name="backPressureFactor">The maximum amplification back pressure of the greedier part of the producer consumer pipeline</param>
270+
/// <param name="maxConcurrency">
271+
/// The minimum maximum concurrency which would be the bottleneck of the producer consumer
272+
/// pipeline
273+
/// </param>
274+
/// <param name="backPressureFactor">
275+
/// The maximum amplification back pressure of the greedier part of the producer consumer
276+
/// pipeline
277+
/// </param>
261278
public BulkAllDescriptor<T> BackPressure(int maxConcurrency, int? backPressureFactor = null) =>
262279
Assign(new ProducerConsumerBackPressure(backPressureFactor, maxConcurrency), (a, v) => a.BackPressure = v);
263280

264281
/// <inheritdoc cref="IBulkAllRequest{T}.ContinueAfterDroppedDocuments" />
265-
public BulkAllDescriptor<T> ContinueAfterDroppedDocuments(bool proceed = true) => Assign(proceed, (a, v) => a.ContinueAfterDroppedDocuments = v);
282+
public BulkAllDescriptor<T> ContinueAfterDroppedDocuments(bool proceed = true) =>
283+
Assign(proceed, (a, v) => a.ContinueAfterDroppedDocuments = v);
266284

267285
/// <inheritdoc cref="IBulkAllRequest{T}.DroppedDocumentCallback" />
268286
public BulkAllDescriptor<T> DroppedDocumentCallback(Action<IBulkResponseItem, T> callback) =>

src/Nest/Document/Multiple/BulkAll/ElasticClient-BulkAll.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ namespace Nest
77
public partial interface IElasticClient
88
{
99
/// <summary>
10-
/// BulkAll is a generic helper that will partition any lazy stream of documents and send them to elasticsearch as bulks concurrently
10+
/// BulkAll is a generic helper that will partition any lazy stream of documents and send them to Elasticsearch as concurrent bulk requests.
11+
/// <para />
12+
/// The index to target will be inferred from <typeparamref name="T" />. If no default index has been mapped for <typeparamref name="T" />
13+
/// using <see cref="ConnectionSettingsBase{TConnectionSettings}.DefaultMappingFor{TDocument}"/> on <see cref="Nest.ConnectionSettings"/>, an exception will be thrown.
14+
/// Inference can be overridden using <see cref="BulkAllDescriptor{T}.Index"/>, and in addition,
15+
/// an index can be specified for each document using <see cref="BulkAllDescriptor{T}.BufferToBulk"/>.
1116
/// </summary>
1217
/// <param name="documents">The lazy stream of documents</param>
1318
BulkAllObservable<T> BulkAll<T>(
@@ -18,7 +23,12 @@ BulkAllObservable<T> BulkAll<T>(
1823
where T : class;
1924

2025
/// <summary>
21-
/// BulkAll is a generic helper that will partition any lazy stream of documents and send them to elasticsearch as bulks concurrently
26+
/// BulkAll is a generic helper that will partition any lazy stream of documents and send them to Elasticsearch as concurrent bulk requests
27+
/// <para />
28+
/// The index to target will be inferred from <typeparamref name="T" />. If no default index has been mapped for <typeparamref name="T" />
29+
/// using <see cref="ConnectionSettingsBase{TConnectionSettings}.DefaultMappingFor{TDocument}"/> on <see cref="Nest.ConnectionSettings"/>, an exception will be thrown.
30+
/// Inference can be overridden using <see cref="IBulkAllRequest{T}.Index"/>, and in addition,
31+
/// an index can be specified for each document using <see cref="IBulkAllRequest{T}.BufferToBulk"/>.
2232
/// </summary>
2333
BulkAllObservable<T> BulkAll<T>(IBulkAllRequest<T> request, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
2434
}

0 commit comments

Comments
 (0)