Skip to content

PR: Added update support to bulk api.#2983

Closed
martijnvg wants to merge 4 commits intoelastic:masterfrom
martijnvg:feature/bulk_update-2982
Closed

PR: Added update support to bulk api.#2983
martijnvg wants to merge 4 commits intoelastic:masterfrom
martijnvg:feature/bulk_update-2982

Conversation

@martijnvg
Copy link
Copy Markdown
Member

PR for #2982

Added support for the update operation in the bulk api.

Update requests can now be put in the bulk api. All update request options are supported.

Example usage:

curl -XPOST 'localhost:9200/_bulk' --date-binary @bulk.json

Contents of bulk.json that contains two update request items:

{ "update" : {"_id" : "1", "_type" : "type1", "_index" : "index1", "_retry_on_conflict" : 3} }
{ "doc" : {"field" : "value"} }
{ "update" : { "_id" : "0", "_type" : "type1", "_index" : "index1", "_retry_on_conflict" : 3} }
{ "script" : "counter += param1", "lang" : "js", "params" : {"param1" : 1}, "upsert" : {"counter" : 1}}

The doc, upsert and all script related options are part of the payload. The retry_on_conflict option is part of the header.

martijnvg added 4 commits May 8, 2013 12:23
Update requests can now be put in the bulk api. All update request options are supported.

Example usage:
```
curl -XPOST 'localhost:9200/_bulk' --date-binary @bulk.json
```

Contents of bulk.json that contains two update request items:
```
{ "update" : {"_id" : "1", "_type" : "type1", "_index" : "index1", "_retry_on_conflict" : 3} }
{ "doc" : {"field" : "value"} }
{ "update" : { "_id" : "0", "_type" : "type1", "_index" : "index1", "_retry_on_conflict" : 3} }
{ "script" : "counter += param1", "lang" : "js", "params" : {"param1" : 1}, "upsert" : {"counter" : 1}}
```
The `doc`, `upsert` and all script related options are part of the payload. The `retry_on_conflict` option is part of the header.

Closes elastic#2982
Give estimated size in bytes for update requests
Added more tests
@martijnvg martijnvg closed this May 10, 2013
@dakrone
Copy link
Copy Markdown
Member

dakrone commented May 10, 2013

Awesome, really looking forward to this; thanks @martijnvg!

@martijnvg martijnvg deleted the feature/bulk_update-2982 branch May 18, 2015 23:34
breskeby pushed a commit to breskeby/elasticsearch that referenced this pull request Feb 11, 2026
…osing (elastic#2983)

This PR makes the Stateless#close method to first wait for IndicesService to finish closing before proceed. This change ensures the cache service remains available until all shard level activities are stopped. Previously it can lead to innocuous but verbose stacktraces in production. The PR also adds a test to demonstrate that a background merge no longer throws exceptions such as ClosedChannelException when the node is shutting down.

Resolves: 
Relates: elastic#2646

Co-authored-by: Artem Prigoda <artem.prigoda@elastic.co>
breskeby pushed a commit to breskeby/elasticsearch that referenced this pull request Feb 11, 2026
There are a few edge cases where closing a node can causes test failures:

Closing the handling node when looking up master node name.
Closing the coordinating node when a search is ongoing. This can lead to leaking search context in MockSearchService on the data nodes.
Closing the data node when a search is ongoing. This can lead to leaking resource on the coordinating node.
This PR fixes 1 by avoiding lookup since the master node does not change and is already known. It fixes 2 by always uses master node as the coordinating node. It fixes 3 by avoid restarting search node. With these changes in place (along with elastic#2790, elastic#2966, elastic#2983, elastic#112748, elastic#114375) the test is stable enough (running in a loop for 40+ hours without failure) to be unmuted.

Resolves: elastic#2327
Resolves:
breskeby pushed a commit to breskeby/elasticsearch that referenced this pull request Feb 11, 2026
…osing (elastic#2983)

This PR makes the Stateless#close method to first wait for IndicesService to finish closing before proceed. This change ensures the cache service remains available until all shard level activities are stopped. Previously it can lead to innocuous but verbose stacktraces in production. The PR also adds a test to demonstrate that a background merge no longer throws exceptions such as ClosedChannelException when the node is shutting down.

Resolves: 
Relates: elastic#2646

Co-authored-by: Artem Prigoda <artem.prigoda@elastic.co>
breskeby pushed a commit to breskeby/elasticsearch that referenced this pull request Feb 11, 2026
There are a few edge cases where closing a node can causes test failures:

Closing the handling node when looking up master node name.
Closing the coordinating node when a search is ongoing. This can lead to leaking search context in MockSearchService on the data nodes.
Closing the data node when a search is ongoing. This can lead to leaking resource on the coordinating node.
This PR fixes 1 by avoiding lookup since the master node does not change and is already known. It fixes 2 by always uses master node as the coordinating node. It fixes 3 by avoid restarting search node. With these changes in place (along with elastic#2790, elastic#2966, elastic#2983, elastic#112748, elastic#114375) the test is stable enough (running in a loop for 40+ hours without failure) to be unmuted.

Resolves: elastic#2327
Resolves:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants