The requested URL was not found on this server. 不管你信不信,反正我是没找到

Elasticsearch配置Watcher运行时报动态方法找不到

Elasticsearch | 作者 zyy | 发布于2018年12月04日 | 阅读数:2968

watch配置:
{
  "trigger": {
    "schedule": {
      "cron": "0 0 0 * * ?"
    }
  },
  "input": {
    "simple": {}
  },
  "condition": {
    "always": {}
  },
  "actions": {
    "delete_30_old_index": {
      "webhook": {
        "scheme": "http",
        "host": "host",
        "port": 9200,
        "method": "delete",
        "path": "{{ctx.payload.dateToDelete}}",
        "params": {},
        "headers": {},
        "auth": {
          "basic": {
            "username": "elastic",
            "password": "::es_redacted::"
          }
        }
      }
    }
  },
  "metadata": {
    "keep_history_days": 7
  },
  "transform": {
    "script": {
      "source": "return [params.dateToDelete: '/zipkin:' + ctx.execution_time.minusDays(ctx.metadata.keep_history_days).toString('yyyy.MM.dd') ]",
      "lang": "painless"
    }
  }
}
 
报错内容:
{
  "watch_id": "_inlined_",
  "node": "lQv0JBaXSxyhzJEE8djj2Q",
  "state": "executed",
  "user": "elastic",
  "status": {
    "state": {
      "active": true,
      "timestamp": "2018-12-04T01:43:28.163Z"
    },
    "last_checked": "2018-12-04T01:43:28.165Z",
    "last_met_condition": "2018-12-04T01:43:28.165Z",
    "actions": {
      "delete_30_old_index": {
        "ack": {
          "timestamp": "2018-12-04T01:43:28.163Z",
          "state": "awaits_successful_execution"
        }
      }
    },
    "execution_state": "executed",
    "version": -1
  },
  "trigger_event": {
    "type": "manual",
    "triggered_time": "2018-12-04T01:43:28.165Z",
    "manual": {
      "schedule": {
        "scheduled_time": "2018-12-04T01:43:28.165Z"
      }
    }
  },
  "input": {
    "simple": {}
  },
  "condition": {
    "always": {}
  },
  "metadata": {
    "keep_history_days": 7,
    "name": "delete_zipkin_data_7_day",
    "xpack": {
      "type": "json"
    }
  },
  "result": {
    "execution_time": "2018-12-04T01:43:28.165Z",
    "execution_duration": 7,
    "input": {
      "type": "simple",
      "status": "success",
      "payload": {}
    },
    "condition": {
      "type": "always",
      "status": "success",
      "met": true
    },
    "transform": {
      "type": "script",
      "status": "failure",
      "reason": "runtime error",
      "error": {
        "root_cause": [
          {
            "type": "script_exception",
            "reason": "runtime error",
            "script_stack": [
              "return [params.dateToDelete: '/zipkin:' + ctx.execution_time.minusDays(ctx.metadata.keep_history_days).toString('yyyy.MM.dd') ]",
              "                                                                                        ^---- HERE"
            ],
            "script": "return [params.dateToDelete: '/zipkin:' + ctx.execution_time.minusDays(ctx.metadata.keep_history_days).toString('yyyy.MM.dd') ]",
            "lang": "painless"
          }
        ],
        "type": "script_exception",
        "reason": "runtime error",
        "script_stack": [
          "return [params.dateToDelete: '/zipkin:' + ctx.execution_time.minusDays(ctx.metadata.keep_history_days).toString('yyyy.MM.dd') ]",
          "                                                                                        ^---- HERE"
        ],
        "script": "return [params.dateToDelete: '/zipkin:' + ctx.execution_time.minusDays(ctx.metadata.keep_history_days).toString('yyyy.MM.dd') ]",
        "lang": "painless",
        "caused_by": {
          "type": "illegal_argument_exception",
          "reason": "dynamic method [org.joda.time.DateTime, minusDays/1] not found"
        }
      }
    },
    "actions": []
  },
  "messages": [
    "failed to execute watch transform"
  ]
}
 
已邀请:

要回复问题请先登录注册