所以基本上我正在尝试新事物。这次有弹性搜索。 我已经安装了弹性和kibana,当然感觉插件。 我尝试所有基本命令,如创建索引,映射,添加文档等。 一切顺利,直到我尝试批量插入。
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"]}
请帮我解决这个问题。 非常感谢提前。
答案 0 :(得分:2)
每个文档必须在一行上(即不得包含任何换行符)。像这样发送您的批量查询:
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行。