娃哈哈好喝-真的!
技术够用就行,吃好喝好睡好!

修改es默认索引偏移量

如果es查询时出现类似这样的错误:

The length of [message] field of [xxxxxxxx] doc of [xxxx-xxxxx-xxxx-2024.01.01] index has exceeded [1000000] - maximum allowed to be analyzed for highlighting. This maximum can be set by changing the [index.highlight.max_analyzed_offset] index level setting. For large texts, indexing with offsets or term vectors is recommended!

大概意思就是索引默认偏移量设置过小,需要调整index.highlight.max_analyzed_offset的值,默认值时1000000,这个值也不能设置的过大,会影响性能,可以根据实际需要慢慢调整合适大小

1、可以根据单个索引设置

kibana命令行

PUT your_indexname/_settings
{
  "index": {
    "highlight.max_analyzed_offset" : 10000000
  }
}

curl命令行

curl --user admin:123456 -XPUT "http://127.0.0.1:9200/your_indexname/_settings" -H 'Content-Type: application/json' -d' {
"index" : {
"highlight.max_analyzed_offset" : 100000000
}
}'

2、也可以设置全局

kibana命令行

PUT _settings
{
  "index": {
    "highlight.max_analyzed_offset" : 10000000
  }
}

curl命令行

curl --user admin:123456 -XPUT "http://127.0.0.1:9200/_settings" -H 'Content-Type: application/json' -d' {
"index" : {
"highlight.max_analyzed_offset" : 100000000
}
}'
赞(0)
未经允许不得转载:娃哈哈好喝 » 修改es默认索引偏移量
分享到: 更多 (0)