0

When I'm calling elastic search service in firefox RESTClient it seems that body is not sent and it returns all documents in elastic search: enter image description here

enter image description here

But when I copy curl command created by RESTClient itself and execute it in bash shell the response is just OK and it returns requested document.

enter image description here

HTTP/1.1 200 OK
Warning: 299 Elasticsearch-7.8.0-757314695644ea9a1dc2fecd26d1a43856725e65 "[types removal] Specifying types in search requests is deprecated."
content-type: application/json; charset=UTF-8
content-length: 446

{"took":11,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":2,"relation":"eq"},"max_score":0.6931471,"hits":[{"_index":"myindex","_type":"employee","_id":"yNPLjnMBdY381Mciyqch","_score":0.6931471,"_source":{
     "name": "ehsan",
     "value": 5
}},{"_index":"myindex","_type":"employee","_id":"ydPLjnMBdY381Mci96ee","_score":0.6931471,"_source":{
     "name": "ehsan",
     "value": 10
}}]}}

What's the problem here?

Tashkhisi
  • 2,070
  • 1
  • 7
  • 20

1 Answers1

1

Try changing GET to POST in RESTClient. Some HTTP clients (like curl) do send a payload using GET, but others (like RESTClient) probably don't.

As a rule of thumb, always use POST (or PUT) when sending a payload, to make sure the client is actually sending it, with GET you don't get the same guarantee.

Also see this answer

Val
  • 207,596
  • 13
  • 358
  • 360