# Java REST API - GET Request - Illegal Argument Exception

**URL:** <https://discuss.elastic.co/t/java-rest-api-get-request-illegal-argument-exception/77071>\
**Category:** Elasticsearch\
**Created:** [March 2, 2017, 1:38am UTC](https://discuss.elastic.co/t/java-rest-api-get-request-illegal-argument-exception/77071 "2017-03-02T01:38:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manuel.Chacon](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@Manuel.Chacon](https://discuss.elastic.co/u/Manuel.Chacon)\
**Post date:** [March 2, 2017, 1:38am UTC](https://discuss.elastic.co/t/java-rest-api-get-request-illegal-argument-exception/77071/1 "2017-03-02T01:38:56Z")

</div>

Hello,

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

[https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/\_example\_requests.html](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/_example_requests.html)

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);
LOG.info("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");

```

OR

```
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?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 2, 2017, 6:51am UTC](https://discuss.elastic.co/t/java-rest-api-get-request-illegal-argument-exception/77071/2 "2017-03-02T06:51:55Z")

</div>

Here are the keys you can use in the map: [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-uri-request.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-uri-request.html)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 30, 2017, 6:51am UTC](https://discuss.elastic.co/t/java-rest-api-get-request-illegal-argument-exception/77071/3 "2017-03-30T06:51:56Z")

</div>

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