AWS Elasticsearch OpenDistro - 未触发滚动索引

AWS Elasticsearch OpenDistro - Rollover indices not triggered

我已经使用 AWS Elasticsearch 服务 v7.10 设置了一个 1 节点集群,并且我已经按照此 OpenDistro guides 创建了简单的索引滚动策略,但是即使我等待该策略也根本没有触发用了几个小时。以下是我的 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_sizemin_doc_count,但仍然没有成功。我错过了什么吗?谢谢。

我终于想通了以下更改,但不确定我是否必须全部更改或只更改其中的一部分。

  1. 我创建了一个 2 节点集群而不是 1 节点集群,并将 Elasticsearch 版本从 7.10 降级到 7.9
  2. 我运行这个请求PUT /_cluster/settings { "persistent": { "opendistro.index_state_management.enabled": true } }
  3. 最后,从 this 开始,我不得不等待 30-48 分钟才能看到新索引被滚动。