Es pipeline

来自三线的随记
Admin讨论 | 贡献2020年4月15日 (三) 14:41的版本
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
GET _ingest/pipeline/_simulate
{
  "pipeline": {
    "processors": [
      {
        "split": {
          "field": "message",
          "separator": "----",
          "target_field": "split"
        }
      },
      {
        "append": {
          "field": "test1",
          "value": [
            "{{_source.split.0}}"
          ]
        }
      },
      {
        "append": {
          "field": "test2",
          "value": [
            "{{_source.split.1}}"
          ]
        }
      },{
        "remove":{
          "field":"split"
        }
      }
    ]
  },
  "docs": [
    {
      "_source": {
        "message": "abc----efff"
      }
    }
  ]
}


{
  "docs" : [
    {
      "doc" : {
        "_index" : "_index",
        "_type" : "_doc",
        "_id" : "_id",
        "_source" : {
          "test2" : [
            "efff"
          ],
          "message" : "abc----efff",
          "test1" : [
            "abc"
          ]
        },
        "_ingest" : {
          "timestamp" : "2020-04-15T05:33:07.554732Z"
        }
      }
    }
  ]
}


PUT _ingest/pipeline/testpipeline
{
  "description":"test",
    "processors": [
      {
        "split": {
          "field": "message",
          "separator": "----",
          "target_field": "split"
        }
      },
      {
        "append": {
          "field": "test",
          "value": [
            "{{_source.split.0}}"
          ]
        }
      },
      {
        "append": {
          "field": "test2",
          "value": [
            "{{_source.split.1}}"
          ]
        }
      },{
        "remove":{
          "field":"split"
        }
      }
    ]
}