# Find source code of index date in elasticsearch output plugin

**URL:** <https://discuss.elastic.co/t/find-source-code-of-index-date-in-elasticsearch-output-plugin/226394>\
**Category:** Logstash\
**Created:** [April 3, 2020, 11:16am UTC](https://discuss.elastic.co/t/find-source-code-of-index-date-in-elasticsearch-output-plugin/226394 "2020-04-03T11:16:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mabr3](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@mabr3](https://discuss.elastic.co/u/mabr3)\
**Post date:** [April 3, 2020, 11:16am UTC](https://discuss.elastic.co/t/find-source-code-of-index-date-in-elasticsearch-output-plugin/226394/1 "2020-04-03T11:16:17Z")

</div>

Hi,

After some research I found the confirmation that when using the elasticsearch output plugin and using the date for the index name, it automatically uses the '@timestamp' field. I was also interested in finding in the source code ([https://github.com/logstash-plugins/logstash-output-elasticsearch](https://github.com/logstash-plugins/logstash-output-elasticsearch)) where that happens.

I have very little experience with ruby and can't seem to find that specific part of the code, therefore I'd like ask for some help in finding it.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 3, 2020, 2:09pm UTC](https://discuss.elastic.co/t/find-source-code-of-index-date-in-elasticsearch-output-plugin/226394/2 "2020-04-03T14:09:49Z")

</div>

Take a look at [this](https://github.com/elastic/logstash/blob/5a25c6f8e9b4112c027241cf7cb66b71a5bbef75/logstash-core/src/main/java/org/logstash/StringInterpolation.java#L61) and [this](https://github.com/elastic/logstash/blob/5a25c6f8e9b4112c027241cf7cb66b71a5bbef75/logstash-core/src/main/java/org/logstash/Event.java#L156).

---

<div class="post-metadata">

**Author:** ![mabr3](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@mabr3](https://discuss.elastic.co/u/mabr3)\
**Post date:** [April 3, 2020, 2:40pm UTC](https://discuss.elastic.co/t/find-source-code-of-index-date-in-elasticsearch-output-plugin/226394/3 "2020-04-03T14:40:04Z")

</div>

So in fact its not logstash who puts the date in the index, but ElasticSearch itself. Logstash only gives the format (or in other cases, the field) it wants to use for that event and then ES does the rest.

Thank you very much.

---

<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:** [May 1, 2020, 2:40pm UTC](https://discuss.elastic.co/t/find-source-code-of-index-date-in-elasticsearch-output-plugin/226394/4 "2020-05-01T14:40:09Z")

</div>

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