--- title: "Watch is running currently cannot ack until finished - 如何解决此 Elasticsearch 异常" date: 2026-01-11 lastmod: 2026-01-11 description: "Elasticsearch 异常解决方案" tags: ["Elasticsearch", "异常处理"] summary: " 版本: 6.8-7.15 简而言之,当您尝试在监视器(watch)仍在运行时确认它时,就会出现此错误。监视器是在指定间隔运行的任务,用于检查某些条件。确认监视器意味着您已确认看到了其输出。要解决此问题,您可以等待监视器完成运行后再确认它,或者在尝试确认之前手动停止监视器。您还可以考虑调整监视器的计划,如果它运行得太频繁或需要太长时间才能完成。 日志上下文 # 日志“watch[{}] is running currently; cannot ack until finished”的类名是 TransportAckWatchAction.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入理解的人参考: executeAsyncWithOrigin(client; WATCHER_ORIGIN; WatcherStatsAction.INSTANCE; watcherStatsRequest; ActionListener.wrap(response -> { boolean isWatchRunning = response.getNodes().stream() .anyMatch(node -> node.getSnapshots().stream().anyMatch(snapshot -> snapshot.watchId().equals(request.getWatchId()))); if (isWatchRunning) { listener.onFailure(new ElasticsearchStatusException("watch[{}] is running currently; cannot ack until finished"; RestStatus.CONFLICT; request.getWatchId())); } else { GetRequest getRequest = new GetRequest(Watch.INDEX; request.getWatchId()) .preference(Preference.LOCAL.type()).realtime(true); " --- > **版本:** 6.8-7.15 简而言之,当您尝试在监视器(watch)仍在运行时确认它时,就会出现此错误。监视器是在指定间隔运行的任务,用于检查某些条件。确认监视器意味着您已确认看到了其输出。要解决此问题,您可以等待监视器完成运行后再确认它,或者在尝试确认之前手动停止监视器。您还可以考虑调整监视器的计划,如果它运行得太频繁或需要太长时间才能完成。 日志上下文 ----------- 日志“watch[{}] is running currently; cannot ack until finished”的类名是 [TransportAckWatchAction.java。](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入理解的人参考: ```java executeAsyncWithOrigin(client; WATCHER_ORIGIN; WatcherStatsAction.INSTANCE; watcherStatsRequest; ActionListener.wrap(response -> { boolean isWatchRunning = response.getNodes().stream() .anyMatch(node -> node.getSnapshots().stream().anyMatch(snapshot -> snapshot.watchId().equals(request.getWatchId()))); if (isWatchRunning) { listener.onFailure(new ElasticsearchStatusException("watch[{}] is running currently; cannot ack until finished"; RestStatus.CONFLICT; request.getWatchId())); } else { GetRequest getRequest = new GetRequest(Watch.INDEX; request.getWatchId()) .preference(Preference.LOCAL.type()).realtime(true); ```