每次我根據這個索引加載儀表板時,這個錯誤不斷彈出
我的可視化效果仍然很好,資料仍在出現,我以前從未遇到過這個錯誤。關于如何解決此問題的任何想法?
這是錯誤彈出視窗的回應:
{
"took": 1137,
"timed_out": false,
"terminated_early": false,
"_shards": {
"total": 280,
"successful": 277,
"skipped": 0,
"failed": 3,
"failures": [
{
"shard": 1,
"index": "nbs_comprehend-2021-w41",
"node": "oGEHA-aRSnmwuEmqSZc6Kw",
"reason": {
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"org.elasticsearch.index.fielddata.ScriptDocValues$Longs.get(ScriptDocValues.java:121)",
"org.elasticsearch.index.fielddata.ScriptDocValues$Longs.getValue(ScriptDocValues.java:115)",
"doc['user.followers_count'].value > 9999 ? 1 : 0",
" ^---- HERE"
],
"script": "doc['user.followers_count'].value > 9999 ? 1 : 0",
"lang": "painless",
"position": {
"offset": 27,
"start": 0,
"end": 48
},
"caused_by": {
"type": "illegal_state_exception",
"reason": "A document doesn't have a value for a field! Use doc[<field>].size()==0 to check if a document is missing a field!"
}
}
}
]
},
"hits": {
"total": 696059,
"max_score": null,
"hits": []
},
"aggregations": {
"termsAgg": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 0,
"doc_count": 604397
},
{
"key": 1,
"doc_count": 91662
}
]
}
}
}
uj5u.com熱心網友回復:
您有一個檔案,其中的欄位沒有user.followers_count. 您的腳本欄位根本沒有檢查它,因此當它無法回傳任何值時會出錯。這A document doesn't have a value for a field就是錯誤中所說的
試試這個,如果該欄位為空,它將回傳一個零,基本上是創建一個默認值;
if (doc['user.followers_count'].size() == 0) { return "0" } else { return doc['user.followers_count'].value > 9999 ? 1 : 0 }
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/330912.html
