# How to populate @timestamp and @version when using Elasticsearch API to import json

**URL:** <https://discuss.elastic.co/t/how-to-populate-timestamp-and-version-when-using-elasticsearch-api-to-import-json/154498>\
**Category:** Elasticsearch\
**Created:** [October 29, 2018, 7:31pm UTC](https://discuss.elastic.co/t/how-to-populate-timestamp-and-version-when-using-elasticsearch-api-to-import-json/154498 "2018-10-29T19:31:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![narschang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/narschang/32/20178_2.png) [@narschang](https://discuss.elastic.co/u/narschang)\
**Post date:** [October 29, 2018, 7:31pm UTC](https://discuss.elastic.co/t/how-to-populate-timestamp-and-version-when-using-elasticsearch-api-to-import-json/154498/1 "2018-10-29T19:31:22Z")

</div>

Question:  
How do I use Ealsticsearch API to populate @timestamp and @version as part of the elasticsearch documentation when importing json file?

More information:  
In our ELK development process, we are using two different approaches to importing data into Elasticsearch:

1. Importing log files through Logstash
2. Importing json files through a customized python script using Elasticsearch API

When importing log files using Logstash, we can specify in the Logstash configuration file whether to populate @timestamp and @version and so on when populating the document in Elasticsearch.

When importing json through a python script using elasticsearch, @timestamp and @version are not populated. What API command should we use here?

Thank you.

Regards,  
Nars

---

<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:** [October 29, 2018, 7:45pm UTC](https://discuss.elastic.co/t/how-to-populate-timestamp-and-version-when-using-elasticsearch-api-to-import-json/154498/2 "2018-10-29T19:45:19Z")

</div>

Elasticsearch never generates it. You need to provide those fields yourself if you need them.

---

<div class="post-metadata">

**Author:** ![narschang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/narschang/32/20178_2.png) [@narschang](https://discuss.elastic.co/u/narschang)\
**Post date:** [October 29, 2018, 7:57pm UTC](https://discuss.elastic.co/t/how-to-populate-timestamp-and-version-when-using-elasticsearch-api-to-import-json/154498/3 "2018-10-29T19:57:26Z")

</div>

Thank you for the response!! Now at least I know this option is not available and I can certainly work on a solution for this. Thank you.

---

<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:** [November 26, 2018, 7:57pm UTC](https://discuss.elastic.co/t/how-to-populate-timestamp-and-version-when-using-elasticsearch-api-to-import-json/154498/4 "2018-11-26T19:57:29Z")

</div>

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