European and American date formats

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

European and American date formats

Lenak
Hello, Shay

How I can to define date format in mapping that allow me to search on a date field by range in European and American formats like
[2010-08-11 TO 2010-08-30] or [08/11/2010 TO 08/30/2010]

I try to define date format like

"format":"yyyy-MM-dd||yyyy/MM/dd||MM/dd/yyyy"

But I got error when try to write document
{"error":"ReplicationShardOperationFailedException[[111111][4] ]; nested: MapperParsingException[Failed to parse [case.d
ate_created]]; nested: IllegalArgumentException[Invalid format: \"2010/10/10\" is too short]; "}

 $ curl -XPUT 'http://localhost:9200/111111/OBJ/2' -d '
{
    "case" : {
        "title": "privet1",
        "date_created" : "2010/10/10"
    }
}'
It is working after that I delete American format definition from formats and format
"format":"yyyy-MM-dd||yyyy/MM/dd"
Reply | Threaded
Open this post in threaded view
|

Re: European and American date formats

kimchy
Administrator
This should work, can you open an issue with a simpel curl recreation, I will look at this (in the middle of another feature).

-shay.banon

On Mon, Aug 23, 2010 at 10:48 AM, Lenak <[hidden email]> wrote:

Hello, Shay

How I can to define date format in mapping that allow me to search on a date
field by range in European and American formats like
[2010-08-11 TO 2010-08-30] or [08/11/2010 TO 08/30/2010]

I try to define date format like

"format":"yyyy-MM-dd||yyyy/MM/dd||MM/dd/yyyy"

But I got error when try to write document
{"error":"ReplicationShardOperationFailedException[[111111][4] ]; nested:
MapperParsingException[Failed to parse [case.d
ate_created]]; nested: IllegalArgumentException[Invalid format:
\"2010/10/10\" is too short]; "}

 $ curl -XPUT 'http://localhost:9200/111111/OBJ/2' -d '
{
   "case" : {
       "title": "privet1",
       "date_created" : "2010/10/10"
   }
}'
It is working after that I delete American format definition from formats
and format
"format":"yyyy-MM-dd||yyyy/MM/dd"

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/European-and-American-date-formats-tp1285438p1285438.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.