1、创建基于日期的索引
PUT %3Cmy-index-%7Bnow%2Fd%7D-0000001%3E
{
"aliases": {
"my-alias": {
"is_write_index": true
}
}
}
GET my-index-2022.12.25-0000001/_settings
2、rollover滚动索引
1、 condition下的是 或 关系、
满足7天 |文档数量大于5 |数据内容数据超过5G
POST my-alias/_rollover
{
"conditions": {
"max_age": "7d",
"max_docs": 5,
"max_size": "5gb"
}
}
3、 批量导入数据
PUT my-alias/_bulk
{"index":{"_id":1}}
{"title": "testing 01"}
{"index":{"_id":2}}
{"title": "testing 02"}
{"index":{"_id":3}}
{"title": "testing 03"}
{"index":{"_id":4}}
{"title": "testing 04"}
{"index":{"_id":5}}
{"title": "testing 05"}
GET my-alias/_search
GET my-alias/_count
4、满足滚动条件下滚动索引
PUT my-alias/_bulk
{"index":{"_id":6}}
{"title": "testing 06"}
5、检索数据,验证滚动数据是否生效
GET my-alias/_search