# Fetch @timestamp as epoch via docvalue\_field in 6.x Elasticsearch query

**URL:** <https://discuss.elastic.co/t/fetch-timestamp-as-epoch-via-docvalue-field-in-6-x-elasticsearch-query/119845>\
**Category:** Elasticsearch\
**Created:** [February 14, 2018, 4:35pm UTC](https://discuss.elastic.co/t/fetch-timestamp-as-epoch-via-docvalue-field-in-6-x-elasticsearch-query/119845 "2018-02-14T16:35:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chaitra\_Ranganna](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@Chaitra\_Ranganna](https://discuss.elastic.co/u/Chaitra_Ranganna)\
**Post date:** [February 14, 2018, 4:35pm UTC](https://discuss.elastic.co/t/fetch-timestamp-as-epoch-via-docvalue-field-in-6-x-elasticsearch-query/119845/1 "2018-02-14T16:35:45Z")

</div>

Hi,

In 5.x we used to fetch @timestamp as epoch using docvalue\_field in the query. We have upgraded to 6.x from 5.x and seeing that @timestamp is in text format even though we use docvalues\_field in 6.x. Could you help to fetch timestamp in epoch format.

Below is the output of a query from both the versions

In 5.x it is numeric:  
"\_source": {  
"event\_id": "f31f32a2796dac9f9e795347516afe03e57bd843",  
"event\_timestamp": "2018-02-12T02:50:57.277482+00:00"  
},  
"fields": {  
"event\_timestamp": [  
1518403857277  
]  
},

In 6.x it is textual:  
"\_source": {  
"event\_id": "f31f32a2796dac9f9e795347516afe03e57bd843",  
"event\_timestamp": "2018-02-12T02:50:57.277482+00:00"  
},  
"fields": {  
"event\_timestamp": [  
"2018-02-06T13:35:35.225Z"  
]  
}

---

<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:** [March 14, 2018, 4:36pm UTC](https://discuss.elastic.co/t/fetch-timestamp-as-epoch-via-docvalue-field-in-6-x-elasticsearch-query/119845/2 "2018-03-14T16:36:06Z")

</div>

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