# Load ES Nested Mapping from Hive

**URL:** <https://discuss.elastic.co/t/load-es-nested-mapping-from-hive/22873>\
**Category:** Elasticsearch\
**Created:** [March 24, 2015, 9:10pm UTC](https://discuss.elastic.co/t/load-es-nested-mapping-from-hive/22873 "2015-03-24T21:10:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ankur\_Wahi](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@Ankur\_Wahi](https://discuss.elastic.co/u/Ankur_Wahi)\
**Post date:** [March 24, 2015, 9:10pm UTC](https://discuss.elastic.co/t/load-es-nested-mapping-from-hive/22873/1 "2015-03-24T21:10:55Z")

</div>

Hi,

I'm trying to load an ES nested mapping from Hive.  
My tables are listed below:

CREATE TABLE ORDER(  
order\_id bigint,  
total\_amount bigint,  
customer bigint)  
STORED AS ORC

CREATE TABLE ORDER\_DETAILS(  
order\_id bigint,  
Order\_Item\_id bigint,  
Item\_Size bigint,  
Item\_amount bigint,  
Item\_type string)  
STORED AS ORC

Order and Order\_Details have a 1-M relationship

I want to store the data above into Elasticseacrh, such that Order\_Details  
is a Nested Mapping of Order.

My ES Mapping would look somehwat like this

{  
"order" : {  
"orderid" : {"type": "float" },  
"total\_amount" : {"type": "float" },  
"customer" : {"type": "float" }  
"properties" : {  
"order\_details" : {  
"type" : "nested",  
"properties": {  
"Order\_Item\_id" : {"type": "float" },  
"Item\_Size" : {"type": "float" },  
"Item\_amount" : {"type": "float" },  
"Item\_type": {"type": "string" }  
}  
}  
}  
}  
}

My question is how do I convert the 1-M relation in Hive and load it into  
ES mapping?

Possible Solution  
I will create another Hive table which will contain the join query of the  
two source Hive tables  
But what is structure of this Hive table, so that it maps to ES mapping?

Any help/suggestions?

Thanks  
Ankur

--  
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/cdfee0e9-e0fa-47e4-b847-55b010984574%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/cdfee0e9-e0fa-47e4-b847-55b010984574%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ankur\_Wahi](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@Ankur\_Wahi](https://discuss.elastic.co/u/Ankur_Wahi)\
**Post date:** [March 27, 2015, 3:43pm UTC](https://discuss.elastic.co/t/load-es-nested-mapping-from-hive/22873/2 "2015-03-27T15:43:32Z")

</div>

Hi,

Can anyone point me to an example on how to resolve this if data is in Hive?

Thanks

On Tuesday, 24 March 2015 16:10:55 UTC-5, Ankur Wahi wrote:

> Hi,
> 
> I'm trying to load an ES nested mapping from Hive.  
> My tables are listed below:
> 
> CREATE TABLE ORDER(  
> order\_id bigint,  
> total\_amount bigint,  
> customer bigint)  
> STORED AS ORC
> 
> CREATE TABLE ORDER\_DETAILS(  
> order\_id bigint,  
> Order\_Item\_id bigint,  
> Item\_Size bigint,  
> Item\_amount bigint,  
> Item\_type string)  
> STORED AS ORC
> 
> Order and Order\_Details have a 1-M relationship
> 
> I want to store the data above into Elasticseacrh, such that Order\_Details  
> is a Nested Mapping of Order.
> 
> My ES Mapping would look somehwat like this
> 
> {  
> "order" : {  
> "orderid" : {"type": "float" },  
> "total\_amount" : {"type": "float" },  
> "customer" : {"type": "float" }  
> "properties" : {  
> "order\_details" : {  
> "type" : "nested",  
> "properties": {  
> "Order\_Item\_id" : {"type": "float" },  
> "Item\_Size" : {"type": "float" },  
> "Item\_amount" : {"type": "float" },  
> "Item\_type": {"type": "string" }  
> }  
> }  
> }  
> }  
> }
> 
> My question is how do I convert the 1-M relation in Hive and load it into  
> ES mapping?
> 
> Possible Solution  
> I will create another Hive table which will contain the join query of the  
> two source Hive tables  
> But what is structure of this Hive table, so that it maps to ES mapping?
> 
> Any help/suggestions?
> 
> Thanks  
> Ankur

--  
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/581bee54-ced2-4a8f-9043-c20037818c70%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/581bee54-ced2-4a8f-9043-c20037818c70%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:23am UTC](https://discuss.elastic.co/t/load-es-nested-mapping-from-hive/22873/3 "2017-07-06T00:23:26Z")

</div>


