Elasticsearch 索引时间戳字段失败
Elasticsearch indexing timestamp-field fails
我无法使用 ElasticSearch(版本 7.10.2)为时间戳字段建立索引,我不明白为什么。
所以我使用以下映射创建了一个索引。您可以将其直接复制并粘贴到 Kibana:
PUT /my-dokumente
{
"mappings" : {
"properties" : {
"aufenthalt" : {
"properties" : {
"aufnahme" : {
"properties" : {
"zeitpunkt" : {
"type" : "date",
"format": "yyyy-MM-dd HH:mm:ss",
"ignore_malformed": true
}
}
},
"entlassung" : {
"properties" : {
"zeitpunkt" : {
"type" : "date",
"format": "yyyy-MM-dd HH:mm:ss",
"ignore_malformed": true
}
}
}
}
}
}
}
}
然后我尝试索引文档:
PUT /my-dokumente/dokumente/1165963
{
"aufenthalt" :
{
"aufnahme" :
{
"zeitpunkt" : "2019-08-18 15:02:13"
},
"entlassung" :
{
"zeitpunkt" : "2019-08-20 10:29:22"
}
}
}
现在,我得到这个错误:
"mapper [aufenthalt.entlassung.zeitpunkt] cannot be changed from type [date] to [text]
为什么弹性搜索不解析我的日期?
我还尝试了 许多 不同的映射设置,例如 strict_date_hour_minute_second
或将时间戳发送为 "2019-08-18T15:02:13"
或 "2019-08-18T15:02:13Z"
,我也转换了它到 epoch millis,但我总是收到一些不同的错误消息,例如 Cannot update parameter [format] from [strict_date_hour_minute_second] to [strict_date_optional_time||epoch_millis]
.
所以基本问题只是:如何将时间戳值发送到 ElasicSearch?(使用 Kibana/CURL)。
PS:我不使用像Java高级Rest客户端这样的客户端SDK。为什么要谈基础 Kibana/CURL.
不可能那么复杂。我错过了什么?
谢谢!
映射类型已在 7.x 中删除。参考这个official documentation
将文档索引到 Elasticsearch 时需要在 URL 中添加 _doc
将URL修改为PUT /my-dokumente/_doc
我无法使用 ElasticSearch(版本 7.10.2)为时间戳字段建立索引,我不明白为什么。
所以我使用以下映射创建了一个索引。您可以将其直接复制并粘贴到 Kibana:
PUT /my-dokumente
{
"mappings" : {
"properties" : {
"aufenthalt" : {
"properties" : {
"aufnahme" : {
"properties" : {
"zeitpunkt" : {
"type" : "date",
"format": "yyyy-MM-dd HH:mm:ss",
"ignore_malformed": true
}
}
},
"entlassung" : {
"properties" : {
"zeitpunkt" : {
"type" : "date",
"format": "yyyy-MM-dd HH:mm:ss",
"ignore_malformed": true
}
}
}
}
}
}
}
}
然后我尝试索引文档:
PUT /my-dokumente/dokumente/1165963
{
"aufenthalt" :
{
"aufnahme" :
{
"zeitpunkt" : "2019-08-18 15:02:13"
},
"entlassung" :
{
"zeitpunkt" : "2019-08-20 10:29:22"
}
}
}
现在,我得到这个错误:
"mapper [aufenthalt.entlassung.zeitpunkt] cannot be changed from type [date] to [text]
为什么弹性搜索不解析我的日期?
我还尝试了 许多 不同的映射设置,例如 strict_date_hour_minute_second
或将时间戳发送为 "2019-08-18T15:02:13"
或 "2019-08-18T15:02:13Z"
,我也转换了它到 epoch millis,但我总是收到一些不同的错误消息,例如 Cannot update parameter [format] from [strict_date_hour_minute_second] to [strict_date_optional_time||epoch_millis]
.
所以基本问题只是:如何将时间戳值发送到 ElasicSearch?(使用 Kibana/CURL)。
PS:我不使用像Java高级Rest客户端这样的客户端SDK。为什么要谈基础 Kibana/CURL.
不可能那么复杂。我错过了什么?
谢谢!
映射类型已在 7.x 中删除。参考这个official documentation
将文档索引到 Elasticsearch 时需要在 URL 中添加 _doc
将URL修改为PUT /my-dokumente/_doc