当我向Elasticsearch插入大型事件时,收到错误:
java.lang.IllegalArgumentException: Document contains at least one immense term in field="_all" (whose UTF8 encoding is longer than the max length 32766), all of which were skipped. Please correct the analyzer to not produce such terms. The prefix of the first immense term is: '[<skipped>]...', original message: bytes can be at most 32766 in length; got 53021
我使用关键字分析器,因为我不希望ES将字段拆分为单独的标记,因此这是我的索引定义:
{
"index" : {
"analysis" : {
"analyzer" : {
"default" : {
"type" : "keyword"
}
}
}
}
}
如何让ES接受我的大型活动,但仍然将关键字分析器作为默认值?
答案 0 :(得分:1)
默认情况下,所有字段值都会添加到_all-field中,因为这些字段也使用关键字分析器,该字段将包含一个大小为50kB的标记,这有点超过限制。该限制似乎不可配置。
一种解决方案是为该字段指定不同的分析器:
curl -XPUT ${ES_HOST}:${ES_PORT}/${ES_INDEX}/${ES_TYPE}/_mapping -d "
{
"${ES_TYPE}": {
"_all\: { "analyzer": "standard" }
}
}"