Hi Everyone,
Iam tring to get data from the elasticsearch and also pushing data to eleasticsearch..But when i do continuesly ...I am getting below exceptions
Java Code side Exception:
disconnecting...
ReceiveTimeoutTransportException[[]
Elasticsearch logs:
java.io.IOException: Too many open files
Here is my code
//GETTING RECORDS CODE
StringTokenizer tokens = new StringTokenizer(ipAddress, ",");
while(tokens.hasMoreTokens()){
listOfIPAddresses.add(tokens.nextToken());
}
Settings settings = Settings.settingsBuilder().put("cluster.name",clusterName).build();
for(int index = 0;index<listOfIPAddresses.size();index++){
transportClient = TransportClient.builder().settings(settings).build().addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress(listOfIPAddresses.get(index),Integer.parseInt(esPort))));
}
SearchRequestBuilder srb = transportClient.prepareSearch(indexName).setTypes(indexMapping)
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).addSort(SortBuilders.fieldSort(esTimeStamp).order(SortOrder.DESC));
queryDate = QueryBuilders.rangeQuery(esTimeStamp).to(todate).from(fromdate);
//addSort(SortBuilders.fieldSort("_id").order(SortOrder.DESC))
SearchResponse searchResponse =srb.setFrom(0).setSize(10000).execute().actionGet();
SearchHit[] searchResults = searchResponse.getHits().getHits();
//Getting records code here
transportClient.close();
//pushing RECORDS code
Settings settings = Settings.settingsBuilder().put("cluster.name", clusterName).build();
for(int index = 0;index<listOfIPAddresses.size();index++){
transportClient = TransportClient.builder().settings(settings).build().addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress(listOfIPAddresses.get(index),Integer.parseInt(esPort))));
}
response = transportClient.prepareIndex(indexName, indexMapping).setSource(jsonString).execute()
.actionGet();
transportClient.close();
Please anyone Help me where iam going wrong....
Thanks and regras
Balu