I'm new to elasticsearch, this is literally my first cluster. I am using Windows 10 and was trying to run the following at the command line:
C:\elastic>curl -X POST "localhost:9200/students/student/1?pretty" -d '{"joao":"pedro","bob":"michael"}'
And I got the following output:
"error" : "Content-Type header [application/x-www-form-urlencoded] is not supported",
"status" : 406
After a little of research, I tried the following:
curl -XPOST "localhost:9200/students/student/1?pretty" -H'Content-Type: application/json' -d '{"joao":"pedro","bob":"michael"}'
And I got the following output:
"error" : "Content-Type header [application/x-www-form-urlencoded] is not supported",
"status" : 406
curl: (6) Could not resolve host: application
How the heck I resolve this problem? Anyone known ANYTHING about it?
Thank you for the suggestion! But I am still going to search for someway of resolve using curl, I have seen 3 tutorials of people using curl and working perfectly.
I just don't understand wtf is happening with my computer. Even so, thanks very much!
So... I made some more research and I discovered that status 406 means that elastic can't use the input, but I am using json, does this means that my elasticsearch is having trouble understanding json?
If this is the case, what should I do?
joaopedro:
curl -XPOST "localhost:9200/students/student/1?pretty" -H'Content-Type: application/json' -d '{"joao":"pedro","bob":"michael"}'
I did it!
curl -H "Content-Type: application/json" --data @hello1.json http://localhost:9200/students/student/2?pretty