# Searching ES nested data using Hive

**URL:** <https://discuss.elastic.co/t/searching-es-nested-data-using-hive/22559>\
**Category:** Elasticsearch\
**Created:** [March 6, 2015, 4:22pm UTC](https://discuss.elastic.co/t/searching-es-nested-data-using-hive/22559 "2015-03-06T16:22:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nolan\_grace](https://avatars.discourse-cdn.com/v4/letter/n/ecd19e/32.png) [@nolan\_grace](https://discuss.elastic.co/u/nolan_grace)\
**Post date:** [March 6, 2015, 4:22pm UTC](https://discuss.elastic.co/t/searching-es-nested-data-using-hive/22559/1 "2015-03-06T16:22:19Z")

</div>

Hello forgive me if I am under-informed but i am looking for a way to  
search complex data in elasticsearch using hive. The structure I am  
looking at has nested location object that contains longitude and latitude  
and I am looking for a way to create a hive table that flattens out that  
data or to create a separate table with the longitude and latitude in it i  
can use to join to the rest of my dataset in Hive. Please let me know if  
you need more information or if this use case is documented somewhere i  
reference. Thanks for your help.

band:{

name:"nolan",  
location:  
{  
lat:101,  
long: 101  
}

}

Hive table band  
columns - name lat long

Nolan Grace

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/462fa85d-1ea4-4dd1-9e45-0da4d6693fdc%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/462fa85d-1ea4-4dd1-9e45-0da4d6693fdc%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Nolan\_Grace\_2](https://avatars.discourse-cdn.com/v4/letter/n/b3f665/32.png) [@Nolan\_Grace\_2](https://discuss.elastic.co/u/Nolan_Grace_2)\
**Post date:** [March 14, 2015, 4:11pm UTC](https://discuss.elastic.co/t/searching-es-nested-data-using-hive/22559/2 "2015-03-14T16:11:57Z")

</div>

Haha I was able to figure it out. As long as the hive external table is  
created you can reference the nested fields as if the struct column was its  
own table in the select statement. For example after the band table was  
created directly referencing lat in Hive is a easy as SELECT location.lat  
FROM Band;

On Friday, March 6, 2015 at 10:22:19 AM UTC-6, nolan grace wrote:

> Hello forgive me if I am under-informed but i am looking for a way to  
> search complex data in elasticsearch using hive. The structure I am  
> looking at has nested location object that contains longitude and latitude  
> and I am looking for a way to create a hive table that flattens out that  
> data or to create a separate table with the longitude and latitude in it i  
> can use to join to the rest of my dataset in Hive. Please let me know if  
> you need more information or if this use case is documented somewhere i  
> reference. Thanks for your help.
> 
> band:{
> 
> name:"nolan",  
> location:  
> {  
> lat:101,  
> long: 101  
> }
> 
> }
> 
> Hive table band  
> columns - name lat long
> 
> Nolan Grace

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/93300322-daa1-4447-8941-07755c2dc3cc%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/93300322-daa1-4447-8941-07755c2dc3cc%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:26am UTC](https://discuss.elastic.co/t/searching-es-nested-data-using-hive/22559/3 "2017-07-06T00:26:44Z")

</div>


