Curl get command not showing data but only header info


(adurga) #1

Hi,

Am working on Elasticsearch server and using the curl command for posting, getting the data in Windows command line.

When I try to post the data using the curl -XPUT command the data appears getting inserted. But when I query the data back using curl-XGET I am not getting the data but only header information like Index name, _id numberetc. Please see the queries and results below. Please let me know where am I going wrong.

curl -XPUT "/megacorp/emp/1" -d "{""first_name"" : ""John"",""last_name"" : ""Smith"",""age"" : "25"}"

{"_index":"megacorp","_type":"emp","_id":"1","_version":1,"created":true}

curl -XPUT "/megacorp/emp/2" -d "{""first_name"" : ""Jane"",""last_name"" : ""Cooper"",""age"" : "35"}"

{"_index":"megacorp","_type":"emp","_id":"2","_version":1,"created":true}

curl -XPUT "/megacorp/emp/3" -d "{""first_name"" : ""Bradleey"",""last_name"" : ""Cooper"",""age"" : "40"}"

{"_index":"megacorp","_type":"emp","_id":"3","_version":1,"created":true}

curl -XGET "/megacorp/emp/_search?q=last_name:Cooper"

{"took":1,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":2,"max_score":1.0,"hits":[{"_index":"megacorp","_type":"emp","_id":"2","_score":1.0},{"_index":"me
gacorp","_type":"emp","_id":"3","_score":1.0}]}}


(system) #2