创建索引库
curl -XPUT test01:9200/bigdata
创建索引
curl -XPOST test01:9200/bigdata/product/1 -d '{"name":"hadoop", "author":"Doug Couting", "lastest_version":"3.0.0"}'
查询索引信息
获取当前索引库的配置信息
curl -XGET test01:9200/bigdata?pretty
查询索引库下面的所有索引信息
curl -XGET test01:9200/bigdata/_search?pretty
精确查询索引id为1的一条信息
curl -XGET test01:9200/bigdata/product/1?pretty
curl -XPOST test01:9200/bigdata/product/2 -d '{"name":"hive", "author":"facebook", "lastest_version":"2.1.0"}'
curl -XPOST test01:9200/bigdata/product/3 -d '{"name":"hbase", "author":"apache", "lastest_version":"1.1.5"}'
更新
推荐是POST===>对具体的一条索引记录进行更新 ==》没有就给我新增,有的话,更新覆盖原有内容
curl -XPOST test01:9200/bigdata/product/3 -d '{"name":"hive", "author":"facebook", "lastest_version":"1.2.1"}'
curl -XPOST test01:9200/bigdata/product/4 -d '{"name":"storm", "author":"apache", "lastest_version":"1.0.2"}'
删除–>根据指定的索引id进行删除
curl -XDELETE test01:9200/bigdata/product/4
高级查询
查询某一个索引下面的source的内容
curl -XGET test01:9200/bigdata/product/1/_source?pretty
查询name是hadoop,hbase条件查询
curl -XGET 'test01:9200/bigdata/product/_search?q=name:hadoop,hive&pretty'
部分字段查询
curl -XGET 'test01:9200/bigdata/product/3?_source=name,author&pretty'
查看多个索引库列表
curl 'http://test01:9200/_cat/indices?v'
批量操作–bulk
注意:ElasticSearch节点健康状态说明!!!
在Elasticsearch集群中可以监控统计很多信息,但是只有一个是最重要的时集群健康(cluster health)。Es中用三种颜色状态表示:green,yellow,red.
Green:所有主分片和副本分片都可用
Yellow:所有主分片可用,但不是所有副本分片都可用
Red:不是所有的主分片都可用
版权声明:本文为weixin_50198333原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。