I uesd following command from elasticsearch tutorial,
curl -XPUT "http://localhost:9200/movies/movie/1" -d" { "title": "The Godfather","director": "Francis Ford Coppola","year": 1972}"
Which produces following error:
{
"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
Could anyone please help, what i need to do to rectify this error?
The problem is that you use the same quote sign for properties and values inside the JSON object as well as the document itself which you are passing to curl.
Run this command instead:
curl -XPUT "http://localhost:9200/movies/movie/1" -d '{
"title": "The Godfather",
"director": "Francis Ford Coppola",
"year": 1972
}'
Update:
since you are running the command on windows, the above solution won't work, instead your answer can be answered here:
This resulting command should work:
curl -X PUT "http://localhost:9200/movies/movie/1" -d "{
""title"": ""The Godfather"",
""director"": ""Francis Ford Coppola"",
""year"": 1972
}"
I think you are struggling more in curl commands.
Try to use sense plug in in Chrome or Crest client extension for chrome..
https://chrome.google.com/webstore/detail/dev-http-client/aejoelaoggembcahagimdiliamlcdmfm?hl=en
https://chrome.google.com/webstore/detail/sense/doinijnbnggojdlcjifpdckfokbbfpbo?hl=en
It is very easy to use and easy understandable..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With