2014-05-12 31 views
1

我正在使用Nest 1.0和elasticsearch 1.0。我索引的一個POCO對象,我已經定義的映射:巢1.0 Elasticsearch,索引日期時間爲ISO 8601

_elasticsearchClient.Map<Customer>(c => c 
    .Index("customers") 
    .DynamicDateFormats(new[] { "dateOptionalTime", "yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z" }) 
    .DateDetection(true) 
.NumericDetection(true) 
    .AllField(a => a 
     .Enabled() 
     .IndexAnalyzer("nGram_analyzer") 
     .SearchAnalyzer("whitespace_analyzer") 
     .TermVector(TermVectorOption.with_positions_offsets)) 
    .Properties(props => props 
     .Date(s => s 
      .Name(p => p.Created).Format("dateOptionalTime").Store()))); 

但後來當我檢查怎麼說日期被保存在我的索引,我得到: 創建:/日期(1399890590)/

我該如何解決這個問題?我已檢查存儲的映射

謝謝,

回答

0

沒有什麼可以解決的。 ElasticSearch通過轉換爲日期的Unix Epoch表示來存儲Date's as long's。您的日期1399890590 =星期一,2014年5月12日10:29:50 GMT。