onSuccess function for bulk helper (#2199)
* Bulk helper onSuccess callback For https://github.com/elastic/elasticsearch-js/issues/2090 Includes refactor of the tryBulk result processing code, to make iterating over bulk response data easier to understand. * Add onSuccess tests for each datasource type * Cleanup, additional comments * Add documentation for onSuccess callback * Update changelog * Drop link to 8.14 release notes. Page not yet published, breaking docs build.
This commit is contained in:
@ -98,6 +98,17 @@ const b = client.helpers.bulk({
|
||||
})
|
||||
----
|
||||
|
||||
|`onSuccess`
|
||||
a|A function that is called for each successful operation in the bulk request, which includes the result from Elasticsearch along with the original document that was sent, or `null` for delete operations.
|
||||
[source,js]
|
||||
----
|
||||
const b = client.helpers.bulk({
|
||||
onSuccess ({ result, document }) {
|
||||
console.log(`SUCCESS: Document ${result.index._id} indexed to ${result.index._index}`)
|
||||
}
|
||||
})
|
||||
----
|
||||
|
||||
|`flushBytes`
|
||||
a|The size of the bulk body in bytes to reach before to send it. Default of 5MB. +
|
||||
_Default:_ `5000000`
|
||||
|
||||
Reference in New Issue
Block a user