elasticsearch 异常错误:索引[job_temp_762226]的设置[index.lifecycle.rollover_alias]为空或未定义?

tag5nh1u  于 2022-11-22  发布在  ElasticSearch
关注(0)|答案(1)|浏览(189)

我已经在Elasticsearch中创建了一个索引模板,以下是我的设置

Index pattern
   job_temp* 
Priority
    None 
Component templates
    None
Data stream
    No 
Version
    None


{
  "template": {
    "settings": {
      "index": {
        "lifecycle": {
          "name": "preview_policy"
        },
        "number_of_shards": "1",
        "number_of_replicas": "0"
      }
    },
    "aliases": {
      "preview": {}
    },
    "mappings": {}
  }
}

之后,我创建了一个索引生命周期策略,它应该在30分钟后自动删除这些索引,

PUT _ilm/policy/preview_policy
{
  "policy": {
    "phases": {
      "hot": {
        "min_age": "0ms",
        "actions": {
          "rollover": {
            "max_age": "30d",
            "max_primary_shard_size": "50gb"
          },
          "set_priority": {
            "priority": 100
          }
        }
      },
      "delete": {
        "min_age": "30m",
        "actions": {
          "delete": {
            "delete_searchable_snapshot": true
          }
        }
      }
    }
  }
}

然后我用模式job_temp_762226创建了一个索引,所以根据我的设置,我希望它在30分钟后被删除,但相反,我得到了下面的错误,
我错过了什么才能成功呢?

java.lang.IllegalArgumentException: setting [index.lifecycle.rollover_alias] for index [job_temp_762226] is empty or not defined
        at org.elasticsearch.xpack.core.ilm.WaitForRolloverReadyStep.evaluateCondition(WaitForRolloverReadyStep.java:77)
        at org.elasticsearch.xpack.ilm.IndexLifecycleRunner.runPeriodicStep(IndexLifecycleRunner.java:176)
        at org.elasticsearch.xpack.ilm.IndexLifecycleService.triggerPolicies(IndexLifecycleService.java:333)
        at org.elasticsearch.xpack.ilm.IndexLifecycleService.triggered(IndexLifecycleService.java:271)
        at org.elasticsearch.xpack.core.scheduler.SchedulerEngine.notifyListeners(SchedulerEngine.java:184)
        at org.elasticsearch.xpack.core.scheduler.SchedulerEngine$ActiveSchedule.run(SchedulerEngine.java:217)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
        at java.base/java.lang.Thread.run(Thread.java:831)
wwodge7n

wwodge7n1#

仅仅为了这个简单的用例就同意太多复杂的设置。
对于任何人来这里只是为了解决这个问题。你可以完全禁用该策略的滚动。(它通常是默认启用在热阶段的高级设置)。
您只需要在创建索引后的特定时间内启用删除阶段。

相关问题