【问题标题】:Elastic Pipelines: Skip Import On Failure弹性管道:失败时跳过导入
【发布时间】:2020-12-08 06:08:06
【问题描述】:

弹性管道have an on_failure attribute 中的单个处理器。这允许您处理管道中的故障/错误。文档中的示例显示在您的文档上设置一个附加字段。

{
  "description" : "my first pipeline with handled exceptions",
  "processors" : [
    {
      "rename" : {
        "field" : "foo",
        "to" : "bar",
        "on_failure" : [
          {
            "set" : {
              "field" : "error.message",
              "value" : "{{ _ingest.on_failure_message }}"
            }
          }
        ]
      }
    }
  ]
}

如果管道中的任何处理器发生故障,是否可以告诉管道跳过导入文档?

【问题讨论】:

    标签: elasticsearch elastic-pipeline


    【解决方案1】:

    您可以“劫持”drop processor 以直接在on_failure 步骤中跳过(如果您要中止,则无需_ingest.on_failure_message):

    {
      "description": "my first pipeline with handled exceptions",
      "processors": [
        {
          "rename" : {
            "field" : "foo",
            "target_field": "bar",
            "on_failure" : [
              {
                "drop" : {
                  "if" : "true"
                }
              }
            ]
          }
        }
      ]
    }
    

    或将其用作单独的处理器,也许在最后,在处理器的on_failure 处理程序中的任何 设置ctx.error 之后:

    {
      "description": "my first pipeline with handled exceptions",
      "processors": [
        {
          "rename" : {
            "field" : "foo",
            "to" : "bar",
            "on_failure" : [
              {
                "set" : {
                  "field" : "error.message",
                  "value" : "{{ _ingest.on_failure_message }}"
                }
              }
            ]
          }
        },
        {
          "drop": {
            "if": "ctx.error.size() != null"
          }
        }
      ]
    }
    

    当应用管道时,这两个都会导致noop

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-07
      • 2021-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多