0
{
 "_index": "user:1494813192000",
 "_type": "fruits",
 "_id": "pbyac5r88-yghe-v1ez-cpgb-sqdjipr54alzgj/tp4oqalbd-bo2v-ikj1-atfq-wezcoeeuf6wiqpt/apple",
 "_score": 1,
 "_routing": "pbyac5r88-yghe-v1ez-cpgb-sqdjipr54alzgj",
 "_source": {
 "numCal": 442,
 "eventTime": 1497315192000,
 "fruitName": "apple"
}

这就是我的弹性搜索中的索引的样子。eventTime 是基于 UTC 的以毫秒为单位的当前时间。我想使用该字段来使用馆长删除我的索引。

这就是我的 ACTION_FILE.YML 的样子

actions:
  1:
    action: delete_indices 
    description: >-
      Delete indices older than 45 days (based on index name), for logstash-
      prefixed indices. Ignore the error if the filter does not result in an
      actionable list of indices (ignore_empty_list) and exit cleanly.
    options:
      ignore_empty_list: True
      timeout_override:
      continue_if_exception: False
      disable_action: False
    filters:
    - filtertype: age
      source: field_stats
      field: 'eventTime'
      direction: older
      unit: days
      unit_count: 30
      exclude:

curator 是否支持基于非数据格式的字段进行删除?

4

1 回答 1

0

我最初在这里回答了这个问题,但也包括在这里。

日期和时间比较基于纪元时间在 Curator 中工作。field_stats由于 Elasticsearch 在内部将日期条目存储为纪元值,这就是为什么在使用for 比较 时通常需要使用存储为日期戳的字段的原因。

但是,如果long在 Elasticsearch 中正确映射为 a 的字段 epoch time 并存储一个 epoch 或 epoch 加上毫秒(但不是十进制),它应该可以很好地与field_stats.

作为参考,演示此原理的代码在此处

于 2017-06-14T05:11:02.140 回答