【问题标题】:Create a JSON document, elasticsearch创建 JSON 文档,elasticsearch
【发布时间】:2018-04-30 14:31:23
【问题描述】:

我将引用“www.elastic.co”关于创建 JSON 文档的部分文档:

将一个简单的客户文档索引到客户索引中,“外部”类型,ID 为 1,如下所示: 我们的 JSON 文档:{ "name": "John Doe" }

curl -XPUT 'localhost:9200/customer/external/1?pretty' -d '{"name": "John Doe"}'

我从网址中删除了引号,

curl -XPUT localhost:9200/customer/external/1?pretty -d '{"name": "John Doe"}'

结果是错误

{ "error" : "Content-Type header [application/x-www-formurlencoded] is not supported", "status" : 406}

【问题讨论】:

    标签: json elasticsearch indexing document


    【解决方案1】:

    curl 查询中缺少内容类型。

    curl -XPUT -H "Content-Type: application/json" 'localhost:9200/customer/external/1?pretty' -d '{"name": "John Doe"}'
    

    【讨论】:

    • 结果是一个错误:“ crul (6) Could not resolve host 'localhost " and " crul (3) [globbing] unmatched close括号/bracket in column 9"
    • 结果是一个错误:“ crul (6) Could not resolve host 'localhost " and " crul (3) [globbing] unmatched close括号/bracket in column 9"
    • 试试这个curl -XPUT -H "Content-Type: application/json" "localhost:9200/customer/external/1?pretty" -d '{"name": "John Doe"}'
    • " {"error" : { "root_cause" : [{ "type" : "mapper_parsing_exception", "reason" : "解析失败"}], "type" : "mapper_parsing_exception", "原因”:“解析失败”,“caused_by”:{“类型”:“not_x_content_exception”,“原因”:“压缩器检测只能在某些xcontent字节或压缩的xcontent字节上调用”}},“状态”:400 }
    • 你在 windows 中使用 curl 吗?
    猜你喜欢
    • 2020-05-04
    • 2019-11-30
    • 2016-12-07
    • 1970-01-01
    • 2018-09-23
    • 1970-01-01
    • 1970-01-01
    • 2022-10-13
    • 1970-01-01
    相关资源
    最近更新 更多