How to index date object from couchdb-river

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to index date object from couchdb-river

Marek Skorek
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.
Reply | Threaded
Open this post in threaded view
|

Re: How to index date object from couchdb-river

dadoonet

Hi Marek,

 

 

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

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 <[hidden email]> 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/
Twitter : @dadoonet

Reply | Threaded
Open this post in threaded view
|

Re: How to index date object from couchdb-river

Marek Skorek
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.

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 <[hidden email]> 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/
Twitter : @dadoonet