重新索引时如何传递多个管道

Anj*_*y V 2 elasticsearch

重新索引时无法传递多个管道

当我在重新索引主体中传递两个管道时,我遇到了异常

{
    "error": {
        "root_cause": [
            {
                "type": "x_content_parse_exception",
                "reason": "[7:17] [dest] pipeline doesn't support values of type: START_ARRAY"
            }
        ],
        "type": "x_content_parse_exception",
        "reason": "[7:17] [reindex] failed to parse field [dest]",
        "caused_by": {
            "type": "x_content_parse_exception",
            "reason": "[7:17] [dest] pipeline doesn't support values of type: START_ARRAY"
        }
    },
    "status": 400
}
Run Code Online (Sandbox Code Playgroud)
{
  "source": {
    "index": "elastic_v1"
  },
  "dest": {
    "index": "elastic_v2",
    "pipeline": ["coram_count_script_pipeline","counsel_nested_split_foreach_pipeline"]
  }
}

Run Code Online (Sandbox Code Playgroud)

他们有解决这个问题的方法吗?还是我们需要多次重新索引

Val*_*Val 7

我建议做的是利用pipeline处理器。您需要创建另一个管道,将工作委托给两个现有管道,然后在重新索引调用中引用第三个管道。

PUT _ingest/pipeline/reindexing-pipeline
{
  "description" : "reindexing pipeline",
  "processors" : [
    {
      "pipeline" : {
        "name": "coram_count_script_pipeline"
      }
    },
    {
      "pipeline" : {
        "name": "counsel_nested_split_foreach_pipeline"
      }
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

然后你的重新索引调用将如下所示:

POST _reindex
{
  "source": {
    "index": "elastic_v1"
  },
  "dest": {
    "index": "elastic_v2",
    "pipeline": "reindexing-pipeline"
  }
}
Run Code Online (Sandbox Code Playgroud)