关于elasticsearch:ElasticSearch-的索引管理

4次阅读

共计 433 个字符,预计需要花费 2 分钟才能阅读完成。

创立索引

PUT /my-index-000001

索引名要求全副为小写,不能应用特殊字符,长度不能超过 255 字节。

创立索引同时进行配置

PUT /my-index-000001
{
  "settings": {
    "number_of_shards": 5,   // 分片数量,默认 1
    "number_of_replicas": 1  // 正本数量,默认 1
  }
}

创立索引同时进行映射配置

PUT /test
{
  "settings": {"number_of_shards": 1},
  "mappings": {
    "properties": {"field1": { "type": "text"}
    }
  }
}

删除索引

DELETE /my-index-000001
DELETE /_all
DELETE /*

反对以逗号分隔的列表或通配符表达式。

获取索引

GET /my-index-000001
GET /_all
GET /*

索引是否存在

HEAD /my-index-000001

响应:

  • 200 所有指定的索引或别名均存在
  • 404 一个或多个指定的索引或别名不存在
正文完
 0