Unable to send search query to the Clusterpoint Cloud server with REST

64 views Asked by At

I'm using REST in Java for android and want to send query {"query": "*"} to get list of all documents. I use this url: https://api-eu.clusterpoint.com/my_accoundID/my_db_name

Here are my connection classes to URL:

HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", "application/json");

But I get database status, not list of all documents.

1

There are 1 answers

0
Marija On BEST ANSWER

If you want to send Search query to get list of all documents, you should secify Search command in url and use POST method instead of GET. GET is used for Status. Method, that needs to be used, depends on what you are trying to do.

Just add search command to url: https://api-eu.clusterpoint.com/my_accoundID/my_db_name/_search and change method to "POST".