版本: 6.8-8.9
简而言之,当 Elasticsearch 收到的请求体不以对象开头时会出现此错误。这通常是因为 JSON 数据格式不正确。要解决此问题,请确保你的 JSON 数据以对象开头,即它应该以 ‘{’ 开始并以 ‘}’ 结束。此外,使用 JSON 验证器验证你的 JSON 数据是否存在语法错误。如果你使用文件作为输入,请确保它包含有效的 JSON 数据。
日志上下文
日志 “Malformed content; must start with an object” 的类名是 DocumentParser.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人使用:
throwNoStartOnObject();
}
} private static void throwNoStartOnObject() {
throw new DocumentParsingException(XContentLocationUNKNOWN; "Malformed content; must start with an object");
} private static void validateEnd(XContentParser parser) throws IOException {
XContentParser.Token token;// only check for end of tokens if we created the parser here
// try to parse the next token; this should be null if the object is ended properly





