Created
July 7, 2022 10:59
-
-
Save paul-butcher/6dc2f456e041c61221ca4167a3d376da to your computer and use it in GitHub Desktop.
Elasticsearch _bulk NOOP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| This fails, you cannot update something that is not there | |
| {"update": {"_index":"banana","_id":"dolly"}} | |
| {"doc": {"hello":"dolly"}} | |
| This succeeds, but will always update, even if unchanged. | |
| The version count will increase, and the value of "result" will be "updated" | |
| {"index": {"_index":"banana","_id":"kitty"}} | |
| {"doc": {"hello":"kitty"} | |
| This will insert or update as appropriate. If there are no changes, the value of "result" will be "noop" | |
| {"update": {"_index":"banana","_id":"world"}} | |
| {"doc": {"hello":"world"}, "doc_as_upsert": true} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -XPUT localhost:9200/banana | |
| curl -XPOST localhost:9200/banana/_bulk -H Content-Type:application/x-ndjson --data-binary "@update" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"update": {"_index":"banana","_id":"dolly"}} | |
| {"doc": {"hello":"dolly"}} | |
| {"update": {"_index":"banana","_id":"world"}} | |
| {"doc": {"hello":"world"}, "doc_as_upsert": true} | |
| {"index": {"_index":"banana","_id":"kitty"}} | |
| {"doc": {"hello":"kitty"}, "doc_as_upsert": true} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment