美文网首页
ElasticSearch基础操作

ElasticSearch基础操作

作者: 思记享 | 来源:发表于2017-06-13 19:35 被阅读0次
Paste_Image.png

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/

Paste_Image.png

这时你会发现customer索引中新增了一条document记录

Paste_Image.png

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

Paste_Image.png

相关文章

网友评论

      本文标题:ElasticSearch基础操作

      本文链接:https://www.haomeiwen.com/subject/ygwlqxtx.html