Bulk index or delete documents
Performs multiple indexing or delete operations in a single API call. This reduces overhead and can greatly increase indexing speed.
Query parameters
-
list_executed_pipelines boolean
If
true
, the response will include the ingest pipelines that were executed for each index or create. -
pipeline string
ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to
_none
disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. -
refresh string
If
true
, Elasticsearch refreshes the affected shards to make this operation visible to search, ifwait_for
then wait for a refresh to make this operation visible to search, iffalse
do nothing with refreshes. Valid values:true
,false
,wait_for
.Values are
true
,false
, orwait_for
. -
routing string
Custom value used to route operations to a specific shard.
-
_source boolean | string | array[string]
true
orfalse
to return the_source
field or not, or a list of fields to return. -
_source_excludes string | array[string]
A comma-separated list of source fields to exclude from the response.
-
_source_includes string | array[string]
A comma-separated list of source fields to include in the response.
-
timeout string
Period each action waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.
-
wait_for_active_shards number | string
The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (
number_of_replicas+1
). -
require_alias boolean
If
true
, the request’s actions must target an index alias. -
require_data_stream boolean
If
true
, the request's actions must target a data stream (existing or to-be-created).
curl \
-X PUT http://api.example.com/_bulk \
-H "Content-Type: application/json" \
-d '[{"":{"_id":"string","_index":"string","routing":"string","if_primary_term":42.0,"if_seq_no":42.0,"version":42.0,"version_type":"internal"}}]'
[
{
"": {
"_id": "string",
"_index": "string",
"routing": "string",
"if_primary_term": 42.0,
"if_seq_no": 42.0,
"version": 42.0,
"version_type": "internal"
}
}
]
{
"errors": true,
"items": [
{
"additionalProperty1": {
"_id": "string",
"_index": "string",
"status": 42.0,
"error": {
"type": "string",
"reason": "string",
"stack_trace": "string",
"caused_by": {},
"root_cause": [
{}
],
"suppressed": [
{}
]
},
"_primary_term": 42.0,
"result": "string",
"_seq_no": 42.0,
"_shards": {
"failed": 42.0,
"successful": 42.0,
"total": 42.0,
"failures": [
{}
],
"skipped": 42.0
},
"_version": 42.0,
"forced_refresh": true,
"get": {
"fields": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"found": true,
"_seq_no": 42.0,
"_primary_term": 42.0,
"_routing": "string",
"_source": {
"additionalProperty1": {},
"additionalProperty2": {}
}
}
},
"additionalProperty2": {
"_id": "string",
"_index": "string",
"status": 42.0,
"error": {
"type": "string",
"reason": "string",
"stack_trace": "string",
"caused_by": {},
"root_cause": [
{}
],
"suppressed": [
{}
]
},
"_primary_term": 42.0,
"result": "string",
"_seq_no": 42.0,
"_shards": {
"failed": 42.0,
"successful": 42.0,
"total": 42.0,
"failures": [
{}
],
"skipped": 42.0
},
"_version": 42.0,
"forced_refresh": true,
"get": {
"fields": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"found": true,
"_seq_no": 42.0,
"_primary_term": 42.0,
"_routing": "string",
"_source": {
"additionalProperty1": {},
"additionalProperty2": {}
}
}
}
}
],
"took": 42.0,
"ingest_took": 42.0
}