# Difference between UNIX\_MS and epoch\_millis in date processor?

**URL:** <https://discuss.elastic.co/t/difference-between-unix-ms-and-epoch-millis-in-date-processor/333048>\
**Category:** Elasticsearch\
**Tags:** ingest-pipeline\
**Created:** [May 10, 2023, 8:27am UTC](https://discuss.elastic.co/t/difference-between-unix-ms-and-epoch-millis-in-date-processor/333048 "2023-05-10T08:27:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chengye233](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chengye233/32/120850_2.png) [@chengye233](https://discuss.elastic.co/u/chengye233)\
**Post date:** [May 10, 2023, 8:27am UTC](https://discuss.elastic.co/t/difference-between-unix-ms-and-epoch-millis-in-date-processor/333048/1 "2023-05-10T08:27:37Z")

</div>

Hi, I use ingest pipeline to add `@timestamp` field automatically from a exist date type field.  
My exist date type field is called `uploadTime` and it's date format is `epoch_millis`.

In the processor, I firstly use `epoch_millis` as formats and output\_format, but I find new `@timestamp` value is not equal to `uploadTime` value.  
Then I use `UNIX_MS` as formats and `epoch_millis` as output\_format, `@timestamp` is equal to `uploadTime`.

So my question is what's the difference between `UNIX_MS` and `epoch_millis` in date processor?  
Thanks.

## Infomations:

### 1. `Elastic Stack` version is `8.4`.

### 2. `UNIX_MS ` test case:

processor:

```json
PUT _ingest/pipeline/test-pipeline
{
  "processors": [
    {
      "date": {
        "field": "uploadTime",
        "formats": [
          "UNIX_MS"
        ],
        "target_field": "@timestamp",
        "output_format": "epoch_millis",
        "on_failure": [
          {
            "append": {
              "field": "error.message",
              "value": [
                "{{ _ingest.on_failure_message }}"
              ]
            }
          }
        ]
      }
    }
  ]
}

```

test doc:

```json
[
  {
    "_score": 1,
    "_source": {
      "uploadTime": 1683701716065
    }
  }
]

```

test result:

```json
{
  "_id": "_id",
  "_index": "_index",
  "_version": "-3",
  "_source": {
    "uploadTime": 1683701716065,
    "@timestamp": "1683701716065"
  },
  "_ingest": {
    "pipeline": "_simulate_pipeline",
    "timestamp": "2023-05-10T08:19:25.595621959Z"
  }
}

```

### 3. `epoch_millis` test case:

processor:

```json
PUT _ingest/pipeline/test-pipeline
{
  "processors": [
    {
      "date": {
        "field": "uploadTime",
        "formats": [
          "epoch_millis"
        ],
        "target_field": "@timestamp",
        "output_format": "epoch_millis",
        "on_failure": [
          {
            "append": {
              "field": "error.message",
              "value": [
                "{{ _ingest.on_failure_message }}"
              ]
            }
          }
        ]
      }
    }
  ]
}

```

test doc is same:

```json
[
  {
    "_score": 1,
    "_source": {
      "uploadTime": 1683701716065
    }
  }
]

```

test result:

```json
{
  "docs": [
    {
      "doc": {
        "_index": "_index",
        "_id": "_id",
        "_version": "-3",
        "_source": {
          "uploadTime": 1683701716065,
          "@timestamp": "1672531200065"
        },
        "_ingest": {
          "timestamp": "2023-05-10T08:23:40.197004932Z"
        }
      }
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![Keith\_Massey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/keith_massey/32/83666_2.png) [@Keith\_Massey](https://discuss.elastic.co/u/Keith_Massey)\
**Post date:** [May 10, 2023, 1:40pm UTC](https://discuss.elastic.co/t/difference-between-unix-ms-and-epoch-millis-in-date-processor/333048/2 "2023-05-10T13:40:17Z")

</div>

Thanks for the detailed examples. This really looks like a bug in the handling of `epoch_millis` to me. I created [Fixing DateProcessor when the format is epoch\_millis by masseyke · Pull Request #95996 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/pull/95996) as a potential fix for it, but will discuss with the team to see if that's the right way to go.

---

<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:** [June 7, 2023, 1:40pm UTC](https://discuss.elastic.co/t/difference-between-unix-ms-and-epoch-millis-in-date-processor/333048/3 "2023-06-07T13:40:50Z")

</div>

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