I'm using JAVA API.
When I'm indexing document, I create a node by setting properties and close it as follow:
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
settings.put("path.home","elasticSearchNode");
settings.put("number_of_shards",1);
settings.put("number_of_replicas",0);
Node node = NodeBuilder.nodeBuilder().settings(settings).clusterName(elasticSearchNode).node();
node .close();
But when I'm doing search, I get the node as follows :
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
settings.put("path.home","elasticSearchNode");
Node node = NodeBuilder.nodeBuilder().settings(settings).clusterName(elasticSearchNode).node();
But, I'm not closing this node because when a next search request comes to, it uses the same node.
Is it bad to leave the node open for next request? What are the downsides of my approach?
Thanks