【ElasticSearch】异常错误
【ElasticSearch】异常错误
================================================================
1、磁盘满了造成 Elasticsearch 成为只读
2、index.highlight.max_analyzed_offset
3、CentOS8 docker 换成了 podman
4、达到最大分分片书 this cluster currently has [1000]/[1000] maximum shards open 此群集当前最多打开[1000]/[1000]个碎片
5、实体内容太长 org.apache.http.ContentTooLongException: entity content is too long [111214807] for the configured buffer limit [104857600]
6、Document contains at least one immense term in field="content" (whose UTF8 encoding is longer than the max length 32766), all of which were skipped. Please correct the analyzer to not produce such terms.
================================================================
1、磁盘满了造成 Elasticsearch 成为只读
把磁盘重新扩容后还抱下面的错
blocked by: [FORBIDDEN/12/index read-only / allow delete (api)]
把多有的索引设置为非只读 https://www.elastic.co/guide/en/elasticsearch/reference/current/disk-allocator.html
curl -XPUT -H "Content-Type: application/json" http://127.0.0.1:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'
2、index.highlight.max_analyzed_offset
PUT assembly-service-2021.02.03/_settings { "index" : { "highlight.max_analyzed_offset" : 6000000 } }
4、达到最大分片数 this cluster currently has [1000]/[1000] maximum shards open 此群集当前最多打开[1000]/[1000]个碎片
错误
{ "error": { "root_cause": [{ "type": "validation_exception", "reason": "Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [1000]/[1000] maximum shards open;" }], "type": "validation_exception", "reason": "Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [1000]/[1000] maximum shards open;" }, "status": 400 }
更新最大分片数
修改有三种方式
kibana
PUT /_cluster/settings { "persistent": { "cluster": { "max_shards_per_node":10000 } } }
终端
curl -XPUT http://localhost:9200/_cluster/settings -H 'Content-Type:application/json' -d ' { "persistent": { "cluster": { "max_shards_per_node":10000 } } }'
修改配置文件
# vim elasticsearch.yml cluster.max_shards_per_node: 10000
5、实体内容太长 org.apache.http.ContentTooLongException: entity content is too long [111214807] for the configured buffer limit [104857600]
参考:https://blog.csdn.net/qq_34412985/article/details/122122330?spm=1001.2014.3001.5501
// 自定义请求选项
RequestOptions.Builder builder = RequestOptions.DEFAULT.toBuilder(); builder.setHttpAsyncResponseConsumerFactory(new HttpAsyncResponseConsumerFactory.HeapBufferedResponseConsumerFactory(500 * 1024 * 1024));//修改为500MB RequestOptions requestOptions = builder.build(); SearchRequest searchRequest = new SearchRequest(index); restHighLevelClient.search(searchRequest, requestOptions); SearchScrollRequest scrollRequest = new SearchScrollRequest(scrollId); restHighLevelClient.scroll(scrollRequest, requestOptions);
6、Document contains at least one immense term in field="content" (whose UTF8 encoding is longer than the max length 32766), all of which were skipped. Please correct the analyzer to not produce such terms.
keyword类型的字段默认最大匹配长度32766,超过时会报异常,通过设置ignore_above忽略超过长度的。
PUT /content/_mapping
{
"properties": {
"author": {
"type": "keyword",
"ignore_above":32766
}
}
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 通过 API 将Deepseek响应流式内容输出到前端