| 接口 | PUT /<index> |
|---|---|
| 可改设置 | number_of_replicas / refresh_interval |
| 不可改设置 | number_of_shards(需 reindex 或 shrink/split 迁移) |
示例
示例
PUT /my-index-000001
{
"settings": { "number_of_shards": 3, "number_of_replicas": 1 },
"mappings": {
"properties": {
"@timestamp": { "type": "date" },
"message": { "type": "text" },
"user_id": { "type": "keyword" }
}
}
}索引名只能用小写字母,不能含大写、空格、逗号、星号等字符;同一索引只允许一种映射结构。