Elasticsearch: Bulk Inserting Examples

Elasticsearch: Bulk Inserting Examples

http://queirozf.com/entries/elasticsearch-bulk-inserting-examples

Note that the URL used contains both the index and the type. This is the case when all documents belong to the same type and will be inserted into the same index.

POST http://path.to.your.cluster/myIndex/person/_bulk

{ "index":{} }

{ "name":"john doe","age":25 }

{ "index":{} }

{ "name":"mary smith","age":32 }

The structure is more or less like this: one line with the action you want to perform (in this case, "index") and a line with the actual document. Repeat as many times as you want, and don't forget the extra newline at the end.

相关推荐