2013-07-20 31 views
2

上聲明的類型爲[date_hour_minute_second]的處理程序我正在爲Elasticsearch開發一個帶Python Pyes客戶端的驅動程序。我需要一個日期列索引映射格式具有基於文檔http://www.elasticsearch.org/guide/reference/mapping/date-format/否「date_hour_minute_second」還我檢查pyes文檔https://pyes.readthedocs.org/en/latest/guide/reference/mapping/date-format.htmlMapperParsingException:沒有在字段

當我用我的場「date_hour_minute_second」格式我在標題中提到的例外。

這裏是我的字段定義:

 "date": { 
      "boost": 1.0, 
      "store": "yes", 
      "type": "date_hour_minute_second_fraction", 
      "term_vector": "with_positions_offsets" 
     } 

爲什麼它會拋出這樣的例外,甚至文檔說,這是支持我無法弄清楚。

+0

我能幫忙嗎?如果有的話,請接受答案!否則發佈你的問題,我會盡力幫助。 – ramseykhalaf

回答

11

我想你已經把映射稍有不當,你有"date"是字段名稱,你還需要"type": "date"試試這個:

"date": { 
    "type": "date", 
    "format": "date_hour_minute_second_fraction", 
    "store": "yes" 
} 

"boost"是1.0默認情況下,所以沒有必要的。

此外,我會質疑爲什麼你需要"store": "yes",除非你已經關閉全局存儲(它默認情況下,併發送到elasticsearch的整個文件可以檢索)。

最後,"term_vector": "with_positions_offsets"不適用於"date"類型的適用參數。看看at the elasticsearch docs on core types and scroll to the date section

祝你好運!

+0

是的,正確的ramesykhalaf – Pyare

+0

嗨@ramseykhalaf, 經過幾次嘗試後,我明白了你說的話。正確的方法是鍵入:日期和格式:blbablba。 感謝您的回覆和鏈接。 –