【问题标题】:Insertion Bulk data not work - elastic search插入批量数据不起作用 - 弹性搜索
【发布时间】:2016-06-28 07:12:55
【问题描述】:

所以基本上我在尝试新事物。这次是弹性搜索。 我已经安装了 elastic 和 kibana,当然还有 sense 插件。 我尝试了所有基本命令,如创建索引、映射、添加文档等。 在我尝试批量插入之前一切顺利。

POST /ecommerce/product/_bulk
{"index":{"_id":"1002"}}
{"name":"SWA magazine", "price":"90.000", "description":"swa magazine description",
"status":"active", "quantity":3, "categories":[{"name":"magazine"}], 
"tags":["business", "magazine", "sales", "news"]}
{"index":{"_id":"1003"}}
{"name":"SWA magazine", "price":"90.000", "description":"swa magazine description",
"status":"active", "quantity":3, "categories":[{"name":"magazine"}], 
"tags":["business", "magazine", "sales", "news"]}

我什至不知道我的代码有什么问题。 我总是收到这个错误:

请帮我解决这个问题。 非常感谢。

【问题讨论】:

  • 删除文档中的新行,你会没事的。每个文档必须在一行中
  • @Val 兄弟是哪一行?

标签: elasticsearch kibana-4 sense


【解决方案1】:

每个文档必须位于一行(即不得包含任何换行符)。像这样发送您的批量查询:

POST /ecommerce/product/_bulk
{"index":{"_id":"1002"}}
{"name":"SWA magazine", "price":"90.000", "description":"swa magazine description","status":"active", "quantity":3, "categories":[{"name":"magazine"}], "tags":["business", "magazine", "sales", "news"]}
{"index":{"_id":"1003"}}
{"name":"SWA magazine", "price":"90.000", "description":"swa magazine description", "status":"active", "quantity":3, "categories":[{"name":"magazine"}], "tags":["business", "magazine", "sales", "news"]}

在 Sense 中粘贴时,您应该只有第 1 到 5 行,而不是第 1 到 9 行。

【讨论】:

    猜你喜欢
    • 2022-06-16
    • 2019-06-03
    • 1970-01-01
    • 1970-01-01
    • 2013-10-01
    • 2018-01-01
    • 2021-08-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多