使用 "head" 插件的弹性搜索 _bulk 请求

elastic search _bulk request with "head" plugin

我有一个弹性搜索集群,其中 "elasticsearch-head" 插件安装正确。

我想使用 _bulk API 一次插入多个值,但是 _bulk 请求正文的特定格式似乎给插件带来了麻烦。

我使用 "Any query" 面板通过以下设置指定我的请求:
查询:/_bulk
正文:

{ "create" : { "_index" : "eco", "_type" : "usage" } }
{ "index": 1, name" : "my_value" }

我在验证 json 时得到以下信息并且请求不会被执行:

JSON.parse: unexpected non-whitespace character after JSON data at line 2 column 1 of the JSON data

有人知道 elasticsearch-head 插件是否可以处理 _bulk API 吗? 还是我的要求有问题?

您缺少姓名前的引号。

{ "index": 1, "name" : "my_value" }

elasticsearch-head插件不支持_bulk,会导致JSON错误... 希望作者能尽快支持,大家可以提交issue到下面这个网站。 https://github.com/TravisTX/elasticsearch-head-chrome/issues

现在 2021 年 9 月 27 日,ES 7.15.0 .

我尝试使用“head”插件发送 _bulk ,它也失败了。

但我发现使用 Postman 或 Curl 都可以。

[放置]http://localhost:9200/customer/external/_bulk

// Postman > Body > raw > JSON
{"index":{"_id":"1"}}
{"name":"a"}
{"index":{"_id":"2"}}
{"name":"b"}

通知

  • 让每个 json 语句保持在每一行,不要扩展它们。
  • 底部需要一个空行。

使用curl,你需要在文件中保存语句,然后@it:

$ curl -XPUT 'http://localhost:9200/customer/external/_bulk' -H "Content-Type:application/json" --data-binary @esSQL.json