# Creating a mapping using hadoop configuration

**URL:** <https://discuss.elastic.co/t/creating-a-mapping-using-hadoop-configuration/26190>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [July 23, 2015, 7:23pm UTC](https://discuss.elastic.co/t/creating-a-mapping-using-hadoop-configuration/26190 "2015-07-23T19:23:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![caskEmployee](https://avatars.discourse-cdn.com/v4/letter/c/a8b319/32.png) [@caskEmployee](https://discuss.elastic.co/u/caskEmployee)\
**Post date:** [July 23, 2015, 7:23pm UTC](https://discuss.elastic.co/t/creating-a-mapping-using-hadoop-configuration/26190/1 "2015-07-23T19:23:45Z")

</div>

Hi,

I want to put a mapping in an index using elasticsearch-hadoop. Is there a way to create the mapping using the configuration? I've only found information on creating a mapping with the java api by using a node and client.

Thank you

---

<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:** [July 25, 2015, 11:41am UTC](https://discuss.elastic.co/t/creating-a-mapping-using-hadoop-configuration/26190/2 "2015-07-25T11:41:09Z")

</div>

The connector can create a mapping based on your _schema_ definition where that is supported (such as Pig, Hive, Spark).  
Outside of it, one has to create the mapping externally for several reasons:

- ease of use; all the corner cases such as merging the mapping, deleting the previous one, etc.. are better handled
- there are no guarantees in the connector - since it creates multiple tasks, neither Map/Reduce or Spark guarantee what tasks will be executed first and thus the tasks cannot properly coordinate in creating the mapping. One can try and add the mapping, while the other tasks might perceive it as an override.  
Additionally, there's no clear lifecycle between when a task hits the cluster vs config time.  
That is, we don't know for sure across the Map/Reduce, Hive, Pig, Cascading APIs whether the task has been validated and can actually start vs it's just the `OutputFormat` being instantiated in the chain.

In other words, it's a lot easier and _safer_ to create this externally even more so since it's a one-time thing as oppose to a job which is typically ran several times across different data sets.

---

<div class="post-metadata">

**Author:** ![caskEmployee](https://avatars.discourse-cdn.com/v4/letter/c/a8b319/32.png) [@caskEmployee](https://discuss.elastic.co/u/caskEmployee)\
**Post date:** [July 27, 2015, 7:58pm UTC](https://discuss.elastic.co/t/creating-a-mapping-using-hadoop-configuration/26190/3 "2015-07-27T19:58:56Z")

</div>

Thank you for your help!

---

<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:27pm UTC](https://discuss.elastic.co/t/creating-a-mapping-using-hadoop-configuration/26190/4 "2017-07-06T13:27:48Z")

</div>


