• elasticsearch基本接口使用


    一、查看当前es上的所有索引

    curl -XGET "http://127.0.0.1:9200/_cat/indices"      # 查看索引缩略信息

    curl -XGET "http://127.0.0.1:9200/_cat/indices?v"        # 查看索引详细信息

     

    二、查看elasticsearch集群状态

    curl -sXGET "http://127.0.0.1:9200/_cluster/health?pretty"

    {
      "cluster_name" : "elasticone",
      "status" : "yellow",
      "timed_out" : false,
      "number_of_nodes" : 1,
      "number_of_data_nodes" : 1,
      "active_primary_shards" : 541,
      "active_shards" : 541,
      "relocating_shards" : 0,
      "initializing_shards" : 0,
      "unassigned_shards" : 541,
      "delayed_unassigned_shards" : 0,
      "number_of_pending_tasks" : 0,
      "number_of_in_flight_fetch" : 0,
      "task_max_waiting_in_queue_millis" : 0,
      "active_shards_percent_as_number" : 50.0
    }
    View Code

     

    三、查看集群节点信息

    curl -XGET "http://127.0.0.1:9200/_cat/nodes?v"

     

    四、查看节点进程信息

    curl -XGET "http://127.0.0.1:9200/_nodes/process?pretty"

     

    五、查看索引统计信息

    curl -XGET "http://127.0.0.1:9200/_stats?pretty"

     

    六、查看指定索引统计信息

    curl -XGET "http://127.0.0.1:9200/索引名/_stats?pretty"

    curl -XGET "http://127.0.0.1:9200/logstash-2018.10.21/_stats?pretty"

     

    七、查看热点线程

    curl -XGET "http://127.0.0.1:9200/_nodes/hot_threads?pretty"

     

    八、查看指定索引信息

    curl -XGET "http://127.0.0.1:9200/索引名/_mapping?pretty"

    curl -XGET "http://127.0.0.1:9200/logstash-2018.10.21/_mapping?pretty"

     

    九、查看所有节点jvm信息

    curl -XGET "http://127.0.0.1:9200/_nodes/stats/jvm?pretty" 

     

    十、查看指定节点jvm信息

    curl -XGET "http://127.0.0.1:9200/_nodes/节点名/stats/jvm?pretty"

    curl -XGET "http://127.0.0.1:9200/_nodes/searchnode-01/stats/jvm?pretty"

     

    十一、删除全部索引

    curl -XDELETE "http://127.0.0.1:9200/*?pretty" 

     

    十二、删除指定索引

    curl -XDELETE "http://127.0.0.1:9200/索引名?pretty"

    curl -XDELETE "http://127.0.0.1:9200/logstash-2018.10.19?pretty"

     curl -XDELETE "http://127.0.0.1:9200/logstash-2018.10.19?pretty"
    {
      "acknowledged" : true
    }
    # 删除历史索引思路 
    
    # step1  取出要删除的索引名 
    curl -sXGET "http://127.0.0.1:9200/_cat/indices"|awk '{print $3}'|grep 2018.10    # 2018.10月的所有索引
    
    # step2  使用for循环调用接口删除之 
    for i in `curl -sXGET "http://127.0.0.1:9200/_cat/indices"|awk '{print $3}'|grep 2018.10`;do curl -XDELETE "http://127.0.0.1:9200/$i?pretty";done 

     

    十三、查看线程池配置

    curl -XGET "http://127.0.0.1:9200/_nodes/thread_pool/"  

     

  • 相关阅读:
    No.20 selenium学习之路之文件读写
    No.19 selenium学习之路之os模块
    No.18 selenium学习之路之批量执行测试用例
    python进阶学习之高阶函数
    python进阶学习之匿名函数lambda
    No.17 selenium学习之路之判断与等待
    Educational Codeforces Round 83 (Rated for Div. 2)【ABCDEF】(题解)
    Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics)【ABCDE】(题解)
    牛客练习赛58【ABCDEF】(题解)
    CodeCraft-20 (Div. 2)【ABCDE】(题解)
  • 原文地址:https://www.cnblogs.com/lichunke/p/9836288.html
Copyright © 2020-2023  润新知