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

**URL:** <https://discuss.elastic.co/t/why-not-the-ingest-pipeline-simulate-api-support-custom-pattern/109135>\
**Category:** Elasticsearch\
**Created:** [November 26, 2017, 12:36pm UTC](https://discuss.elastic.co/t/why-not-the-ingest-pipeline-simulate-api-support-custom-pattern/109135 "2017-11-26T12:36:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![felayman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felayman/32/20791_2.png) [@felayman](https://discuss.elastic.co/u/felayman)\
**Post date:** [November 26, 2017, 12:36pm UTC](https://discuss.elastic.co/t/why-not-the-ingest-pipeline-simulate-api-support-custom-pattern/109135/1 "2017-11-26T12:36:42Z")

</div>

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

```auto
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：

```auto
{
  "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".

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 26, 2017, 10:07pm UTC](https://discuss.elastic.co/t/why-not-the-ingest-pipeline-simulate-api-support-custom-pattern/109135/2 "2017-11-26T22:07:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 24, 2017, 10:08pm UTC](https://discuss.elastic.co/t/why-not-the-ingest-pipeline-simulate-api-support-custom-pattern/109135/3 "2017-12-24T22:08:13Z")

</div>

Closed on December 24, 2017, 10:08pm UTC

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