2015-11-19 37 views
1

我想使用ElasticSearch中的strict_date格式化程序,它是一個格式化程序的完整日期爲四位數年份,一年兩位數月份和兩位數月份日期:yyyy-MM- DD。ElasticSearch日期格式,使用嚴格的錯誤

我使用以下代碼奇蹟:

PUT my_strictindex 
{ 
    "mappings": { 
    "my_type": { 
     "properties": { 
     "dob": { 
      "type": "strict_date" 
     } 
     } 
    } 
    } 
} 

我得到以下錯誤:

{ 「錯誤」:「MapperParsingException [映射[my_type]];嵌套:MapperParsingException [否在字段[dob]]上聲明類型[strict_date]的處理程序;「, 」status「:400 }

任何幫助將不勝感激!

回答

1

參考ES Docs

應該

{ 
    "mappings": { 
    "my_type": { 
     "properties": { 
     "dob": { 
      "type": "date", 
      "format": "strict_date" 
     } 
     } 
    } 
    } 
} 
+0

是的,我已經提到,包括您發佈的代碼,但我將如何去有關將strict_date它的文檔? @ ChintanShah25 – emarel

+0

我編輯了我的答案,你正在使用什麼版本的ES? – ChintanShah25

+0

不幸的是,這仍然不適合我。我運行v 1.6.2 ..這可能是原因嗎? – emarel