3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

elasticsearch + Kibana BulkAPIを使ってみる

Last updated at Posted at 2018-08-11

簡単です。

##Index
※2018/8/11追記
同一_idのドキュメント有無によって、Insert or updateになりますのでご注意を。

###kibana
POST /product/default/_bulk
{ "index":{ "_id" : "100" } }
{ "price": 100}
{ "index":{ "_id" : "101" } }
{ "price": 101}

###Curl
curl -XPOST "http://localhost:9200/product/default/_bulk" -H 'Content-Type: application/json' -d'
{ "index":{ "_id" : "100" } }
{ "price": 100}
{ "index":{ "_id" : "101" } }
{ "price": 101}
'

##Update&Delete

###kibana
POST /product/default/_bulk
{"update":{"_id": "100"}}
{"doc":{"price": "1000"}}
{"delete":{"_id": "101"}}

###Curl
curl -XPOST "http://localhost:9200/product/default/_bulk" -H 'Content-Type: application/json' -d'
{"update":{"_id": "100"}}
{"doc":{"price": "1000"}}
{"delete":{"_id": "101"}}
'

##JSONデータをCurlで登録

事前にjson形式のファイルを、curl実行するディレクトリに置く
スクリーンショット 2018-08-11 12.55.53.png

実行

$ curl -H "Content-Type: application/json" -XPOST "http://localhost:9200/product/default/_bulk?pretty" --data-binary "@products-bulk.json"

3
2
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?