批量创建时出现弹性搜索异常

elastic search exception on bulk create

我想测试批量插入

这是我的要求

curl -PUT "http://localhost:9200/blabla/blabla/_bulk?pretty" -d '{
{"create": {}}\n
{"name" : "super"}\n
}' -i

我收到这个错误:

HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=UTF-8
Content-Length: 210

{
  "error" : "JsonParseException[Unexpected end-of-input: expected close marker for OBJECT (from [Source: [B@29ae00d4; line: 1, column: 0])\n at [Source: [B@29ae00d4; line: 1, column: 3]]",
  "status" : 500
}

我不知道为什么错误消息说要关闭}我猜这是正确的JSON并且我添加了官方网站要求的行尾

这是错误的语法 -d 后不应该有括号 它应该如下:

 curl -PUT "http://localhost:9200/blabla/blabla/_bulk?pretty" -d '
{"create": {}}\n
{"name" : "super"}\n
' -i