【问题标题】:Nest 1.0 Elasticsearch, indexing DateTime as ISO 8601Nest 1.0 Elasticsearch,将 DateTime 索引为 ISO 8601
【发布时间】:2014-07-24 05:05:18
【问题描述】:

我正在使用 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())));

但是当我检查该日期是如何保存在我的索引中时,我得到: 创建:/日期(1399890590)/

我该如何解决这个问题?我已经检查了正在存储的映射

谢谢,

【问题讨论】:

    标签: c# elasticsearch nest


    【解决方案1】:

    没有什么可以解决的。 ElasticSearch 通过转换为日期的Unix Epoch 表示来存储Date's as long's。您的日期 1399890590 = 2014 年 5 月 12 日星期一 10:29:50 GMT。

    【讨论】:

      猜你喜欢
      • 2016-08-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多