我已经使用 AWS Elasticsearch 服务 v7.10 设置了一个单节点集群,并且我已经按照这个OpenDistro 指南创建了简单的索引翻转策略,但是即使我等待了几个小时,该策略也根本没有触发。以下是我的 ISM 政策:
PUT _opendistro/_ism/policies/book_rollover_policy
{
"policy": {
"policy_id": "book_rollover_policy",
"description": "Book rollover policy.",
"default_state": "hot",
"states": [
{
"name": "hot",
"actions": [
{
"replica_count": {
"number_of_replicas": 0
},
"rollover": {
"min_index_age": "3m"
}
}
],
"transitions": []
}
],
"ism_template": {
"index_patterns": [
"book-*"
],
"priority": 100
}
}
}
这是具有翻转别名的模板:
PUT _template/book_ism_rollover
{
"index_patterns": [
"book-*"
],
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 0,
"opendistro": {
"index_state_management": {
"rollover_alias": "book"
}
},
"analysis": {}
}
},
"mappings": {
"properties": {
"author": {
"type": "text"
},
"isbn": {
"type": "text"
},
"price": {
"type": "float"
},
"publishedDate": {
"type": "date"
},
"publisher": {
"type": "text"
},
"title": {
"type": "text"
}
}
}
}
然后我用别名创建了初始翻转索引:
PUT book-000001
{
"aliases": {
"book": {
"is_write_index": true
}
}
}
然后我开始索引一些文档,如下所示:
#Book 1
POST book/_doc
{
"isbn": "f2338e3e-fabf-45bb-aa6e-5f8cb6f259c1",
"author": "Jon Skeet",
"title": "C# in depth",
"publiser": "Manning Publications",
"publishedDate": "2008-01-21",
"price": 29.99
}
#Book 2
POST book/_doc
{
"isbn": "30e57ff1-98f9-405b-aede-5df460455a5d",
"author": "Joseph Albahari",
"title": "C# 9.0 in the nutshell",
"publiser": "O'Reilley",
"publishedDate": "2018-03-01",
"price": 70.99
}
#Book 3
POST book/_doc
{
"isbn": "14fa6134-f9e4-4525-9d28-f3def875c35c",
"author": "Mark Lutz",
"title": "Learning Python",
"publiser": "O'Reilley",
"publishedDate": "2010-12-01",
"price": 30.99
}
使用上面的策略,我希望 3 分钟后会创建一个新索引,但什么也没发生。我还尝试了不同的翻转动作min_size
,min_doc_count
但仍然没有运气。我错过了什么吗?谢谢。