Indexing custom date format


(pulkitsinghal) #1

All the out-of-the-box date formats are available here:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-date-format.html

But other than preprocessing a custom date format before indexing the data,
is there anything I can do on the mapping side to allow ES to process a
date like:

"2013-11-23 22:39:11" and not throw errors like it is malformed at "
22:39:11" ?

Thanks!

  • Pulkit

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/47177c44-0c2d-43d0-a838-189ae17ced32%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(pulkitsinghal) #2

My current mapping looks like:

'sale_date': {
'format': 'dateOptionalTime',
'type': 'date'
}

On Sunday, February 23, 2014 4:35:36 PM UTC-6, pulkitsinghal wrote:

All the out-of-the-box date formats are available here:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-date-format.html

But other than preprocessing a custom date format before indexing the
data, is there anything I can do on the mapping side to allow ES to process
a date like:

"2013-11-23 22:39:11" and not throw errors like it is malformed at "
22:39:11" ?

Thanks!

  • Pulkit

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/61bc3b33-061d-4c02-b5ab-9bfae65c5b05%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexander Reelsen) #3

Hey,

you have to change the mapping to accept your custom date time format. You
can set it in your mapping using the format parameter like this

{"sales_date": {"type" : "date", "format" : "yyyy-MM-dd ... AND THE REST
HERE"}}

it uses the java SimpleDateFormat class for the defining the date format..

--Alex

On Sun, Feb 23, 2014 at 11:37 PM, pulkitsinghal pulkitsinghal@gmail.comwrote:

My current mapping looks like:

'sale_date': {
'format': 'dateOptionalTime',
'type': 'date'
}

On Sunday, February 23, 2014 4:35:36 PM UTC-6, pulkitsinghal wrote:

All the out-of-the-box date formats are available here:
http://www.elasticsearch.org/guide/en/elasticsearch/
reference/current/mapping-date-format.html

But other than preprocessing a custom date format before indexing the
data, is there anything I can do on the mapping side to allow ES to process
a date like:

"2013-11-23 22:39:11" and not throw errors like it is malformed at "
22:39:11" ?

Thanks!

  • Pulkit

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/61bc3b33-061d-4c02-b5ab-9bfae65c5b05%40googlegroups.com
.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGCwEM-vavw8WD_-6g8Fnf%2B6L1gUp3_FLy0wk3VsyrJjJ4kaxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4