Hi everyone,
In Java API .....
//Elasticsearch 1.5.2 Code
Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name","elasticsearch").build();
transportClient = new TransportClient(settings);
transportClient = transportClient.addTransportAddress(
new InetSocketTransportAddress("ip adrress",9300));
For
//Elasticsearch 2.3.1 Code
Settings settings = Settings.settingsBuilder().pu("cluster.name","elasticsearch").build();
TransportClient transportClient = TransportClient.builder().settings(settings).buil().addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress("ip address",9300)));
//Common code for 2.3.1 or 1.5.2
SearchRequestBuilder srb = transportClient.prepareSearch("indexname").setTypes("mappingname").setSearchType(SearchType.DFS_QUERY_THEN_FETCH);;
QueryBuilder queryDate=queryDate = QueryBuilders.rangeQuery("timeStamp").to("2016-06-27T23:59:59").from("2016-04-24T00:00:00");
srb.setQuery(queryDate);
SearchResponse searchResponse = srb.execute().actionGet();
//But srb.setFrom(0).setSize(Integer.MAX_VALUE).setExplain(true).execute().actionGet(); [Not Working]
SearchHit[] searchResults = searchResponse.getHits().getHits();
for (SearchHit searchHit : searchResults) {
System.out.println(searchHit.getSource().get("timeStamp");
}
Please anyone help me regarding this Range query size Java API ES2.3.1 .
Thanks in advance
Balu