Why not the _ingest/pipeline/_simulate api support custom pattern?

when i use the _ingest/pipeline/_simulate api as flollow:

POST _ingest/pipeline/_simulate
{
  "pipeline": {
    "description": "转换成指定格式的日期格式字段",
    "processors": [
      {
      "date": {
        "field": "date",
        "formats": ["UNIX"],
        "target_field": "@timestamp", 
        "timezone": "Asia/Shanghai"
      }
      }
    ]
  },
  "docs": [
    {
      "_index": "index",
      "_type": "type",
      "_id": "id",
      "_source": {
        "code":"000001",
        "tag": "衣柜",
        "price":"999.8",
        "date":"1511696379"
      }
    }
  ]
}

i find that i only can get the result for ISO format as follow:

{
  "docs": [
    {
      "doc": {
        "_index": "index",
        "_type": "type",
        "_id": "id",
        "_source": {
          "date": "1511696379",
          "code": "000001",
          "@timestamp": "2017-11-26T19:39:39.000+08:00",
          "price": "999.8",
          "tag": "衣柜"
        },
        "_ingest": {
          "timestamp": "2017-11-26T12:25:43.321Z"
        }
      }
    }
  ]
}

now what should i do to get another format for the "@timestamp" field in the result like "2017-11-26 19:39:39".

The goal of the ingest date processor is to read a String and convert it to a Date object.
The Date object is then stored as a date.

This explains why you see that format.

IMO the only way to transform it to another format is to use a Painless script.
But you should may be do that at query time when you want to render the result to your user.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.