# Querying Multiple Nodes on Same Host

**URL:** https://discuss.elastic.co/t/querying-multiple-nodes-on-same-host/33324
**Category:** Elasticsearch
**Created:** [October 29, 2015, 11:48pm UTC](https://discuss.elastic.co/t/querying-multiple-nodes-on-same-host/33324 "2015-10-29T23:48:34Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![rahulnadella](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahulnadella/32/22117_2.png) [@rahulnadella](https://discuss.elastic.co/u/rahulnadella)
#### Post date: [October 29, 2015, 11:48pm UTC](https://discuss.elastic.co/t/querying-multiple-nodes-on-same-host/33324/1 "2015-10-29T23:48:34Z")

</div>

I am new to ElasticSearch (1.7) and currently running a Logstash (1.5.4) and ElasticSearch on the same host. I am trying to scale my ElasticSearch to have multiple instances. I have been able to get multiple ElasticSearch instances working with data being correctly inserted into their indices. I was wondering how it is possible to retrieve the data from all three instances using one query (able to retrieve from individual instances)?

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [October 30, 2015, 7:59am UTC](https://discuss.elastic.co/t/querying-multiple-nodes-on-same-host/33324/2 "2015-10-30T07:59:17Z")

</div>

Are these instances part of the same cluster? If yes, then you can query any node for any index that's part of the cluster. If no, your only option would be setting up a tribe node.

---

<div class="post-metadata">

### Author: ![rahulnadella](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahulnadella/32/22117_2.png) [@rahulnadella](https://discuss.elastic.co/u/rahulnadella)
#### Post date: [October 30, 2015, 11:17am UTC](https://discuss.elastic.co/t/querying-multiple-nodes-on-same-host/33324/3 "2015-10-30T11:17:16Z")

</div>

We are using the same cluster to group the nodes, so basically I would have to specifically assign each index (time-based) to a specific node through Logstash. I think I was using a round-robin so they we appearing in each node, so I was able to retrieve the results from the specific node, but was not able to figure out how to aggregate data from multiple nodes in the same cluster. I currently deploy through Ansible so this probably make a little more easier during deployment if this is the case but make a more difficult to retrieve the data through our Django application.

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [October 30, 2015, 5:57pm UTC](https://discuss.elastic.co/t/querying-multiple-nodes-on-same-host/33324/4 "2015-10-30T17:57:28Z")

</div>

> We are using the same cluster to group the nodes, so basically I would have to specifically assign each index (time-based) to a specific node through Logstash.

No... why? Logstash can't control where indexes and shards are allocated.

Again, just connect to any cluster node and let ES deal with everything.

---

<div class="post-metadata">

### Author: ![rahulnadella](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahulnadella/32/22117_2.png) [@rahulnadella](https://discuss.elastic.co/u/rahulnadella)
#### Post date: [October 31, 2015, 5:48pm UTC](https://discuss.elastic.co/t/querying-multiple-nodes-on-same-host/33324/5 "2015-10-31T17:48:55Z")

</div>

I currently trying to scale the system vertically. I am still a little unclear on how the data is supposed to go from Logstash to ElasticSearch without having data getting duplicated (same index exists in each node). Currently each index is showing up in each node I have deployed. My configuration settings are below:

**ElasticSearch setting** s (each Node is configured to have its own config, data/work directory, log file)  
_NODE 1_  
**Cluster Name:** Supply  
**Node Name:** es1  
**Node Master:** True  
**Node Data:** True  
**Minimum Master Nodes:** 2  
**Mulitcast:** False  
**Unicast Hosts:** [localhost:9300]

_NODE 2_  
**Cluster Name:** Supply  
**Node Name:** es2  
**Node Master:** True  
**Node Data:** True  
**Minimum Master Nodes:** 2  
**Mulitcast:** False  
**Unicast Hosts:** [localhost:9300]

_NODE 3_  
**Cluster Name:** Supply  
**Node Name:** es3  
**Node Master:** True  
**Node Data:** True  
**Minimum Master Nodes:** 2  
**Mulitcast:** False  
**Unicast Hosts:** [localhost:9300]

**Logstash Parser output:**  
elasticsearch {  
host =\> "localhost"  
protocol =\> "http"  
port =\> "9200"  
index =\> "estimate-%{+YYYY-MM-dd}"  
cluster =\> "sv"  
template =\> "/opt/logsearch/templates/logsearch\_apple\_template.json"  
template\_name =\> "apple\_template"  
template\_overwrite =\> true  
}

Thanks for the help.

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [October 31, 2015, 6:42pm UTC](https://discuss.elastic.co/t/querying-multiple-nodes-on-same-host/33324/6 "2015-10-31T18:42:23Z")

</div>

> I currently trying to scale the system vertically.

I think you mean horizontally (i.e. increasing the total capacity by adding machines).

> Currently each index is showing up in each node I have deployed.

What, exactly, do you mean by this and what makes you reach that conclusion?

---

<div class="post-metadata">

### Author: ![rahulnadella](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahulnadella/32/22117_2.png) [@rahulnadella](https://discuss.elastic.co/u/rahulnadella)
#### Post date: [October 31, 2015, 11:51pm UTC](https://discuss.elastic.co/t/querying-multiple-nodes-on-same-host/33324/7 "2015-10-31T23:51:28Z")

</div>

Question 1:  
We plan out scaling up to bigger server not more servers (scaling out). We will only have one server in deployment. We were trying to speed up query performance using aggregation due to the indices being to large causing query performance to be slow. We thought by scaling out the number of instances of ElasticSearch we could spread the load across multiple instances which would improve the performance of the aggregation.

Question 2:  
Basically I am seeing the same number of indices with the same document count that return the same results in each of the nodes when query it. I not sure that this should be correct if it is then I fine with it, but I am thinking that it is duplicating the same data in 3 nodes. Is there a way to verify this conclusion?

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [November 1, 2015, 2:46pm UTC](https://discuss.elastic.co/t/querying-multiple-nodes-on-same-host/33324/8 "2015-11-01T14:46:52Z")

</div>

> We plan out scaling up to bigger server not more servers (scaling out). We will only have one server in deployment. We were trying to speed up query performance using aggregation due to the indices being to large causing query performance to be slow. We thought by scaling out the number of instances of Elasticsearch we could spread the load across multiple instances which would improve the performance of the aggregation.

That's correct. Elasticsearch generally scales better horizontally than vertically.

> Basically I am seeing the same number of indices with the same document count that return the same results in each of the nodes when query it. I not sure that this should be correct if it is then I fine with it, but I am thinking that it is duplicating the same data in 3 nodes. Is there a way to verify this conclusion?

Cluster state is global. Any node can be queried regardless of where the data is actually stored. The behavior you see is normal. Don't worry about it.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 5, 2017, 11:41pm UTC](https://discuss.elastic.co/t/querying-multiple-nodes-on-same-host/33324/9 "2017-07-05T23:41:28Z")

</div>


