一、ES索引生命周期(ilm)介绍
es索引生命周期阶段介绍及状态转换
二、滚动索引的创建步骤
第一步,创建policy:
PUT _ilm/policy/test_max_doc_cnt_policy
{
"policy": {
"phases": {
"hot": {
"min_age": "0ms",
"actions": {
"rollover": {
"max_age": "1d"
},
"set_priority": {
"priority": 100
}
}
},
"delete": {
"min_age": "3d",
"actions": {
"delete": {}
}
}
}
}
}
第二步,创建模版:
PUT _template/test_max_doc_cnt_index_pattern
{
"index_patterns": "test-max-doc-cnt-index*",
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1,
"index.lifecycle.name": "test_max_doc_cnt_policy",
"index.lifecycle.rollover_alias": "test_max_doc_cnt_index"
},
"mappings": {
"properties": {
"name": {
"type": "text"
},
"age": {
"type": "double"
}
}
}
}
第三步,创建第一个索引:
https://www.elastic.co/guide/en/elasticsearch/reference/7.2/date-math-index-names.html
PUT /%3Ctest-max-doc-cnt-index-%7Bnow%2Fd%7D-000001%3E
{
"aliases": {
"test_max_doc_cnt_index": {
"is_write_index": true
}
}
}
第四步,写入数据:
POST /test_max_doc_cnt_index/_doc/01
{
"name":"name01"
}
三、超大规模索引的最佳实践
超大索引的管理及冷热集群的管理
- 字段优化
- 分词优化
- 查询优化
- 节点优化
- 存储优化
- 集群优化