You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Bulk helper onSuccess callback
For #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.
Copy file name to clipboardExpand all lines: docs/changelog.asciidoc
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,14 @@
1
1
[[changelog-client]]
2
2
== Release notes
3
3
4
+
[discrete]
5
+
=== 8.14.0
6
+
7
+
[discrete]
8
+
===== `onSuccess` callback added to bulk helper
9
+
10
+
The bulk helper now supports an `onSuccess` callback that will be called for each successful operation. https://github.com/elastic/elasticsearch-js/pull/2199[#2199]
Copy file name to clipboardExpand all lines: docs/helpers.asciidoc
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -98,6 +98,17 @@ const b = client.helpers.bulk({
98
98
})
99
99
----
100
100
101
+
|`onSuccess`
102
+
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.
103
+
[source,js]
104
+
----
105
+
const b = client.helpers.bulk({
106
+
onSuccess ({ result, document }) {
107
+
console.log(`SUCCESS: Document ${result.index._id} indexed to ${result.index._index}`)
108
+
}
109
+
})
110
+
----
111
+
101
112
|`flushBytes`
102
113
a|The size of the bulk body in bytes to reach before to send it. Default of 5MB. +
0 commit comments