嘗試在elasticsearch 7.8.1 中建立索引時,出現錯誤說“testField”太大,必須是<= 32766 有解決辦法嗎?
欄位資訊
"testField":{ "type": "keyword", "index": false }
uj5u.com熱心網友回復:
這是一個已知問題,目前尚不清楚什么是最好的解決方案。Lucene 強制規定最大期限長度為 32766,超過該期限的檔案將被拒絕。
在解決此問題之前,您可以立即選擇兩個選項:
A. 使用script攝取處理器將值截斷為最多 32766 位元組。
PUT _ingest/pipeline/truncate-pipeline
{
"description": "truncate",
"processors": [
{
"script": {
"source": """
ctx.testField = ctx.testField.substring(0, 32766);
"""
}
}
]
}
PUT my-index/_doc/123?pipeline=truncate-pipeline
{ "testField": "hgvuvhv....sjdhbcsdc" }
B. 使用text具有適當分析器的欄位來分析truncate該值,但您將失去對該欄位進行聚合和排序的能力。
如果您想將您的欄位保留為 a keyword,我會選擇選項 A
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/481753.html
標籤:弹性搜索
