task_cancelled_exception: task_cancelled_exception: Task was cancelled / TaskCancelledException(任务已被取消)
Elasticsearch含义
正在运行的任务(search、_reindex、_update_by_query 等)被取消。取消可能来自用户向 _tasks/_cancel 发出的请求、客户端关闭 HTTP 连接(客户端超时/中止;Elasticsearch 会自动取消关联的搜索),或父任务被取消、异步搜索过期。
原因
用户通过 POST _tasks/<task_id>/_cancel 取消了任务(X-Opaque-Id 只用于标识和查找任务,不会取消任务)、客户端超时断开了连接、长时间运行的昂贵查询,或自适应资源管理停止了繁重的任务。
解决方法
如果任务被意外取消,检查客户端超时和连接设置;优化繁重的查询(更少的数据、更具体的过滤条件)。对于长时间操作,以异步方式运行 _reindex/_update_by_query(wait_for_completion=false),并用 GET _tasks 监控。查看活动任务:GET _tasks?detailed=true。必要时拆分昂贵的查询或使用 scroll/PIT。
同一数据库的其他条目
- master_not_discovered_exceptionmaster_not_discovered_exception / MasterNotDiscoveredException(未发现 master 节点)
- security_exceptionsecurity_exception: unable to authenticate / action [...] is unauthorized for user [...] (HTTP 401/403)(无法认证 / 用户无权执行该操作)
- validation_exceptionvalidation_exception / illegal_argument_exception: Validation Failed: ...(校验失败)
- action_request_validation_exceptionaction_request_validation_exception
- index_closed_exceptionindex_closed_exception
- unavailable_shards_exceptionunavailable_shards_exception
- query_shard_exceptionquery_shard_exception