--- title: "跟随索引没有分片跟随任务 – 如何解决此 Elasticsearch 异常" date: 2026-01-21 lastmod: 2026-01-21 description: "当 Elasticsearch 无法为指定的跟随索引找到任何分片跟随任务时,会触发此错误。通常是因为跟随索引配置不当或主索引不可用。" tags: ["跟随索引", "分片跟随任务", "跨集群复制"] summary: " 版本: 6.8-8.9 简要来说,当 Elasticsearch 无法为指定的跟随索引找到任何分片跟随任务时,就会出现此错误。这通常发生在以下情况:跟随索引未正确配置,或者主索引不可用。要解决此问题,您可以检查跟随索引的配置并确保其正确无误。同时,验证主索引的可用性和健康状态。如果主索引不可用,您可能需要从快照恢复它或重新创建它。 日志上下文 # 日志 “No shard follow tasks for follower indices [{}]” 的类名是 TransportFollowStatsAction.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考: if (Strings.isAllOrWildcard(request.indices()) == false) { final ClusterState state = clusterService.state(); SetshardFollowTaskFollowerIndices = findFollowerIndicesFromShardFollowTasks(state, request.indices()); if (shardFollowTaskFollowerIndices.isEmpty()) { String resources = String.join(";", request.indices()); throw new ResourceNotFoundException("No shard follow tasks for follower indices [{}]", resources); } } super.doExecute(task, request, listener); } " --- > **版本:** 6.8-8.9 简要来说,当 Elasticsearch 无法为指定的跟随索引找到任何分片跟随任务时,就会出现此错误。这通常发生在以下情况:跟随索引未正确配置,或者主索引不可用。要解决此问题,您可以检查跟随索引的配置并确保其正确无误。同时,验证主索引的可用性和健康状态。如果主索引不可用,您可能需要从快照恢复它或重新创建它。 日志上下文 ----------- 日志 "No shard follow tasks for follower indices [{}]" 的类名是 [TransportFollowStatsAction.java。](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考: ```java if (Strings.isAllOrWildcard(request.indices()) == false) { final ClusterState state = clusterService.state(); SetshardFollowTaskFollowerIndices = findFollowerIndicesFromShardFollowTasks(state, request.indices()); if (shardFollowTaskFollowerIndices.isEmpty()) { String resources = String.join(";", request.indices()); throw new ResourceNotFoundException("No shard follow tasks for follower indices [{}]", resources); } } super.doExecute(task, request, listener); } ```