ElasticSearch 创建索引超时(ReadTimeoutError)

报错现象

在 Python 中调用 client.indices.create 来创建 ElasticSearch 索引时,报如下错误:

python 复制代码
elastic_transport.transport - INFO - PUT http://127.0.0.1:9200/document_page?timeout=60s [status:N/A duration:10.011s]
elastic_transport.node_pool - WARNING - Node <Urllib3HttpNode(http://127.0.0.1:9200)> has failed for 1 times in a row, putting on 1 second timeout
elastic_transport.transport - WARNING - Retrying request after failure (attempt 0 of 3)
Traceback (most recent call last):
  File "C:\Users\15797\.conda\envs\ppkg\lib\site-packages\elastic_transport\_transport.py", line 329, in perform_request
    meta, raw_data = node.perform_request(
  File "C:\Users\15797\.conda\envs\ppkg\lib\site-packages\elastic_transport\_node\_http_urllib3.py", line 199, in perform_request
    raise err from None
elastic_transport.ConnectionTimeout: Connection timeout caused by: ReadTimeoutError(HTTPConnectionPool(host='127.0.0.1', port=9200): Read timed out. (read timeout=10.0))

问题分析

在查阅网络资料时,一开始以为是字面意思上的连接超时问题,但调大 timeout 参数也一样报错,而且之前用相同方法创建类似索引时并未出现该问题。

最后,受博文(https://blog.csdn.net/ckq707718837/article/details/136215814)的启发,查看 ElasticSearch 的日志(如下所示),才发现问题所在:电脑磁盘快满了,ES 自动把索引的状态由黄转红,变成只读状态,无法写入

elasticsearch.log(节选内容)

python 复制代码
current.health="RED" message="Cluster health status changed from [YELLOW] to [RED] (reason: [reconcile-desired-balance])." previous.health="YELLOW" reason="reconcile-desired-balance"

flood stage disk watermark [95%] exceeded on [D:\Softwares\elasticsearch-8.6.0\data] free: 5.8gb[2.1%], all indices on this node will be marked read-only

问题解决(两种方法)

相关推荐
kishu_iOS&AI16 分钟前
深度学习 —— 损失函数
人工智能·pytorch·python·深度学习·线性回归
好运的阿财19 分钟前
OpenClaw工具拆解之canvas+message
人工智能·python·ai编程·openclaw·openclaw工具
wengqidaifeng23 分钟前
python启航:1.基础语法知识
开发语言·python
观北海26 分钟前
Windows 平台 Python 极简 ORB-SLAM3 Demo,从零实现实时视觉定位
开发语言·python·动态规划
FreakStudio1 小时前
做了个Claude Code CLI 电子宠物:程序员的实体监工代码搭子
python·单片机·嵌入式·面向对象·并行计算·电子diy·电子计算机
柴米油盐那点事儿1 小时前
python+mysql+bootstrap条件搜索分页
python·mysql·flask·bootstrap
Elastic 中国社区官方博客1 小时前
为 Elastic Cloud Serverless 和 Elasticsearch 引入统一的 API 密钥
大数据·运维·elasticsearch·搜索引擎·云原生·serverless
AC赳赳老秦1 小时前
OpenClaw二次开发实战:编写专属办公自动化技能,适配个性化需求
linux·javascript·人工智能·python·django·测试用例·openclaw
Ulyanov2 小时前
《PySide6 GUI开发指南:QML核心与实践》 第二篇:QML语法精要——构建声明式UI的基础
java·开发语言·javascript·python·ui·gui·雷达电子对抗系统仿真
刀法如飞3 小时前
一款Python语言Django框架DDD脚手架,助你快速搭建项目
python·ddd·脚手架