首页 > 其他 > 详细

教你玩转ElasticSearch

时间:2016-02-15 02:08:25      阅读:665      评论:0      收藏:0      [点我收藏+]

#安装ElasticSearch Head插件
[root@node1 bin]# ./plugin install mobz/elasticsearch-head
-> Installing mobz/elasticsearch-head...
Trying https://github.com/mobz/elasticsearch-head/archive/master.zip ...
Downloading ....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................DONE
Verifying https://github.com/mobz/elasticsearch-head/archive/master.zip checksums if available ...
NOTE: Unable to verify checksum for downloaded plugin (unable to find .sha1 or .md5 file to verify)
Installed head into /opt/elasticsearch-2.1.1/plugins/head

?

#创建索引
[root@node1 bin]#? curl -XPUT http://192.168.1.113:9200/test-index/test-type/1 -d ‘{
>???? "user": "kimchy",
>???? "post_date": "2009-11-15T13:12:00",
>???? "message": "Trying out elasticsearch, so far so good?"
> }‘
{"_index":"test-index","_type":"test-type","_id":"1","_version":1,"_shards":{"total":2,"successful":1,"failed":0},"created":true}

?

#获取索引
[root@node1 bin]# curl -XGET http://192.168.1.113:9200/test-index/test-type/1
{"_index":"test-index","_type":"test-type","_id":"1","_version":1,"found":true,"_source":{
??? "user": "kimchy",
??? "post_date": "2009-11-15T13:12:00",
??? "message": "Trying out elasticsearch, so far so good?"
}}


#删除索引
[root@node1 bin]# curl -XDELETE ‘http://192.168.1.113:9200/test-index/test-type/1‘
{"found":true,"_index":"test-index","_type":"test-type","_id":"1","_version":2,"_shards":{"total":2,"successful":1,"failed":0}}

?

[root@node1 bin]# curl -XDELETE ‘http://192.168.1.113:9200/test-index/test-type/1‘
#再次获取索引
[root@node1 bin]# curl -XGET http://192.168.1.113:9200/test-index/test-type/1
{"_index":"test-index","_type":"test-type","_id":"1","found":false}

教你玩转ElasticSearch

原文:http://gaojingsong.iteye.com/blog/2276387

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!