Skip to content

Commit 206c5d4

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 4e2ec81 commit 206c5d4

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ public interface IBulkAllRequest<T> where T : class
4747
/// </summary>
4848
Action<BulkResponseItemBase, T> DroppedDocumentCallback { get; set; }
4949

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

5357
///<summary>The maximum number of bulk operations we want to have in flight at a time</summary>
@@ -85,7 +89,7 @@ public interface IBulkAllRequest<T> where T : class
8589
/// non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
8690
/// </summary>
8791
int? WaitForActiveShards { get; set; }
88-
92+
8993
/// <summary>
9094
/// Be notified every time a bulk response returns, this includes retries.
9195
/// <see cref="IObserver{T}.OnNext"/> is only called for successful batches.
@@ -152,7 +156,7 @@ public BulkAllRequest(IEnumerable<T> documents)
152156

153157
/// <inheritdoc />
154158
public int? WaitForActiveShards { get; set; }
155-
159+
156160
/// <inheritdoc />
157161
public Action<BulkResponse> BulkResponseCallback { get; set; }
158162
}
@@ -248,7 +252,7 @@ public BulkAllDescriptor<T> BackPressure(int maxConcurrency, int? backPressureFa
248252
/// <inheritdoc cref="IBulkAllRequest{T}.DroppedDocumentCallback" />
249253
public BulkAllDescriptor<T> DroppedDocumentCallback(Action<BulkResponseItemBase, T> callback) =>
250254
Assign(callback, (a, v) => a.DroppedDocumentCallback = v);
251-
255+
252256
/// <inheritdoc cref="IBulkAllRequest{T}.BulkResponseCallback" />
253257
public BulkAllDescriptor<T> BulkResponseCallback(Action<BulkResponse> callback) =>
254258
Assign(callback, (a, v) => a.BulkResponseCallback = v);

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) where T : class;
2434
}

0 commit comments

Comments
 (0)