1

根据此文档,我们尝试将策略设置为索引模式

PUT _opendistro/_ism/policies/hot_delete_rule_for_log
{
  "policy": {
    "description": "hot delete rule for log",
    "default_state": "hot",
    "states": [
      {
        "name": "hot",
        "actions": [],
        "transitions": [
            {
                "state_name": "delete",
                "conditions": {
                    "min_index_age": "20d"
                }
            }
        ]
      },
        {
            "name": "delete",
            "actions": [
                {
                    "delete": {}
                }
            ],
            "transitions": []
        }
    ],
    "ism_template": {
      "index_patterns": ["log-*"],
      "priority": 1
    }
  }
}

然后我们通过检查索引设置GET log-2021.06.29/_settings

{
  "log-2021.06.29" : {
    "settings" : {
      "index" : {
        "mapping" : {
          "total_fields" : {
            "limit" : "10000"
          }
        },
        "refresh_interval" : "5s",
        "number_of_shards" : "1",
        "provided_name" : "log-2021.06.29",
        "max_docvalue_fields_search" : "200",
        "query" : {
          "default_field" : [ "fields.*" ]
        },
        "creation_date" : "1624924801281",
        "number_of_replicas" : "0",
        "uuid" : "SfG2Utr5RDmybrH2Q",
        "version" : {
          "created" : "7100299"
        }
      }
    }
  }
}

政策似乎未正确应用于索引?还是我错过了什么?

PS:所有这些命令都在 aws ElasticSearch 上运行

4

1 回答 1

0

Per doc我们可以通过以下方式检查索引策略

GET _opendistro/_ism/explain/test-2021-06-30?pretty

  "test-2021-06-30" : {
    "index.opendistro.index_state_management.policy_id" : "hot_delete_rule_for_log",
    "index" : "test-2021-06-30",
    ....
于 2021-07-08T03:21:00.217 回答