ES常见命令

ES常见命令

   小樱     2022年1月27日 21:47     1117    

1、查询所有索引

GET _cat/indices/

带有表头的索引

GET _cat/health?v

2、搜索特定索引

GET _cat/indices/<indices_name>

3、根据索引名进行排序

GET _cat/indices/*?s=index:desc

-- 模糊查询

GET _cat/indices/*gateway*?s=index:desc

4、获取集群的健康状态

GET _cluster/health

5、查询索引中的内容

GET nginx-ingress-controller_log_2021.12.28/_search

-- 按照字段进行查询

GET ingress-controller_log_2022.08.26/_search?q=servicenode:10.60.96.33

-- 按照request body进行搜索

GET ingress-controller_log_2022.08.26/_search

{

  "query":{

    "term" : {

      "servicenode":"10.60.96.33"

    }

  }

}

--查询多个索引

POST ingress-controller_log*/_search

{

  "query": {

    "match_all": {}

  }

  , "size": 1000

}

加上size,如果匹配过多,很多会显示不出来。

6、查询磁盘占比

GET _cat/allocation?v

7、查询分片状态

GET _cat/shards?h=index,shard,prirep,state,unassigned.reason

8、查询unassigend原因

GET _cluster/allocation/explain?pretty

9、查看mapping

GET <indices>/_mapping

10、修改索引的副本数

PUT */_settings

{

"index" : {

"number_of_replicas" : 0

}

}


文章评论

0

其他文章