gaojingsong 阅读(384) 评论(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}

  • 大小: 27.8 KB
  • 大小: 14.4 KB