1 集群状态、增删改查、全量替换、强制创建、设置单个index的分片数副本数

  1. 检查集群健康状态,可以看集群颜色。(黄色:primary shard都正常,replica不正常)
    GET /_cat/health?v
  1. 列出集群所有index
    GET /_cat/indices?v
    GET _cluster/health
  2. PUT一条数据:如果指定文档 不存在则创建,存在则全量替换。如果索引类型不存在,则自动创建索引、类型
PUT /beauties/cn/1
{
    "Name":"Zhao Liying",
    "Age":20,
    "Height":160,
    "3D":[80,60,80]
}

  

  1. 强制创建文档:如果已存在,则报错
    PUT  /test_index/test_type/4/_create
    {
        "f1":"test f1"
    }
  2. 获取 指定 index、type、id 对应的数据
GET  /beauties/cn/1
 
  1. 部分更新 某一文档的 一个 字段 (Partial Update)
POST /beauties/cn/1/_update
{
    "doc":{
        "Age":21    
    }
}
 
  1. 删除一条数据(指定 索引、类型、id)
DELETE  /test_cluster/test_type/tid_1?pretty
 
 
  1. 指定索引分片数、副本数,例: test_index的分片数为2,副本为1
 
 

猜你喜欢

转载自www.cnblogs.com/cc299/p/11032787.html