我正在使用Nest 1.0和elasticsearch 1.0。我正在索引POCO对象,并且定义了一个映射:
_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())));
但是当我检查该Date如何保存在索引中时,我得到:
创建于:/ Date(1399890590)/
我该如何解决?我检查了正在存储的映射
谢谢,
最佳答案
没有要修复的东西。 ElasticSearch通过转换为日期的Date's as long's表示来存储Unix Epoch。您的日期1399890590 = 2014年5月12日星期一10:29:50 GMT。
关于c# - Nest 1.0 Elasticsearch,将DateTime索引为ISO 8601,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23606840/