0
votes

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.

1
can you try sending it as a post request?user156327
Hi, Glad it helped, Could you also please upvote and marked the answer, so that it would be useful for community :)user156327
Hi, Sorry to bother you but as it worked, it would be great if you can take out some time and mark it as an answer so that it would be useful and would be encouraging for me.user156327
I upvoted your answer. There is anything else I should do?RafaelCaballero

1 Answers

1
votes

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 😀 .