Skip to content
This repository was archived by the owner on Aug 16, 2022. It is now read-only.

Commit ab5e7a8

Browse files
added curl command for bulk api
1 parent 09bf4c2 commit ab5e7a8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docs/elasticsearch/index-data.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,16 @@ Optional document\n
4444
4545
```
4646

47+
To index bulk data using the `curl` command, navigate to the folder where you have your file saved and run the following command:
48+
49+
```json
50+
curl -H "Content-Type: application/x-ndjson" -POST https://localhost:9200/data/_bulk -u admin:admin --insecure --data-binary "@data.json"
51+
```
52+
4753
The document is optional, because `delete` actions do not require a document. The other actions (`index`, `create`, and `update`) all require a document. If you specifically want the action to fail if the document already exists, use the `create` action instead of the `index` action.
4854
{: .note }
4955

50-
If any one of the actions fail, Elasticsearch continues to execute the other actions. Examine the `items` array in the response to figure out what went wrong. The entries in the `items` array are in the same order as the actions specified in the request.
56+
If any one of the actions in the `_bulk` API fail, Elasticsearch continues to execute the other actions. Examine the `items` array in the response to figure out what went wrong. The entries in the `items` array are in the same order as the actions specified in the request.
5157

5258
Elasticsearch features automatic index creation when you add a document to an index that doesn't already exist. It also features automatic ID generation if you don't specify an ID in the request. This simple example automatically creates the movies index, indexes the document, and assigns it a unique ID:
5359

@@ -187,7 +193,6 @@ GET movies/_doc/1
187193
]
188194
}
189195
}
190-
191196
```
192197

193198
The document also has an incremented `_version` field. Use this field to keep track of how many times a document is updated.

0 commit comments

Comments
 (0)