@@ -79,11 +79,6 @@ Client libraries using this protocol should try and strive to do
7979something similar on the client side, and reduce buffering as much as
8080possible.
8181
82- The response to a bulk action is a large JSON structure with
83- the individual results of each action performed,
84- in the same order as the actions that appeared in the request.
85- The failure of a single action does not affect the remaining actions.
86-
8782There is no "correct" number of actions to perform in a single bulk request.
8883Experiment with different settings to find the optimal size for your particular workload.
8984
@@ -183,12 +178,6 @@ participate in the `_bulk` request at all.
183178
184179See <<url-access-control>>.
185180
186- [float]
187- [[bulk-partial-responses]]
188- ===== Partial responses
189- To ensure fast responses, the bulk API will respond with partial results if one or more shards fail.
190- See <<shard-failures, Shard failures>> for more information.
191-
192181[[docs-bulk-api-path-params]]
193182==== {api-path-parms-title}
194183
@@ -214,6 +203,212 @@ include::{docdir}/rest-api/common-parms.asciidoc[tag=timeout]
214203
215204include::{docdir}/rest-api/common-parms.asciidoc[tag=wait_for_active_shards]
216205
206+ [[bulk-api-request-body]]
207+ ==== {api-request-body-title}
208+ The request body contains a newline-delimited list of `create`, `delete`, `index`,
209+ and `update` actions and their associated source data.
210+
211+ `create`::
212+ (Optional, string)
213+ Indexes the specified document if it does not already exist.
214+ The following line must contain the source data to be indexed.
215+ +
216+ --
217+ include::{docdir}/rest-api/common-parms.asciidoc[tag=bulk-index]
218+
219+ include::{docdir}/rest-api/common-parms.asciidoc[tag=bulk-id]
220+ --
221+
222+ `delete`::
223+ (Optional, string)
224+ Removes the specified document from the index.
225+ +
226+ --
227+ include::{docdir}/rest-api/common-parms.asciidoc[tag=bulk-index]
228+
229+ `_id`::
230+ (Required, string)
231+ The document ID.
232+ --
233+
234+ `index`::
235+ (Optional, string)
236+ Indexes the specified document.
237+ If the document exists, replaces the document and increments the version.
238+ The following line must contain the source data to be indexed.
239+ +
240+ --
241+ include::{docdir}/rest-api/common-parms.asciidoc[tag=bulk-index]
242+
243+ include::{docdir}/rest-api/common-parms.asciidoc[tag=bulk-id]
244+ --
245+
246+ `update`::
247+ (Optional, string)
248+ Performs a partial document update.
249+ The following line must contain the partial document and update options.
250+ +
251+ --
252+ include::{docdir}/rest-api/common-parms.asciidoc[tag=bulk-index]
253+
254+ include::{docdir}/rest-api/common-parms.asciidoc[tag=bulk-id]
255+ --
256+
257+ `doc`::
258+ (Optional, object)
259+ The partial document to index.
260+ Required for `update` operations.
261+
262+ `<fields>`::
263+ (Optional, object)
264+ The document source to index.
265+ Required for `create` and `index` operations.
266+
267+ [role="child_attributes"]
268+ [[bulk-api-response-body]]
269+ ==== {api-response-body-title}
270+
271+ The bulk API's response contains the individual results of each operation in the
272+ request, returned in the order submitted. The success or failure of an
273+ individual operation does not affect other operations in the request.
274+
275+ [[bulk-partial-responses]]
276+ .Partial responses
277+ ****
278+ To ensure fast responses, the bulk API will respond with partial results if one
279+ or more shards fail. See <<shard-failures, Shard failures>> for more
280+ information.
281+ ****
282+
283+ `took`::
284+ (integer)
285+ How long, in milliseconds, it took to process the bulk request.
286+
287+ `errors`::
288+ (boolean)
289+ If `true`, one or more of the operations in the bulk request did not complete
290+ successfully.
291+
292+ `items`::
293+ (array of objects)
294+ Contains the result of each operation in the bulk request, in the order they
295+ were submitted.
296+ +
297+ .Properties of `items` objects
298+ [%collapsible%open]
299+ ====
300+ <action>::
301+ (object)
302+ The parameter name is an action associated with the operation. Possible values
303+ are `create`, `delete`, `index`, and `update`.
304+ +
305+ The parameter value is an object that contains information for the associated
306+ operation.
307+ +
308+ .Properties of `<action>`
309+ [%collapsible%open]
310+ =====
311+ `_index`::
312+ (string)
313+ The index name or alias associated with the operation.
314+
315+ `_type`::
316+ (string)
317+ The document type associated with the operation. {es} indices now support a
318+ single document type: `_doc`. See <<removal-of-types>>.
319+
320+ `_id`::
321+ (integer)
322+ The document ID associated with the operation.
323+
324+ `_version`::
325+ (integer)
326+ The document version associated with the operation. The document version is
327+ incremented each time the document is updated.
328+ +
329+ This parameter is only returned for successful actions.
330+
331+ `result`::
332+ (string)
333+ Result of the operation. Successful values are `created`, `deleted`, and
334+ `updated`.
335+ +
336+ This parameter is only returned for successful operations.
337+
338+ `_shards`::
339+ (object)
340+ Contains shard information for the operation.
341+ +
342+ This parameter is only returned for successful operations.
343+ +
344+ .Properties of `_shards`
345+ [%collapsible%open]
346+ ======
347+ `total`::
348+ (integer)
349+ Number of shards the operation attempted to execute on.
350+
351+ `successful`::
352+ (integer)
353+ Number of shards the operation succeeded on.
354+
355+ `failed`::
356+ (integer)
357+ Number of shards the operation attempted to execute on but failed.
358+ ======
359+
360+ `_seq_no`::
361+ (integer)
362+ The sequence number assigned to the document for the operation.
363+ Sequence numbers are used to ensure an older version of a document
364+ doesn’t overwrite a newer version. See <<optimistic-concurrency-control-index>>.
365+ +
366+ This parameter is only returned for successful operations.
367+
368+ `_primary_term`::
369+ (integer)
370+ The primary term assigned to the document for the operation.
371+ See <<optimistic-concurrency-control-index>>.
372+ +
373+ This parameter is only returned for successful operations.
374+
375+ `status`::
376+ (integer)
377+ HTTP status code returned for the operation.
378+
379+ `error`::
380+ (object)
381+ Contains additional information about the failed operation.
382+ +
383+ The parameter is only returned for failed operations.
384+ +
385+ .Properties of `error`
386+ [%collapsible%open]
387+ ======
388+ `type`::
389+ (string)
390+ Error type for the operation.
391+
392+ `reason`::
393+ (string)
394+ Reason for the failed operation.
395+
396+ `index_uuid`::
397+ (string)
398+ The universally unique identifier (UUID) of the index associated with the failed
399+ operation.
400+
401+ `shard`::
402+ (string)
403+ ID of the shard associated with the failed operation.
404+
405+ `index`::
406+ (string)
407+ The index name or alias associated with the failed operation.
408+ ======
409+ =====
410+ ====
411+
217412[[docs-bulk-api-example]]
218413==== {api-examples-title}
219414
0 commit comments