![](/img/trans.png)
[英]Use python to send JSON to ElasticSearch Indexing with timestamp field
[英]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"
,我也將其轉換為紀元毫秒,但我總是得到一些不同的錯誤消息,例如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。
不可能那么復雜。 我錯過了什么?
謝謝!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.