【问题标题】:Elasticsearch - Bulk insert using Sense Web Plugin in WindowsElasticsearch - 在 Windows 中使用 Sense Web 插件进行批量插入
【发布时间】:2016-02-28 01:26:38
【问题描述】:

我正在尝试按照弹性搜索教程 (https://www.elastic.co/guide/en/kibana/current/getting-started.html) 使用 _bulk api 导入 accounts.json 数据。我正在为此任务使用 google-chrome 的 Sense 插件。

当我在 Sense 上粘贴 url curl -XPOST 'localhost:9200/bank/account/_bulk?pretty' --data-binary @accounts.json 时,它会转换为 POST /bank/account/_bulk?pretty

这里的解决方案:Kibana: Cant import Shakespeare.json on Sense Web Plugin,表示使用 CURL 命令。但在 windows 上,curl 命令无法识别。

curl -XPUT localhost:9200/_bulk --data-binary @shakespeare.json 'curl' is not recognized as an internal or external command, operable program or batch file.

【问题讨论】:

  • 您可以在curl.haxx.se/download.html下载适用于Windows的curl
  • @Val 这也无法正常工作,出现此错误:curl -XPOST 'localhost:9200/bank/account/_bulk?pretty' --data-binary @accounts.jsoncurl: (6) Could not resolve host: 'localhost '
  • 好的,我明白了,它适用于:curl -XPOST localhost:9200/bank/account/_bulk?pretty --data-binary @accounts.json。非常感谢:)
  • 您保存accounts.jason文件的路径...如何在Chrome Sense中提及路径
  • 当前版本的sense不支持--data-binary选项,所以无法指定数据文件。为此,请使用 curl 命令或执行 _bulk 导入。

标签: windows elasticsearch kibana sense elasticsearch-bulk-api


【解决方案1】:

试试这个:

POST /<indexName>/<type>/_bulk

复制文件accounts.json的内容

然后运行。

【讨论】:

  • 这个过程在数据量很小的情况下是可以的,但是当数据量很大时,复制粘贴就不起作用了。
【解决方案2】:

只求正确答案:

  1. 在此处下载适用于 Windows 的 curl:https://curl.haxx.se/download.html

    Direct link to curl-7.54.1-win64-mingw

  2. 从本地驱动器上某处的存档中解压缩 bin 文件夹。

  3. 将该文件夹的路径添加到您的 PATH 系统变量中。

  4. 重新启动您的 explorer.exe 进程或重新启动 Windows。这是为了让 shell 刷新 PATH 的值所必需的。

  5. 在命令行shell中,执行以下命令:

    curl -XPOST localhost:9200/{some path here}/_bulk?pretty --data-binary @{file name}
    

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-08-18
    • 2016-08-11
    • 1970-01-01
    • 1970-01-01
    • 2010-10-01
    • 2023-04-03
    • 1970-01-01
    • 2012-09-24
    相关资源
    最近更新 更多