2016-04-26 73 views
1

我用很多不同的方式,以日期/時間低於轉換成ES日期格式:如何將特定日期映射到Elasticsearch日期/時間字段?

Thu Oct 29 08:17:25 2015 

我用像2012-12-12 12:12:12日期的格式如下

"properties":{ 
    "my_date_field":{ 
    "type":"date", 
    "format":"yyyy-mm-dd HH:mm:ss" 
} 
} 

我經歷了the documentation of Elasticsearch,但沒有我需要將Thu Oct 29 08:17:25 2015轉換爲Elasticsearch date/time字段的格式。我應該如何轉換它?任何幫助?

回答

2

試試這個:

"date": { 
     "type": "date", 
     "format": "EEE MMM dd HH:mm:ss yyyy||EEE MMM dd HH:mm:ss yyyy" 
    } 
+0

謝謝你安德烈,它適用於某些領域而不是其他!有些字段是這樣的:'Wed Apr 6 10:55:41 2016' – ALH

+0

沒有辦法讓單個數字(2,3,...)和12,23之間的日期部分變爲靈活的...... 。? – ALH

+0

嗯,你確定?我剛剛測試了'Wed Apr 6 10:55:41 2016',並且它沒有問題索引。 –

相關問題