Create an Index
PUT /customer?pretty
Index and Query a Document
PUT /customer/external/1?pretty
{
"name": "John Doe"
}
http://10.120.198.5:9200/customer/external/1?pretty/
这时你会发现customer索引中新增了一条document记录
http://10.120.198.5:9200/customer/external/1?pretty/
查询需要制定要查询的缩影customer,索引的类型external,文档的id pretty作用是json格式化
{
"_index" : "customer",
"_type" : "external",
"_id" : "1",
"_version" : 1,
"found" : true,
"_source" : { "name": "John Doe" }
}
Nothing out of the ordinary here other than a field, found, stating that we found a document with the requested ID 1 and another field, _source, which returns the full JSON document that we indexed from the previous step.
Delete an Index
DELETE /customer?pretty