Can't make your 'Talking to Elastic Search' examples work


(Matt Bunter) #1

I need to learn (told to by management) Elasticsearch and Logstash. Installed and ran elasticsearch on Linux (a server). Trying to input the employee stuff here : https://www.elastic.co/guide/en/elasticsearch/guide/current/_indexing_employee_documents.html

This works :
curl -XGET 'localhost:9200/_count?pretty' -d '
{
"query": {
"match_all": {}
}
}'
This doesn't :
curl -XPUT 'localhost:9200/megacorp/employee/1
{
"first_name" : "John",
"last_name" : "Smith",
"age" : 25,
"about" : "I love to go rock climbing",
}'
Neither does this:
curl -XPUT 'localhost:9200/megacorp/employee/2
{
"first_name" : "Jane",
"last_name" : "Smith",
"age" : 32,
"about" : "I like to collect rock albums",
"interests": [ "music" ]
}'
I have no idea what this means :
curl: (3) Illegal characters found in URL
I have no idea what this means :
curl: (3) [globbing] nested braces not supported at pos 193

I only have command line access on the server. The server cannot connect to the internet. I won't be using Kibana or Sense.

Can someone give me a link to a site or a resource that will help me troubleshoot these errors please?


(Matt Bunter) #2

This worked :
curl -XPUT 'http://localhost:9200/megacorp/employee/2' -d '

{
"first_name" : "Jane",
"last_name" : "Smith",
"age" : 32,
"about" : "I like to collect rock albums",
"interests": [ "music" ]
}'


(Mark Walkom) #3

The syntax in the docs is Sense based - https://www.elastic.co/guide/en/sense/current/index.html

You will need to escape things accordingly if you are using curl.


(Matt Bunter) #4

Thankyou for your response. I understood that and put the curl details around the GET and PUT commands. I can only use curl, I cannot install Kibana or Sense.


(Magnus B├Ąck) #5

Judging by the error messages I'd say you're suffering from the same kind of quote damage described here: Trying to reduce the storage used by elasticsearch2.2


(system) #6