gpt4 book ai didi

curl - 通过 curl 抛出 MapperParsingException 索引数据?

转载 作者:行者123 更新时间:2023-11-29 02:50:50 25 4
gpt4 key购买 nike

我使用了 elasticsearch 教程中的命令,

curl -XPUT "http://localhost:9200/movies/movie/1" -d" { "title": "The Godfather","director": "Francis Ford Coppola","year": 1972}"

产生以下错误:

{
"error":"MapperParsingException[failed to parse]; nested: JsonParseException[Unrecognized token 'The': was expecting ('true', 'false' or 'null')
at [Source: [B@d809e3; line: 1, column: 27]]; ",
"status":400
}

curl: (6) Could not resolve host: Godfather,director
curl: (6) Could not resolve host: Ford
curl: (3) [globbing] unmatched close brace/bracket in column 19

谁能帮忙,我需要做什么来纠正这个错误?

最佳答案

问题是您对 JSON 对象内的属性和值以及要传递给 curl 的文档本身使用相同的引号。

改为运行此命令:

curl -XPUT "http://localhost:9200/movies/movie/1" -d '{
"title": "The Godfather",
"director": "Francis Ford Coppola",
"year": 1972
}'

更新:

由于您是在Windows 上运行该命令,上述解决方案将不起作用,您的答案可以得到解答here :

此生成的命令应该有效:

curl -X PUT "http://localhost:9200/movies/movie/1" -d "{ 
""title"": ""The Godfather"",
""director"": ""Francis Ford Coppola"",
""year"": 1972
}"

关于curl - 通过 curl 抛出 MapperParsingException 索引数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22530774/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com