|
@@ -57,7 +57,7 @@ newlines. Example:
|
|
|
[source,js]
|
|
|
--------------------------------------------------
|
|
|
$ cat requests
|
|
|
-{ "index" : { "_index" : "test", "_type" : "_doc", "_id" : "1" } }
|
|
|
+{ "index" : { "_index" : "test", "_id" : "1" } }
|
|
|
{ "field1" : "value1" }
|
|
|
$ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo
|
|
|
{"took":7, "errors": false, "items":[{"index":{"_index":"test","_type":"_doc","_id":"1","_version":1,"result":"created","forced_refresh":false}}]}
|
|
@@ -72,12 +72,12 @@ example of a correct sequence of bulk commands:
|
|
|
[source,js]
|
|
|
--------------------------------------------------
|
|
|
POST _bulk
|
|
|
-{ "index" : { "_index" : "test", "_type" : "_doc", "_id" : "1" } }
|
|
|
+{ "index" : { "_index" : "test", "_id" : "1" } }
|
|
|
{ "field1" : "value1" }
|
|
|
-{ "delete" : { "_index" : "test", "_type" : "_doc", "_id" : "2" } }
|
|
|
-{ "create" : { "_index" : "test", "_type" : "_doc", "_id" : "3" } }
|
|
|
+{ "delete" : { "_index" : "test", "_id" : "2" } }
|
|
|
+{ "create" : { "_index" : "test", "_id" : "3" } }
|
|
|
{ "field1" : "value3" }
|
|
|
-{ "update" : {"_id" : "1", "_type" : "_doc", "_index" : "test"} }
|
|
|
+{ "update" : {"_id" : "1", "_index" : "test"} }
|
|
|
{ "doc" : {"field2" : "value2"} }
|
|
|
--------------------------------------------------
|
|
|
// CONSOLE
|
|
@@ -265,15 +265,15 @@ the options. Example with update actions:
|
|
|
[source,js]
|
|
|
--------------------------------------------------
|
|
|
POST _bulk
|
|
|
-{ "update" : {"_id" : "1", "_type" : "_doc", "_index" : "index1", "retry_on_conflict" : 3} }
|
|
|
+{ "update" : {"_id" : "1", "_index" : "index1", "retry_on_conflict" : 3} }
|
|
|
{ "doc" : {"field" : "value"} }
|
|
|
-{ "update" : { "_id" : "0", "_type" : "_doc", "_index" : "index1", "retry_on_conflict" : 3} }
|
|
|
+{ "update" : { "_id" : "0", "_index" : "index1", "retry_on_conflict" : 3} }
|
|
|
{ "script" : { "source": "ctx._source.counter += params.param1", "lang" : "painless", "params" : {"param1" : 1}}, "upsert" : {"counter" : 1}}
|
|
|
-{ "update" : {"_id" : "2", "_type" : "_doc", "_index" : "index1", "retry_on_conflict" : 3} }
|
|
|
+{ "update" : {"_id" : "2", "_index" : "index1", "retry_on_conflict" : 3} }
|
|
|
{ "doc" : {"field" : "value"}, "doc_as_upsert" : true }
|
|
|
-{ "update" : {"_id" : "3", "_type" : "_doc", "_index" : "index1", "_source" : true} }
|
|
|
+{ "update" : {"_id" : "3", "_index" : "index1", "_source" : true} }
|
|
|
{ "doc" : {"field" : "value"} }
|
|
|
-{ "update" : {"_id" : "4", "_type" : "_doc", "_index" : "index1"} }
|
|
|
+{ "update" : {"_id" : "4", "_index" : "index1"} }
|
|
|
{ "doc" : {"field" : "value"}, "_source": true}
|
|
|
--------------------------------------------------
|
|
|
// CONSOLE
|