【问题标题】:parser exception in elasticsearchelasticsearch中的解析器异常
【发布时间】:2021-06-13 11:50:59
【问题描述】:

C:\Users\vishal\Desktop>curl -s -H "Content-Type: application/x-ndjson" -XPOST "http://localhost:9200/products/_bulk" --data-binary "@产品-批量-json";

{"error":{"root_cause":[{"type":"parse_exception","re​​ason":"request body is required"}],"type":"parse_exception","re​​ason":"request正文是必需的"},"状态":400}

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    以这种格式修改您的批量 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"}
    

    【讨论】:

    • @Vishal Harinath 您是否有机会查看答案,期待您的反馈:-)
    猜你喜欢
    • 2021-11-04
    • 1970-01-01
    • 2020-12-03
    • 1970-01-01
    • 1970-01-01
    • 2016-11-21
    • 2019-01-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多