Hi All,
I have written a sample java client which will connect to a remote Ip and collect the data from ElasticSearch but keep on getting below exception .But below code working as expected with localhost. Could someone tell me what is wrong with below code.
client = **new** RestHighLevelClient(
RestClient. *builder* ( **new** HttpHost("18.21.51.2xx",9200,"http")));
SearchSourceBuilder searchSourceBuilder = **new** SearchSourceBuilder().query(QueryBuilders. *matchQuery* ("orgId", orgId))
.sort("timestamp_match", SortOrder. ***DESC*** ).from(0).size(50).trackTotalHits( **true** ).fetchSource( **true** );
SearchRequest req = **new** SearchRequest("logs");
req.source(searchSourceBuilder);
SearchResponse searchResponse = client.search(req, RequestOptions. ***DEFAULT*** );
below is the exception stack trace
org.elasticsearch.client.ResponseException: method [POST], host [http://18.218.51.224:9200], URI [/logs/_search?typed_keys=true&ignore_unavailable=false&expand_wildcards=open&allow_no_indices=true&ignore_throttled=true&scroll=10m&search_type=query_then_fetch&batched_reduce_size=512&ccs_minimize_roundtrips=true], status line [HTTP/1.1 500 Internal Server Error]
{"error":{"root_cause":[{"type":"json_parse_exception","reason":"Current token (VALUE_NUMBER_INT) not of boolean type\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@4baf3f00; line: 1, column: 366]"}],"type":"json_parse_exception","reason":"Current token (VALUE_NUMBER_INT) not of boolean type\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@4baf3f00; line: 1, column: 366]"},"status":500}
at org.elasticsearch.client.RestClient.convertResponse(RestClient.java:253)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:231)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:205)
at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1454)
logstash version: 7.4.0
ElasticSearch: 6.8.0