0

I'm new to the elastic-cloud interface. It allows to chooose operations get, post, put and del. I'm trying to submit queries, but I don't know the precise syntax. For instance:

     tweet/_search?q=something

works, but:

     tweet/_search?q={     "match_all": {}   } 

does not, returning a parser error. I have tried with double quotes, but it seems that then it searches for the query as a string.

RafaelCaballero
  • 1,555
  • 2
  • 17
  • 24

1 Answers1

1

The preferred way to test the search APIs are using the POST method, GET API in some case, gives even incorrect search results as it ignores the search and brings the top 10 search results for match_all query.

Elasticsearch supports both methods GET and POST to search but using the GET method which has payload information isn't common on modern app-severs, although Elasticsearch implemented it requires carefully crafting your queries.

Still, if you want to use the GET API, then for complex queries its better to send it as part of request body, I know it sounds weird to send a body to GET request but it works .

Amit
  • 30,756
  • 6
  • 57
  • 88
  • @RafaelCaballero, glad it was helpful, you can also mark it answer so that it would be useful for the community and considered as solved question :) – Amit Apr 29 '20 at 09:56
  • @RafaelCaballero, let me know if you face any issue while marking it answer, happy to help further :) – Amit Apr 29 '20 at 13:13