01-基本概念- 索引,文档和 REST API

# kibana_sample_data_ecommerce 为es 索引

#查看索引相关信息
GET kibana_sample_data_ecommerce

#查看索引的文档总数
GET kibana_sample_data_ecommerce/_count

#查看前10条文档,了解文档格式
POST kibana_sample_data_ecommerce/_search
{
}

#_cat indices API
#查看indices
GET /_cat/indices/kibana*?v&s=index

#查看状态为绿的索引
GET /_cat/indices?v&health=green

#按照文档个数排序
GET /_cat/indices?v&s=docs.count:desc

#查看具体的字段
GET /_cat/indices/kibana*?pri&v&h=health,index,pri,rep,docs.count,mt

#How much memory is used per index?
GET /_cat/indices?v&h=i,tm&s=tm:desc

# 查看各个节点的内存状况
GET _cat/nodes?v
GET /_nodes/stats/jvm?
GET /_nodes/es7_hot,es7_cold
GET /_cat/nodes?v&h=id,ip,port,v,m
GET _nodes/stats/indices?pretty
GET _cat/nodes?v&h=name,queryCacheMemory,queryCacheEvictions,requestCacheMemory,requestCacheHitCount,request_cache.miss_count
GET _cat/nodes?h=name,port,segments.memory,segments.index_writer_memory,fielddata.memory_size,query_cache.memory_size,request_cache.memory_size&v


GET _cluster/health
GET _cluster/health?level=shards
GET /_cluster/health/kibana_sample_data_ecommerce,kibana_sample_data_flights
GET /_cluster/health/kibana_sample_data_flights?level=shards

#### cluster state
The cluster state API allows access to metadata representing the state of the whole cluster. This includes information such as

GET /_cluster/state

#cluster get settings
GET /_cluster/settings
GET /_cluster/settings?include_defaults=true

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

查询所有索引

GET /_cat/indices?v
GET _cat/indices?pretty

查看es集群状态

GET _cat/health?v

查看所有索引的分片信息

GET _cat/shards?v
  

查询指定索引(各种信息)

GET 索引名称

查看指定索引分片信息

GET _cat/shards/索引名称?v

查看集群的节点信息

GET _cat/nodes?v

GET _cat/master

显示每个节点分片数量、占用空间

GET _cat/allocation?v

显示node节点属性

GET _cat/nodeattrs?v

查询索引的别名

GET 索引名称/_alias

查询指定索引的映射

GET 索引名称/_mapping

URI搜索

GET twitter/_search?q=user:kimchy

显示正在等待的任务


GET _cat/pending_tasks?v

查询使用的插件

GET _cat/plugins?v

查看线程池信息

GET _cat/thread_pool?v

响应体返回格式

#响应体返回格式,支持json,yaml,text(default),smile,cbor

GET /_cat/indices?format=json&pretty

获取集群分片信息

POST _cluster/reroute?retry_failed=true

手动分配分片

#POST
curl --location 'http://10.150.31.32:9200/_cluster/reroute?retry_failed=true' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YmRwX2FkbWluOlk5elFKYjJJ' \
--data '{
    "commands": [
        {
            "allocate": {
                "allow_primary": true,
                "node": "10.150.31.31",
                "shard": 2,
                "index": "ronghui_score2"
            }
        },
        {
            "allocate": {
                "allow_primary": true,
                "node": "10.150.31.31",
                "shard": 0,
                "index": "xt_kingdeegetpdfbase64reporth5_es"
            }
        }
    ]
}'
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值