elasticsearch - elasticsearch中的解析器异常
问题描述
C:\Users\vishal\Desktop>curl -s -H "Content-Type: application/x-ndjson" -XPOST "http://localhost:9200/products/_bulk" --data-binary "@products-bulk -json";
{"error":{"root_cause":[{"type":"parse_exception","reason":"request body is required"}],"type":"parse_exception","reason":"request body is required "},"状态":400}
解决方案
以这种格式修改您的批量 API 请求
curl -H 'Content-Type: application/x-ndjson' -XPOST 'localhost:9200/index-name/_bulk?pretty' --data-binary @products-bulk-json
并且,确保您的 json 文件是这种格式
{"index":{}}
{"col1" : "val1"}
{"index":{}}
{"col1" : "val1"}
{"index":{}}
{"col1" : "val1"}
推荐阅读
- arrays - 在一个for循环中循环遍历2个数组?
- api - Coinmarketcap 上市的 Total Supply api
- javascript - 如何将动态表格中的文本替换为图片
- javascript - 在同一脚本中设置的函数被定义然后未定义
- python-bob - DataFolder 类未检测到训练样本
- reactjs - 在导航(firebase)之间切换时将项目读取到列表中
- discord.js - 如何让我的机器人在没有命令的情况下重复一条消息?
- mysql - SQL:如何查询以获取不包含 3 个字母 'r' 的字符串?
- tensorflow - 对加载有 image_dataset_from_directory 的测试集使用堆叠集成方法
- java - flatMap 三重嵌套流