Search query with java rest client

I am using rest client api for search query but in response i am getting exception of invalid character exception. I am looking for examples to check my format but did not find any.
My code is -

    String body = "{" +
    		HttpEntity entity = new NStringEntity(queryBody.toString(), ContentType.APPLICATION_JSON);

    		Response restResponse = client.performRequest("GET", "/searchable/_search?pretty-d"+body, Collections.emptyMap());

illegal character in query at index 28: /searchable/_search?pretty-d{"query":"{"prefix":"{"search":"{"value"ank"}"}"}"}

Help me out I have an emergency!!!!!!

Remove ?pretty-d

With GET he still needs to pass the JSON query with the source query string parameter

and he has one too many double quote in "value"ank"

still i am getting same exception Illegal character in path at index 19: /searchable/_search{"query":"{"prefix":"{"search":"{"value"ank"}"}"}"}

I think i missed the colon ":"

I added but still same exception do i need to remove double quotes too?

Illegal character in query at index 28: /searchable/_search?pretty-d{"query":"{"prefix":"{"search":"{"value":"ank"}"}"}"}

Changed my format as


but still same error do i need to change anything else

Caused by: Illegal character in path at index 21: /searchable/_search-d{"query":{"prefix":{"search":{"value":"ank"}}}}

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