--- title: "指定ID的Watch不存在" date: 2026-03-22 lastmod: 2026-03-22 description: "Elasticsearch尝试访问不存在的Watch导致的错误及解决方案" tags: ["Elasticsearch", "Watcher", "监控", "API"] summary: " 版本: 6.8-8.9 简而言之,当Elasticsearch尝试访问具有特定ID的watch(一组用于定期运行特定搜索和操作的指令)但找不到它时,就会出现此错误。这可能是由于watch被删除或尚未创建造成的。要解决此问题,您可以使用Get Watch API验证watch的存在。如果它不存在,您需要使用Put Watch API创建它。如果它应该存在但不存在,请检查Elasticsearch集群或数据完整性是否存在问题。 日志上下文 # 日志"Watch with id [{}] does not exist"的类名是 TransportExecuteWatchAction.java。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人使用: response.getPrimaryTerm() ); watch.status().version(response.getVersion()); executeWatch(request, listener, watch, true); } else { listener.onFailure(new ResourceNotFoundException("Watch with id [{}] does not exist", request.getId())); } }; listener::onFailure); client::get ); } else if (request.getWatchSource() != null) { " --- > **版本:** 6.8-8.9 简而言之,当Elasticsearch尝试访问具有特定ID的watch(一组用于定期运行特定搜索和操作的指令)但找不到它时,就会出现此错误。这可能是由于watch被删除或尚未创建造成的。要解决此问题,您可以使用Get Watch API验证watch的存在。如果它不存在,您需要使用Put Watch API创建它。如果它应该存在但不存在,请检查Elasticsearch集群或数据完整性是否存在问题。 ## 日志上下文 日志"Watch with id [{}] does not exist"的类名是[TransportExecuteWatchAction.java](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/)。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人使用: ```java response.getPrimaryTerm() ); watch.status().version(response.getVersion()); executeWatch(request, listener, watch, true); } else { listener.onFailure(new ResourceNotFoundException("Watch with id [{}] does not exist", request.getId())); } }; listener::onFailure); client::get ); } else if (request.getWatchSource() != null) { ```