One date field mapping for two different locale


(Jahrit) #1

Here's the problem.

I have data with date field that can be either in english or german date format (or rather week and month naming convention).

I.e."Mittwoch, 18. Juni 2012" or "Wednesday, 18. June 2012"

I can set up separate mappings for separate fileds for each nation's date.

{
"website" : {
"properties" : {
"date_en" : {
"type" : "date",
"format" : "EEE, dd. MMM yyyy",
"locale" : "US"
}
}
}
}

{
"website" : {
"properties" : {
"date_de" : {
"type" : "date",
"format" : "EEE, dd. MMM yyyy",
"locale" : "DE"
}
}
}
}

And this work properly, untill I will try to put engilsh date into german date field and backwards.

I do not have option to receive some additional data with date's locale information.

What I need is the option to recognize each type of date, save it internally in timestamp (for sorting) and do that in one and the same field (because of sorting and field naming convention).

Something like this.
{
"website" : {
"properties" : {
"date" : {
"type" : "date",
"format" : "EEE, dd. MMM yyyy",
"locale" : "US||DE"
}
}
}
}

What I want to achive is be able to sort all documents with different country dates by date. Maybe there can be different approach. I'll gladly try other solutions.


(system) #2