Elasticsearchでドキュメントを登録する方法を記す。
公式ドキュメント Index and Query a Document を参考にした。 www.elastic.co
検証環境: Elasticsearch 6.0.0-rc1
bash-3.2$ curl -XPUT 'localhost:9200/customer?pretty&pretty' { "acknowledged" : true, "shards_acknowledged" : true, "index" : "customer" } bash-3.2$ curl -XGET 'localhost:9200/_cat/indices?v&pretty' health status index uuid pri rep docs.count docs.deleted store.size pri.store.size yellow open customer tl6qvdROTfuL380eLOxH0Q 5 1 0 0 466b 466b bash-3.2$ curl -XPUT 'localhost:9200/customer/doc/1?pretty&pretty' -H 'Content-Type: application/json' -d' > { > "name": "John Doe" > } > ' { "_index" : "customer", "_type" : "doc", "_id" : "1", "_version" : 1, "result" : "created", "_shards" : { "total" : 2, "successful" : 1, "failed" : 0 }, "_seq_no" : 0, "_primary_term" : 1 } bash-3.2$ curl -XGET 'localhost:9200/customer/doc/1?pretty&pretty' { "_index" : "customer", "_type" : "doc", "_id" : "1", "_version" : 1, "found" : true, "_source" : { "name" : "John Doe" } } bash-3.2$