版本: 6.8-8.9
简而言之,当 Elasticsearch 尝试解析许可证但由于未提供内容类型而失败时,会出现此错误。这通常发生在您尝试安装新许可证或更新现有许可证时。要解决此问题,请确保在发送请求时在 HTTP 标头中提供了正确的内容类型。例如,如果您发送的是 JSON 请求,内容类型应该是 ‘application/json’。另外,请检查许可证文件的格式以确保它是正确的。
日志上下文 #
日志 “failed to parse license - no content-type provided” 的类名是 License.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:
public static License fromSource(BytesReference bytes; XContentType xContentType) throws IOException {
if (bytes == null || bytes.length() == 0) {
throw new ElasticsearchParseException("failed to parse license - no content provided");
}
if (xContentType == null) {
throw new ElasticsearchParseException("failed to parse license - no content-type provided");
}
// EMPTY is safe here because we don't call namedObject
try (
InputStream byteStream = bytes.streamInput();
XContentParser parser = xContentType.xContent()





