使用Elasticsearch中的管道提取来重命名元素

时间:2019-01-23 17:25:58

标签: elasticsearch rename kibana

我正在尝试在Elasticsearch中重命名元素,但遇到了问题。

我试图将这个元素重命名为“列表到列表”,所以我尝试了_source.list并成功了。

好吧,之后,我尝试将_source.list.metaData重命名为metaDatas,但似乎遇到了问题。这是我正在使用的代码,这也是映射。

PUT _ingest/pipeline/pipeline_rename_xxx
{
  "description" : "rename xxx",
  "processors" : [
    {
      "rename": {
        "field": "_source.list.metaDatas",
        "target_field": "metaDatas"
      }
    }
  ]
}

{
  "tweet": {
    "mappings": {
      "document": {
        "properties": {
          "list": {
            "properties": {
              "metaData": {



 "reason": "java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: field [_source.list.metaData] doesn't exist"


This is what i am expecting

{
  "tweet": {
    "mappings": {
      "document": {
        "properties": {
          "list": {
            "properties": {
              "metaDatas": {

I will appreciate any help. Thanks

1 个答案:

答案 0 :(得分:0)

POST _reindex
{
  "source": {
    "index": "promoted"
  },
  "dest": {
    "index": "new_promoted"
  }
}

PUT _ingest/pipeline/pipeline_rename_xxx
{
  "description": "rename xxx",
  "processors": [
    {
      "foreach": {
        "field": "list",
        "processor": {
          "foreach": {
            "field": "_ingest._value.promoted.league",
            "processor": {
              "foreach": {
                "field": "_ingest._value.league",
                "processor": {
                  "rename": {
                    "field": "_ingest._value.division.position",
                    "target_field": "_ingest._value.division.positions"
                  }
                }
              }
            }
          }
        }
      }
    }
  ]
}