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 = "{" +
"\"query\":"+"\"{"+"\"prefix"+
"\":\"{"+"\"search\":"+
"\"{"+"\"value\"ank"+"\"}"+
"\"}"+"\"}"+"\"}";
queryBody.append(body);
HttpEntity entity = new NStringEntity(queryBody.toString(), ContentType.APPLICATION_JSON);
Response restResponse = client.performRequest("GET", "/searchable/_search?pretty-d"+body, Collections.emptyMap());
Exception
illegal character in query at index 28: /searchable/_search?pretty-d{"query":"{"prefix":"{"search":"{"value"ank"}"}"}"}
Help me out I have an emergency!!!!!!
val
(Val Crettaz)
December 28, 2017, 8:25am
3
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
java.net.URISyntaxException: 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
{"query":{"prefix":{"search":{"value":"ank"}}}}
but still same error do i need to change anything else
Caused by: java.net.URISyntaxException: Illegal character in path at index 21: /searchable/_search-d{"query":{"prefix":{"search":{"value":"ank"}}}}
system
(system)
Closed
January 25, 2018, 11:22am
7
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.