版本: 6.8-8.9
简要来说,当 Elasticsearch 无法解析响应的主体时会出现此错误。这可能是由于响应格式不正确、内容类型错误或 Elasticsearch 客户端中的 bug 导致的。要解决此问题,您可以尝试以下方法:1) 检查响应主体的格式以确保其格式正确。2) 验证响应的内容类型。对于 Elasticsearch,它应该是 ‘application/json’。3) 将您的 Elasticsearch 客户端更新到最新版本,因为这可能是在新版本中已修复的 bug。
日志上下文 #
日志 “Error extracting body from response” 的类名是 RemoteScrollableHitSource.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:
try {
throw new ElasticsearchException(
"Response didn't include Content-Type: " + bodyMessage(response.getEntity())
);
} catch (IOException e) {
ElasticsearchException ee = new ElasticsearchException("Error extracting body from response");
ee.addSuppressed(e);
throw ee;
}
}
// EMPTY is safe here because we don't call namedObject





