Java REST API - GET Request - Illegal Argument Exception


I'm new to elastic, and I have gone over the basic documentation available here.

Unfortunately the example provided is a bit trivial, and since I'm new to Elastic in general I suspect I'm missing something basic. I have the following code that works as expected (200 Status Code).

RestClient restClient = RestClient.builder(new HttpHost("myHostName", 9200, "http")).build();
Map<String, String> params = new HashMap<String, String>();
params.put("pretty", "true");

Response elasticRsp = restClient.performRequest("GET", "/myIndexName", params);"Elastic Response Status Code " + elasticRsp.getStatusLine().getStatusCode());

My problem is that once I try to add additional parameters that I think should work to the params map I get Illegal Argument Exceptions. I have tried to add additional lines of code such as:

params.put("default_operator", "AND");


params.put("query", "My Query String");

Can someone PLEASE provide a more robust example and a link to the documentation that shows what keys I can use in the map?

Here are the keys you can use in the map:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.