I am trying to use a JEST Client to search the remotely located ElasticSearch index.
However I've ran into a problem - every single query, be it constructed using various builders or just default ES queries, everything returns com.google.gson.stream.MalformedJsonException
Code:
String URL = "http://api.exiletools.com:80";
String API_KEY = "DEVELOPMENT-Indexer";
JestClientFactory factory = new JestClientFactory();
factory.setHttpClientConfig(new HttpClientConfig.Builder(URL)
.defaultCredentials("apikey", API_KEY)
.build());
JestClient client = factory.getObject();
qb = QueryBuilders
.boolQuery()
.must(QueryBuilders.termQuery("attributes.league", "Standard"))
.must(new TermQueryBuilder("attributes.equipType", "Ring"))
.must(new TermQueryBuilder("shop.verified", "yes"));
searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.query(qb);
query = searchSourceBuilder.toString();
search = new Search.Builder(query).build();
client.execute(search); // Here I get the error
As a final test I just copied the smallest query I could find from Jest integration test examples and just replaced the search terms there, to look like:
query = "{\n"
+ " \"query\" : {\n"
+ " \"term\" : { \"shop.chaosEquiv\" : \"167\" }\n"
+ " }\n"
+ "}";
This query when copied from the output stream looks like this:
{
"query" : {
"term" : { "shop.chaosEquiv" : "167" }
}
}
No trailing whitespaces or anything, looks valid to me.
Still getting the same error. Can anyone tell what is going on?