# Hive select from ES on dynamic index failing: all nodes failed

**URL:** https://discuss.elastic.co/t/hive-select-from-es-on-dynamic-index-failing-all-nodes-failed/49140
**Category:** Elasticsearch
**Tags:** es-hadoop
**Created:** [May 4, 2016, 9:07am UTC](https://discuss.elastic.co/t/hive-select-from-es-on-dynamic-index-failing-all-nodes-failed/49140 "2016-05-04T09:07:41Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Keith.Hinde](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@Keith.Hinde](https://discuss.elastic.co/u/Keith.Hinde)
#### Post date: [May 4, 2016, 9:07am UTC](https://discuss.elastic.co/t/hive-select-from-es-on-dynamic-index-failing-all-nodes-failed/49140/1 "2016-05-04T09:07:41Z")

</div>

Hive: v1.2.1.2.3.2.0-2950  
ES-Hadoop: velasticsearch-hadoop-2.3.0.jar  
ES: v2.1.1

So, we have a three node cluster with a dynamically named index - e.g. 001, 002, 003 - each of which holds data related to a subset of customers. The create external table statement includes the following property:

TBLPROPERTIES('es.resource' = '{customer\_partition}/customer\_mapping');

Now, writing to this external table (INSERT/UPDATE) from Hive works well, but any attempt to read (SELECT) blows up with an "all nodes failed" exception. Strangely, attempts to read from any index which is statically named work fine...?

Has anyone experienced this before and/or have any suggestions as to a resolution? I can't see anything specific to this in the various threads.

Thanks in advance!

---

<div class="post-metadata">

### Author: ![Keith.Hinde](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@Keith.Hinde](https://discuss.elastic.co/u/Keith.Hinde)
#### Post date: [May 5, 2016, 11:28am UTC](https://discuss.elastic.co/t/hive-select-from-es-on-dynamic-index-failing-all-nodes-failed/49140/2 "2016-05-05T11:28:39Z")

</div>

OK, so after a little more investigation on a test instance, it's definitely the {customer\_partition} mapping that is throwing things out. If I replace {customer\_partition} with either a specific index name OR a wildcard, the queries work fine (although presumably writing is then broken as there is no way to route data to the correct index).

So, do I need two table definitions - a write (partitioned) and a read (wildcarded) to enable read/write?

---

<div class="post-metadata">

### Author: ![costin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/costin/32/44950_2.png) [@costin](https://discuss.elastic.co/u/costin)
#### Post date: [May 10, 2016, 9:03am UTC](https://discuss.elastic.co/t/hive-select-from-es-on-dynamic-index-failing-all-nodes-failed/49140/3 "2016-05-10T09:03:00Z")

</div>

Dynamic writing works since the target (the index) is determined based on the incoming data. Reading however fails since it's a catch-22; in order to determine the target (the source) one needs access to the data. Which is not known since the target (the source) is not known.  
To go around this, try using aliases which allow you to define a well-known, fixed name such as "customer" which can be easily updated to other indices (such as 001, 002, etc...)  
In case of reads the alias works since one can read from multiple partitions.  
If you want to read from a certain partition, then simply point to it or update the alias accordingly.

---

<div class="post-metadata">

### Author: ![Keith.Hinde](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@Keith.Hinde](https://discuss.elastic.co/u/Keith.Hinde)
#### Post date: [May 10, 2016, 9:21am UTC](https://discuss.elastic.co/t/hive-select-from-es-on-dynamic-index-failing-all-nodes-failed/49140/4 "2016-05-10T09:21:06Z")

</div>

Thanks Costin - Using aliases was actually going to be my next plan of attack, so thanks for validating the approach. I'll give it a go and report back.

---

<div class="post-metadata">

### Author: ![Keith.Hinde](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@Keith.Hinde](https://discuss.elastic.co/u/Keith.Hinde)
#### Post date: [May 17, 2016, 11:37am UTC](https://discuss.elastic.co/t/hive-select-from-es-on-dynamic-index-failing-all-nodes-failed/49140/5 "2016-05-17T11:37:22Z")

</div>

OK, progress update:

- Added an alias, "all nodes failed" error went away. Yay, progress..of a sort!
- Queries taking an age, so added some query DSL to the external table definition, which was an aggregated query...things blew up instantly with an " **org.elasticsearch.hadoop.rest.EsHadoopInvalidRequest: aggregations are not supported with search\_type=scan**" exception

Now, I'm seeing mixed signals on whether this is something that can/will be fixed and in what version of ES-Hadoop. Any opinions/inside knowledge out there?

Thanks again!

---

<div class="post-metadata">

### Author: ![costin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/costin/32/44950_2.png) [@costin](https://discuss.elastic.co/u/costin)
#### Post date: [May 24, 2016, 9:30am UTC](https://discuss.elastic.co/t/hive-select-from-es-on-dynamic-index-failing-all-nodes-failed/49140/6 "2016-05-24T09:30:32Z")

</div>

Aggregations are not supported yet but are a high priority item on the roadmap.

---

<div class="post-metadata">

### Author: ![Keith.Hinde](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@Keith.Hinde](https://discuss.elastic.co/u/Keith.Hinde)
#### Post date: [May 24, 2016, 9:58am UTC](https://discuss.elastic.co/t/hive-select-from-es-on-dynamic-index-failing-all-nodes-failed/49140/7 "2016-05-24T09:58:00Z")

</div>

Thanks Costin - I'll keep my ear to the ground.

---

<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 6, 2017, 1:24pm UTC](https://discuss.elastic.co/t/hive-select-from-es-on-dynamic-index-failing-all-nodes-failed/49140/8 "2017-07-06T13:24:36Z")

</div>


