|
15 | 15 | */
|
16 | 16 | package org.springframework.data.elasticsearch.client.reactive;
|
17 | 17 |
|
| 18 | +import org.elasticsearch.action.bulk.BulkRequest; |
| 19 | +import org.elasticsearch.action.bulk.BulkResponse; |
18 | 20 | import reactor.core.publisher.Flux;
|
19 | 21 | import reactor.core.publisher.Mono;
|
20 | 22 |
|
|
57 | 59 | *
|
58 | 60 | * @author Christoph Strobl
|
59 | 61 | * @author Mark Paluch
|
| 62 | + * @author Henrique Amaral |
60 | 63 | * @since 3.2
|
61 | 64 | * @see ClientConfiguration
|
62 | 65 | * @see ReactiveRestClients
|
@@ -429,6 +432,44 @@ default Mono<BulkByScrollResponse> deleteBy(DeleteByQueryRequest deleteRequest)
|
429 | 432 | */
|
430 | 433 | Mono<BulkByScrollResponse> deleteBy(HttpHeaders headers, DeleteByQueryRequest deleteRequest);
|
431 | 434 |
|
| 435 | + /** |
| 436 | + * Execute a {@link BulkRequest} against the {@literal bulk} API. |
| 437 | + * |
| 438 | + * @param consumer never {@literal null}. |
| 439 | + * @see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html">Bulk |
| 440 | + * API on elastic.co</a> |
| 441 | + * @return a {@link Mono} emitting the emitting operation response. |
| 442 | + */ |
| 443 | + default Mono<BulkResponse> bulk(Consumer<BulkRequest> consumer) { |
| 444 | + |
| 445 | + BulkRequest request = new BulkRequest(); |
| 446 | + consumer.accept(request); |
| 447 | + return bulk(request); |
| 448 | + } |
| 449 | + |
| 450 | + /** |
| 451 | + * Execute a {@link BulkRequest} against the {@literal bulk} API. |
| 452 | + * |
| 453 | + * @param bulkRequest must not be {@literal null}. |
| 454 | + * @see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html">Bulk |
| 455 | + * API on elastic.co</a> |
| 456 | + * @return a {@link Mono} emitting the emitting operation response. |
| 457 | + */ |
| 458 | + default Mono<BulkResponse> bulk(BulkRequest bulkRequest) { |
| 459 | + return bulk(HttpHeaders.EMPTY, bulkRequest); |
| 460 | + } |
| 461 | + |
| 462 | + /** |
| 463 | + * Execute a {@link BulkRequest} against the {@literal bulk} API. |
| 464 | + * |
| 465 | + * @param headers Use {@link HttpHeaders} to provide eg. authentication data. Must not be {@literal null}. |
| 466 | + * @param bulkRequest must not be {@literal null}. |
| 467 | + * @see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html">Bulk |
| 468 | + * API on elastic.co</a> |
| 469 | + * @return a {@link Mono} emitting operation response. |
| 470 | + */ |
| 471 | + Mono<BulkResponse> bulk(HttpHeaders headers, BulkRequest bulkRequest); |
| 472 | + |
432 | 473 | /**
|
433 | 474 | * Compose the actual command/s to run against Elasticsearch using the underlying {@link WebClient connection}.
|
434 | 475 | * {@link #execute(ReactiveElasticsearchClientCallback) Execute} selects an active server from the available ones and
|
|
0 commit comments