How to index date object from couchdb-river


(Marek Skorek) #1

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? :slight_smile:

Really thanks for any answer.

Regards,
Marek.


(David Pilato) #2

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
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 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? :slight_smile:

Really thanks for any answer.

Regards,
Marek.

--
David Pilato
http://dev.david.pilato.fr/
Twitter : @dadoonet


(Marek Skorek) #3

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 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? :slight_smile:

Really thanks for any answer.

Regards,
Marek.

--
David Pilato
http://dev.david.pilato.fr/
Twitter : @dadoonet


(system) #4