# How to index date object from couchdb-river

**URL:** <https://discuss.elastic.co/t/how-to-index-date-object-from-couchdb-river/7162>\
**Category:** Elasticsearch\
**Created:** [March 28, 2012, 9:06am UTC](https://discuss.elastic.co/t/how-to-index-date-object-from-couchdb-river/7162 "2012-03-28T09:06:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marek\_Skorek](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@Marek\_Skorek](https://discuss.elastic.co/u/Marek_Skorek)\
**Post date:** [March 28, 2012, 9:06am UTC](https://discuss.elastic.co/t/how-to-index-date-object-from-couchdb-river/7162/1 "2012-03-28T09:06:59Z")

</div>

Hi,

I met a problem during indexing my CouchDB database with an  
elasticsearch couchdb-river.  
I store a date object in couch document but it is stored as a date  
string internally.

The question is, how can I index that date value as a valid date  
object in ES?  
Is it possible at all?  
Maybe it is a good way of enhancement that river? Or maybe not? 🙂

Really thanks for any answer.

Regards,  
Marek.

---

<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:** [March 28, 2012, 10:01am UTC](https://discuss.elastic.co/t/how-to-index-date-object-from-couchdb-river/7162/2 "2012-03-28T10:01:16Z")

</div>

Hi Marek,

You can define your mapping before sending couchDB documents and set your  
own date format for it.

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

[http://www.elasticsearch.org/guide/reference/mapping/core-types.html](http://www.elasticsearch.org/guide/reference/mapping/core-types.html)

{

"tweet"

:

{

"properties"

:

{

"postDate"

:

{

"type"

:

"date"  
,

"format"

:

"YYYY-MM-dd"

}

}

}

}

It should work.  
HTH,

Le 28 mars 2012 à 11:06, scoro [scoropl@gmail.com](mailto:scoropl@gmail.com) a écrit :

> Hi,
> 
> I met a problem during indexing my CouchDB database with an  
> elasticsearch couchdb-river.  
> I store a date object in couch document but it is stored as a date  
> string internally.
> 
> The question is, how can I index that date value as a valid date  
> object in ES?  
> Is it possible at all?  
> Maybe it is a good way of enhancement that river? Or maybe not? 🙂
> 
> Really thanks for any answer.
> 
> Regards,  
> Marek.

--  
David Pilato  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet

---

<div class="post-metadata">

**Author:** ![Marek\_Skorek](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@Marek\_Skorek](https://discuss.elastic.co/u/Marek_Skorek)\
**Post date:** [March 28, 2012, 2:15pm UTC](https://discuss.elastic.co/t/how-to-index-date-object-from-couchdb-river/7162/3 "2012-03-28T14:15:16Z")

</div>

Hi David,

Really thanks for your answer. This will work for me, but there is a small  
pain with the knowledge about which fields are dates.  
Is there any other solution? I understand the es river plugin can not  
automatically recognize a date format from couchdb? Maybe it should be an  
option?

Regards,  
Marek.

W dniu środa, 28 marca 2012, 12:01:16 UTC+2 użytkownik David Pilato napisał:

> Hi Marek,
> 
> You can define your mapping before sending couchDB documents and set your  
> own date format for it.
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/core-types.html)
> 
> {
> 
> "tweet"
> 
> :
> 
> {
> 
> "properties"
> 
> :
> 
> {
> 
> "postDate"
> 
> :
> 
> {
> 
> "type"
> 
> :
> 
> "date"  
> ,
> 
> "format"
> 
> :
> 
> "YYYY-MM-dd"
> 
> }
> 
> }
> 
> }
> 
> }
> 
> It should work.
> 
> HTH,
> 
> Le 28 mars 2012 à 11:06, scoro [scoropl@gmail.com](mailto:scoropl@gmail.com) a écrit :
> 
> > Hi,
> > 
> > I met a problem during indexing my CouchDB database with an  
> > elasticsearch couchdb-river.  
> > I store a date object in couch document but it is stored as a date  
> > string internally.
> > 
> > The question is, how can I index that date value as a valid date  
> > object in ES?  
> > Is it possible at all?  
> > Maybe it is a good way of enhancement that river? Or maybe not? 🙂
> > 
> > Really thanks for any answer.
> > 
> > Regards,  
> > Marek.
> 
> --  
> David Pilato  
> [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> Twitter : @dadoonet

---

<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:** [July 6, 2017, 3:34am UTC](https://discuss.elastic.co/t/how-to-index-date-object-from-couchdb-river/7162/4 "2017-07-06T03:34:19Z")

</div>


