版本: 6.8-8.9
简而言之,当 Elasticsearch 期望字段名或数组的开始,但收到空对象时,就会发生此错误。这通常是由于请求体格式不正确造成的。要解决此问题,你应该检查请求体以确保其格式正确。确保存在字段名 “commands” 或正确启动了数组。如果你试图发送空对象,请确保它适合你正在执行的操作。
日志上下文 #
日志 “expected either field name [commands]; or start array; got [{}] instead” 的类名是 AllocationCommands.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:
throw new ElasticsearchParseException("commands should follow with an array element");
} else if (token == XContentParser.Token.START_ARRAY) {
// ok...
} else {
throw new ElasticsearchParseException("expected either field name [commands]; or start array; got [{}] instead", token);
}
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
if (token == XContentParser.Token.START_OBJECT) {
// move to the command name
token = parser.nextToken();





