ES7 索引基本操作

  • 判断索引是否存在
HEAD user
  • 创建索引
 PUT user
{
    "settings" : {
        "index" : {
            "number_of_shards" : 3, 
            "number_of_replicas" : 2 
        }
    }
}
  • 设置索引映射
PUT user/_mapping
{
    "properties":{
        "name":{
             "type":"keyword"
        },
        "age":{
            "type":"integer"
        },
        "sex":{
            "type":"keyword"
        }
    }
}
  • 获取查看索引信息
GET user
  • 删除索引
DELETE user
  • 创建索引及设置
PUT user
{
    "settings" : {
        "index" : {
            "number_of_shards" : 3, 
            "number_of_replicas" : 2 
        }
    }
    "mappings": {
        "properties":{
            "name":{
                "type":"keyword"
            },
            "age":{
                "type":"integer"
            },
            "sex":{
                "type":"keyword"
            }
        }
    }  
}
  • 修改索引设置
PUT user/_setting
{
    "settings":{
        "index.blocks.write": true 
    }
}
  • 增加索引映射
PUT user/_mapping
{
    "properties":{
        "score":{
            "type":"float"
        }
    }
}

你可能感兴趣的:(ES7 索引基本操作)