Custom dates with ElasticSearch mapping


(Allen Liu) #1

I have a date field called "start_date" with the following format:

August 2007
July 2003
January 1999

Would the mapping for this field be:

"completion_date" : {
"type" : "date",
"format" : "yyyy M"
}

Thanks!

Allen


(Allen Liu) #2

Sorry, I meant to switch the month and year:

"completion_date" : {
"type" : "date",
"format" : "M yyyy"
}

On Thursday, May 17, 2012 1:49:38 PM UTC-7, Allen Liu wrote:

I have a date field called "start_date" with the following format:

August 2007
July 2003
January 1999

Would the mapping for this field be:

"completion_date" : {
"type" : "date",
"format" : "yyyy M"
}

Thanks!

Allen


(Allen Liu) #3

Ok..I figured it out:

"completion_date" : {
"type" : "date",
"format" : "MMM yyyy"
}

Supposedly 3 or more M's will bring it to text mode.

On Thursday, May 17, 2012 1:50:18 PM UTC-7, Allen Liu wrote:

Sorry, I meant to switch the month and year:

"completion_date" : {
"type" : "date",
"format" : "M yyyy"
}

On Thursday, May 17, 2012 1:49:38 PM UTC-7, Allen Liu wrote:

I have a date field called "start_date" with the following format:

August 2007
July 2003
January 1999

Would the mapping for this field be:

"completion_date" : {
"type" : "date",
"format" : "yyyy M"
}

Thanks!

Allen


(system) #4