# Default timestamp in date Field

**URL:** <https://discuss.elastic.co/t/default-timestamp-in-date-field/122853>\
**Category:** Elasticsearch\
**Created:** [March 7, 2018, 9:23am UTC](https://discuss.elastic.co/t/default-timestamp-in-date-field/122853 "2018-03-07T09:23:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasad\_kp](https://avatars.discourse-cdn.com/v4/letter/p/dc4da7/32.png) [@prasad\_kp](https://discuss.elastic.co/u/prasad_kp)\
**Post date:** [March 7, 2018, 9:23am UTC](https://discuss.elastic.co/t/default-timestamp-in-date-field/122853/1 "2018-03-07T09:23:06Z")

</div>

I am looking for Replica of Default NOW() (MYSQL) in elasticsearch.As \_timestamp has been removed in the higher version,how we do this in 6.X

```
{
    "properties":{
        "defautlt_time":{
            "type":"date",
            "default_value":"current_now()" --> this will the current time ,need to indexed by ES by default,is there any way to achieve this
        }
    }
}
```

---

<div class="post-metadata">

**Author:** ![Fluorescence](https://avatars.discourse-cdn.com/v4/letter/f/58956e/32.png) [@Fluorescence](https://discuss.elastic.co/u/Fluorescence)\
**Post date:** [March 7, 2018, 9:38am UTC](https://discuss.elastic.co/t/default-timestamp-in-date-field/122853/2 "2018-03-07T09:38:43Z")

</div>

Hi, I am just working on a similar question.

One option is the use of ingest node with a pipeline:

[https://www.elastic.co/guide/en/elasticsearch/reference/current/accessing-data-in-pipelines.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/accessing-data-in-pipelines.html)

Looks something like this:

{  
"set": {  
"field": "date",  
"value": "{{\_ingest.timestamp}}"  
}  
}

The drawback here is, that when doing the insert I need to add the ?pipeline=my\_pipeline at the end of my REST call. This is not always possible when using an external service.

There is a discussion about default pipelines, which would solve this, but as far as I know, this is not shipped yet:

> <https://github.com/elastic/elasticsearch/issues/21101>

Perhaps there is another option as well ...

---

<div class="post-metadata">

**Author:** ![prasad\_kp](https://avatars.discourse-cdn.com/v4/letter/p/dc4da7/32.png) [@prasad\_kp](https://discuss.elastic.co/u/prasad_kp)\
**Post date:** [March 7, 2018, 10:07am UTC](https://discuss.elastic.co/t/default-timestamp-in-date-field/122853/3 "2018-03-07T10:07:47Z")

</div>

> [@Fluorescence](#):
>
> Perhaps there is another option as well .

Thanks niemyjski,what is the other option? m not using any log stash ,I am pushing data to ES from java using Transport client

---

<div class="post-metadata">

**Author:** ![Fluorescence](https://avatars.discourse-cdn.com/v4/letter/f/58956e/32.png) [@Fluorescence](https://discuss.elastic.co/u/Fluorescence)\
**Post date:** [March 7, 2018, 3:25pm UTC](https://discuss.elastic.co/t/default-timestamp-in-date-field/122853/4 "2018-03-07T15:25:02Z")

</div>

When you have control on the calling side, you most likely could use the ingest node as mentioned above. This should not require log stash.

In my case this does not work (as I can not modify the REST call for a new entry to Elasticsearch) thus I am still searching for another option ... I did not mention that there is one.

---

<div class="post-metadata">

**Author:** ![Fluorescence](https://avatars.discourse-cdn.com/v4/letter/f/58956e/32.png) [@Fluorescence](https://discuss.elastic.co/u/Fluorescence)\
**Post date:** [March 15, 2018, 8:51am UTC](https://discuss.elastic.co/t/default-timestamp-in-date-field/122853/5 "2018-03-15T08:51:58Z")

</div>

After further research there seems to be no direct other option. Under the following link there is a sample posted for using ingest node timestamps:

> [@Default ingest pipeline for index?](https://discuss.elastic.co/t/default-ingest-pipeline-for-index/123511):
>
> Hi there, about a year ago there was a topic raised in this forum for getting a default ingest pipeline option as described here: Does someone has any news on this or any alternative? Background on this question is, to create a time stamp (as it was deprecated in V2 and later removed) without having the option to modify REST calls for inserts. Why one would need this? The application can create/use a date field, but there are transport elements in between which can not be controlled, theref…

---

<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:** [April 12, 2018, 8:53am UTC](https://discuss.elastic.co/t/default-timestamp-in-date-field/122853/6 "2018-04-12T08:53:05Z")

</div>

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