試行錯誤していた時に使ったコマンドをまとめておく。
indexの作成
curl -XPUT "http://localhost:9200/<index_name>/"
mappingの登録
curl -XPUT 'http://localhost:9200/<index_name>/<type_name>/_mapping' -d '{ "<type_name>": { "properties": { "sample" : { "type": "string" }, "add_date": { "type":"date", "format":"yyyy/MM/dd"} } } }'
mapping確認
curl -XGET 'http://localhost:9200/<index_name>/_mapping/story?pretty=true'
データ登録
POSTで登録するとIDが自動採番される。
curl -XPOST 'http://localhost:9200/<index_name>/<type_name>/' -d ' { "sample":"hoge", "add_date":"2014-01-01" }'
検索
curl -XGET 'http://localhost:9200/<index_name>/<type_name>/_search' -d ' { "query" : { "match_all" : {} } }'
全削除
curl -XDELETE 'http://localhost:9200/*'
kibanaのindexを削除
kibanaをアップデートしたときに使用した。トラブルが無ければ必要ないのかも。
curl -XDELETE 'http://localhost:9200/.kibana/'