Elastic Search 尝试根据其值将非日期字段解析为日期

Elastic Search attempts to parse a non-date filed as date based on its value

将 NEST 与 .NET Core 结合使用时出现以下错误:

failed to parse field [UniqueId] of type [date] in document with id '123456'. Preview of field's value: '4524395.3.6-0'" CausedBy: "Type: illegal_argument_exception Reason: "failed to parse date field [4524395.3.6-0] with format [strict_date_optional_time||epoch_millis]" CausedBy: "Type: date_time_parse_exception Reason: "Failed to parse with all enclosed parsers"""

UniqueId是一个字符串字段,下面是它的索引部分:

 "UniqueId" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },

我们如何阻止 elastic 尝试解析它?

您的映射包含多个 externalUniqueId 字段(在不同的层次结构级别),并且所有字段都是 text/keyword 类型,除了一个 date 类型(在 parents.labour).

这就是导致您遇到的问题的原因。您需要修复该字段的映射,并重新索引整个索引才能使其正常工作。