📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

为什么这个错误发生 #

no_shard_available_action_exception 表示操作无法找到可用的分片来执行。

如何修复 #

1. 检查分片状态 #

GET /_cat/shards?v

2. 解释未分配原因 #

GET /_cluster/allocation/explain

3. 启用分片分配 #

PUT /_cluster/settings
{
  "persistent": {
    "cluster.routing.allocation.enable": "all"
  }
}

4. 重试分配 #

POST /_cluster/reroute?retry_failed=true

预防措施 #

  • 确保有足够的副本
  • 监控分片健康状态