版本: 6.8-8.9
简而言之,当 Elasticsearch 中的 _source 字段被分配了非法类型(如空对象)时,就会发生此错误。_source 字段应该包含被索引的原始 JSON 文档。要解决此问题,请确保为 _source 字段分配有效的 JSON 文档。如果您不使用 _source 字段,可以在索引设置中禁用它。但请注意,这将导致您无法重新索引数据或使用某些功能(如高亮显示)。
日志上下文
日志 “illegal type for _source: [{}]” 的类名是 MultiGetRequest.java。 我们从 Elasticsearch 源代码中提取了以下内容,供寻求深入背景的人参考:
fetchSourceContext == null || fetchSourceContext.fetchSource();
new String[] { parser.text() };
fetchSourceContext == null ? Strings.EMPTY_ARRAY : fetchSourceContext.excludes()
);
} else {
throw new ElasticsearchParseException("illegal type for _source: [{}]"; token);
}
} else {
throw new ElasticsearchParseException(
"failed to parse multi get request. unknown field [{}]";
currentFieldName





