[关闭]
@rickyChen 2016-12-01T08:49:40.000000Z 字数 872 阅读 1869

Elasticsearch curl操作

Elasticsearch


  1. _cat操作

    1. curl localhost:9200/_cat
    2. =^.^=
    3. /_cat/allocation
    4. /_cat/shards
    5. /_cat/shards/{index}
    6. /_cat/master
    7. /_cat/nodes
    8. //获得集群的所有节点
    9. /_cat/indices
    10. //获得集群所有的index
    11. /_cat/indices/{index}
    12. /_cat/segments
    13. /_cat/segments/{index}
    14. /_cat/count
    15. /_cat/count/{index}
    16. /_cat/recovery
    17. /_cat/recovery/{index}
    18. /_cat/health
    19. //获得集群健康情况
    20. /_cat/pending_tasks
    21. /_cat/aliases
    22. /_cat/aliases/{alias}
    23. /_cat/thread_pool
    24. /_cat/plugins
    25. /_cat/fielddata
    26. /_cat/fielddata/{fields}
  2. 索引操作

    1. 1、获取索引
    2. curl -XGET http://localhost:9200/{index}/{type}/{id}’
    3. 2、索引数据(插入数据)
    4. curl -XPOST http://localhost:9200/{index}/{type}/{id}’ -d'{“a”:”avalue”,”b”:”bvalue”}’
    5. 3、删除索引
    6. curl -XDELETE http://localhost:9200/{index}/{type}/{id}’
  3. 删除数据

    • 简单删除(根据id)

      1. curl -XDELETE 'http://localhost:9200/{index}/{type}/{id}?timeout=5m'
    • 按照查询条件删除数据

      1. curl -XPOST 'localhost:9200/{index}/{type}/_delete_by_query?pretty' -d'
      2. {
      3. "query": {
      4. "query_string": {
      5. "message": "some message"
      6. }
      7. }
      8. }'
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注