mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-29 01:44:36 -04:00
Bulk Api support for global parameters (#34528)
Bulk Request in High level rest client should be consistent with what is possible in Rest API, therefore should support global parameters. Global parameters are passed in URL in Rest API. Some parameters are mandatory - index, type - and would fail validation if not provided before before the bulk is executed. Optional parameters - routing, pipeline. The usage of these should be consistent across sync/async execution, bulk processor and BulkRequestBuilder closes #26026
This commit is contained in:
parent
d67c88fa12
commit
995bf0ee66
21 changed files with 718 additions and 47 deletions
|
@ -165,3 +165,26 @@ client.admin().indices().prepareRefresh().get();
|
|||
client.prepareSearch().get();
|
||||
--------------------------------------------------
|
||||
|
||||
|
||||
[[java-docs-bulk-global-parameters]]
|
||||
==== Global Parameters
|
||||
|
||||
Global parameters can be specified on the BulkRequest as well as BulkProcessor, similar to the REST API. These global
|
||||
parameters serve as defaults and can be overridden by local parameters specified on each sub request. Some parameters
|
||||
have to be set before any sub request is added - index, type - and you have to specify them during BulkRequest or
|
||||
BulkProcessor creation. Some are optional - pipeline, routing - and can be specified at any point before the bulk is sent.
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/BulkProcessorIT.java[bulk-processor-mix-parameters]
|
||||
--------------------------------------------------
|
||||
<1> global parameters from the BulkRequest will be applied on a sub request
|
||||
<2> local pipeline parameter on a sub request will override global parameters from BulkRequest
|
||||
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/BulkRequestWithGlobalParametersIT.java[bulk-request-mix-pipeline]
|
||||
--------------------------------------------------
|
||||
<1> local pipeline parameter on a sub request will override global pipeline from the BulkRequest
|
||||
<2> global parameter from the BulkRequest will be applied on a sub request
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue