# Date as \_id

**URL:** <https://discuss.elastic.co/t/date-as--id/74314>\
**Category:** Elasticsearch\
**Created:** [February 8, 2017, 3:26am UTC](https://discuss.elastic.co/t/date-as--id/74314 "2017-02-08T03:26:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Romfeld](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/peter_romfeld/32/15327_2.png) [@Peter\_Romfeld](https://discuss.elastic.co/u/Peter_Romfeld)\
**Post date:** [February 8, 2017, 3:26am UTC](https://discuss.elastic.co/t/date-as--id/74314/1 "2017-02-08T03:26:10Z")

</div>

Hi i only used elasticsearch for centralised logging before,  
we are considering to use elasticsearch to index analytics data for our apps for easier aggregation.

For upsert convenience i was thinking to use the date as _id.  
Example: {provider}/{analytics-type}_{app-id}/2016-02-03\_\_US

From my understanding if i want to aggregate over multiple specific types i can just do:  
{provider}/country\_app1,country\_app2,...

I obviously still will have all the information like provider, app-id and co inside the document.

Is there any downside to using the date as \_id that i am missing?

---

<div class="post-metadata">

**Author:** ![wenpos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wenpos/32/15326_2.png) [@wenpos](https://discuss.elastic.co/u/wenpos)\
**Post date:** [February 8, 2017, 3:37am UTC](https://discuss.elastic.co/t/date-as--id/74314/2 "2017-02-08T03:37:09Z")

</div>

is there two or more records with the same date stamp to save in one type?

---

<div class="post-metadata">

**Author:** ![Peter\_Romfeld](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/peter_romfeld/32/15327_2.png) [@Peter\_Romfeld](https://discuss.elastic.co/u/Peter_Romfeld)\
**Post date:** [February 8, 2017, 3:38am UTC](https://discuss.elastic.co/t/date-as--id/74314/3 "2017-02-08T03:38:43Z")

</div>

no, separation is done with index and types, so there will always be only one document for one date(or depending on type date\_country)

---

<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 8, 2017, 3:38am UTC](https://discuss.elastic.co/t/date-as--id/74314/4 "2017-03-08T03:38:46Z")

</div>

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