# Hive JSON integration and Deprecated \_ID capability

**URL:** <https://discuss.elastic.co/t/hive-json-integration-and-deprecated--id-capability/36416>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [December 4, 2015, 7:26pm UTC](https://discuss.elastic.co/t/hive-json-integration-and-deprecated--id-capability/36416 "2015-12-04T19:26:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![corgone](https://avatars.discourse-cdn.com/v4/letter/c/e47c2d/32.png) [@corgone](https://discuss.elastic.co/u/corgone)\
**Post date:** [December 4, 2015, 7:26pm UTC](https://discuss.elastic.co/t/hive-json-integration-and-deprecated--id-capability/36416/1 "2015-12-04T19:26:20Z")

</div>

How do you explicitly set the \_ID field when indexing via HIVE using the "es.input.json" option? in 1.7 we were able to use the PATH command to extract the ID from the corresponding JSON record. However, now I'm unsure how to use data from the JSON for the ID.... or if you can. I tried cheating and giving the mapping command a json path (a la the RESOURCE option for document type), but no joy.

Thanks,  
Chris

---

<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:** [December 8, 2015, 2:26pm UTC](https://discuss.elastic.co/t/hive-json-integration-and-deprecated--id-capability/36416/2 "2015-12-08T14:26:15Z")

</div>

See the [mapping options](https://www.elastic.co/guide/en/elasticsearch/hadoop/master/configuration.html#cfg-mapping). Just add this to your table configuration.

---

<div class="post-metadata">

**Author:** ![corgone](https://avatars.discourse-cdn.com/v4/letter/c/e47c2d/32.png) [@corgone](https://discuss.elastic.co/u/corgone)\
**Post date:** [December 8, 2015, 4:22pm UTC](https://discuss.elastic.co/t/hive-json-integration-and-deprecated--id-capability/36416/3 "2015-12-08T16:22:06Z")

</div>

I tried the [es.mapping.id](http://es.mapping.id) originally, but it expects a HIVE field to exist (hence the map). I was trying to maintain the JSON only setting while pulling an ID from the JSON string. In reality, it doesn't really matter. Having ES automatically create the \_ID field is okay, I'll just need to go into the JSON for any queries on the real ID. Still, it would be nice to be able to push this up using the hadoop libraries.

---

<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:** [December 8, 2015, 4:47pm UTC](https://discuss.elastic.co/t/hive-json-integration-and-deprecated--id-capability/36416/4 "2015-12-08T16:47:17Z")

</div>

The field extractor works on both JSON and non-JSON/Hive input. What was your setup and error?

---

<div class="post-metadata">

**Author:** ![corgone](https://avatars.discourse-cdn.com/v4/letter/c/e47c2d/32.png) [@corgone](https://discuss.elastic.co/u/corgone)\
**Post date:** [December 15, 2015, 8:55pm UTC](https://discuss.elastic.co/t/hive-json-integration-and-deprecated--id-capability/36416/5 "2015-12-15T20:55:36Z")

</div>

Looks like I made a mistake. I tried to set the [es.mappind.id](http://es.mappind.id) like the es.resource with {} around the field name. Changing it to just the field\_name (in the JSON) worked. I didn't find anything in the documentation that mentioned format.

e.g. for a JSON string that looked like:  
{"id":"xxxx", "item": {"key1": 1, "key2",2}}  
...  
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'  
TBLPROPERTIES('es.resource' = 'test/doc',  
'es.nodes'='my.node',  
'[es.mapping.id](http://es.mapping.id)' = 'id',  
'es.input.json' ='yes');

works fine.

Thanks,  
Chris

---

<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:** [December 18, 2015, 12:41pm UTC](https://discuss.elastic.co/t/hive-json-integration-and-deprecated--id-capability/36416/6 "2015-12-18T12:41:06Z")

</div>

Well, what made you think you should be using `{`. The connector can extract from both JSON or library types hence why only the actual field name is relevant.

---

<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:26pm UTC](https://discuss.elastic.co/t/hive-json-integration-and-deprecated--id-capability/36416/7 "2017-07-06T13:26:52Z")

</div>


