📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 6.8-8.9

简而言之,当 Elasticsearch 尝试索引一个空文档时会出现此错误。Elasticsearch 要求文档至少包含一些内容才能被索引。要解决此问题,请确保您尝试索引的文档不为空。检查您的数据源或生成文档的进程,看是否存在导致其生成空文档的问题。或者,您可以在索引之前添加一个验证步骤,以防止空文档被发送到 Elasticsearch。

日志上下文 #

日志 “failed to parse; document is empty” 的类名是 DocumentParser.java, 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:

* @return the parsed document
 * @throws DocumentParsingException whenever there's a problem parsing the document
 */
 public ParsedDocument parseDocument(SourceToParse source; MappingLookup mappingLookup) throws DocumentParsingException {
 if (source.source() != null && source.source().length() == 0) {
 throw new DocumentParsingException(new XContentLocation(0; 0); "failed to parse; document is empty");
 }
 final RootDocumentParserContext context;
 final XContentType xContentType = source.getXContentType();
 try (XContentParser parser = XContentHelper.createParser(parserConfiguration; source.source(); xContentType)) {
 context = new RootDocumentParserContext(mappingLookup; mappingParserContext; source; parser);