我正在嘗試運行以下腳本
POST /data_hip/_update/1638643727.0
{
"script":{
"source":"ctx._source.avgmer=4;"
}
}
但我收到以下錯誤。
{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "failed to parse field [@timestamp] of type [date] in document with id '1638643727.0'. Preview of field's value: '1.638642742E12'"
}
],
"type" : "mapper_parsing_exception",
"reason" : "failed to parse field [@timestamp] of type [date] in document with id '1638643727.0'. Preview of field's value: '1.638642742E12'",
"caused_by" : {
"type" : "illegal_argument_exception",
"reason" : "failed to parse date field [1.638642742E12] with format [epoch_millis]",
"caused_by" : {
"type" : "date_time_parse_exception",
"reason" : "Failed to parse with all enclosed parsers"
}
}
},
"status" : 400
}
這很奇怪,因為在查詢(不是更新)時,日期時間被決議得很好。時間戳欄位映射如下
"@timestamp": {
"type":"date",
"format":"epoch_millis"
},
我正在運行 elasticsearch 7
編輯:添加我的索引設定
{
"data_hip" : {
"settings" : {
"index" : {
"routing" : {
"allocation" : {
"include" : {
"_tier_preference" : "data_content"
}
}
},
"number_of_shards" : "1",
"provided_name" : "data_hip",
"creation_date" : "1638559533343",
"number_of_replicas" : "1",
"uuid" : "CHjkvSdhSgySLioCju9NqQ",
"version" : {
"created" : "7150199"
}
}
}
}
}
我沒有運行攝取管道
uj5u.com熱心網友回復:
問題在于科學記數法,即“E12”后綴,在 ES 期望為整數的欄位中。
使用這個reprex:
PUT so_test
{
"mappings": {
"properties": {
"ts": {
"type": "date",
"format": "epoch_millis"
}
}
}
}
# this works
POST so_test/_doc/
{
"ts" : "123456789"
}
# this does not, throws the same error you have IRL
POST so_test/_doc/
{
"ts" : "123456789E12"
}
我不確定這些值是如何/從哪里滲入的,但它們存在于您傳遞給 ES 的檔案中。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/377952.html
標籤:弹性搜索
