【发布时间】:2019-11-21 21:06:35
【问题描述】:
我正在使用 Curl 将数据放入 ES。我已经创建了一个customer 索引。
以下命令来自ES document。
curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H 'Content-Type: application/json' -d'
{
"name": "John Doe"
}
'
当我这样做时,我得到一个错误。
{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "failed to parse"
}
],
"type" : "mapper_parsing_exception",
"reason" : "failed to parse",
"caused_by" : {
"type" : "json_parse_exception",
"reason" : "Unexpected character ('n' (code 110)): was expecting double-quote to start field name\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@1ec5236e; line: 3, column: 4]"
}
},
"status" : 400
}
我认为,以下是我错误的主要原因。
reason" : "意外字符 ('n' (code 110)): 期望用双引号来开始字段名称
我有一种感觉,我需要使用(反斜杠)来逃避。但是,我的尝试 \' 效果不佳。有什么建议吗?
【问题讨论】:
标签: elasticsearch curl