温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

ES常用查询命令

发布时间:2020-07-03 18:22:30 来源:网络 阅读:1535 作者:枫叶云 栏目:大数据
  • 查看索引

`curl '10.95.32.34:9200/_cat/indices?v'`
  • 创建索引

    curl -XPUT  '10.95.32.34:9200/customer-test?pretty'
  • 插入数据:

    curl -XPUT '10.95.32.34:9200/customer-test/employee/2?pretty' -d '{"name": "John smart"}'
    curl -XPUT '10.95.32.34:9200/customer-test/employee/1' -d '{"first_name":"John","last_name":"Smith","age":25,"about":"Ilovetogorockclimbing","interests":["sports","music"]}'
  • 查看数据:

    curl -XPOST '10.95.32.34:9200/customer-test/_search?pretty'
  • 查看健康:

    [root@server02 ~]# curl  -sXGET 'http://localhost:9200/_cluster/health?pretty'
    {
    "cluster_name" : "es",
    "status" : "green",
    "timed_out" : false,
    "number_of_nodes" : 9,
    "number_of_data_nodes" : 9,
    "active_primary_shards" : 129,
    "active_shards" : 258,
    "relocating_shards" : 0,
    "initializing_shards" : 0,
    "unassigned_shards" : 0,
    "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" : 100.0
    }
  • 找到未分片的索引

    curl -s "http://localhost:9200/_cat/shards" | grep UNASSIGNED
  • 删除索引:

    curl -XDELETE 'http://localhost:9200/noah_flow_file_20190625'
  • 查找未分配索引
    curl  -s 'http://localhost:9200/_cat/shards' | grep UNASSIGNED | awk '{print $1}' | sort | uniq
向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI