# Hadoop-Elasticsearch upsert not working using 'scripted\_upsert'

**URL:** <https://discuss.elastic.co/t/hadoop-elasticsearch-upsert-not-working-using-scripted-upsert/44600>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [March 16, 2016, 6:44pm UTC](https://discuss.elastic.co/t/hadoop-elasticsearch-upsert-not-working-using-scripted-upsert/44600 "2016-03-16T18:44:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![andresg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andresg/32/8514_2.png) [@andresg](https://discuss.elastic.co/u/andresg)\
**Post date:** [March 16, 2016, 6:44pm UTC](https://discuss.elastic.co/t/hadoop-elasticsearch-upsert-not-working-using-scripted-upsert/44600/1 "2016-03-16T18:44:01Z")

</div>

Hi, I'm trying to upsert into an ES index using ES-hadoop connector and a groovy script.  
First run, it always upsert document instead of running script, regarthless "scripted\_upsert" is set to true or not. Second time, script runs ok.

Based on [ES docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html#_literal_scripted_upsert_literal):

> "If you would like your script to run regardless of whether the document exists or not — i.e. the script handles initializing the document instead of the upsert element — then set scripted\_upsert to true"

Does anyone know if this is a missing feature in the ES-hadoop connector?

Thanks

---

<div class="post-metadata">

**Author:** ![andresg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andresg/32/8514_2.png) [@andresg](https://discuss.elastic.co/u/andresg)\
**Post date:** [March 17, 2016, 1:54pm UTC](https://discuss.elastic.co/t/hadoop-elasticsearch-upsert-not-working-using-scripted-upsert/44600/2 "2016-03-17T13:54:26Z")

</div>

I think there is already an open issue for this: [https://github.com/elastic/elasticsearch-hadoop/issues/538](https://github.com/elastic/elasticsearch-hadoop/issues/538).

@costin do you know the ETA for this issue/feature?

---

<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:** [March 21, 2016, 10:29am UTC](https://discuss.elastic.co/t/hadoop-elasticsearch-upsert-not-working-using-scripted-upsert/44600/3 "2016-03-21T10:29:39Z")

</div>

Maybe 2.3 - any issue update/change will be reflected directly in the issue tracker.

---

<div class="post-metadata">

**Author:** ![andresg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andresg/32/8514_2.png) [@andresg](https://discuss.elastic.co/u/andresg)\
**Post date:** [March 21, 2016, 12:33pm UTC](https://discuss.elastic.co/t/hadoop-elasticsearch-upsert-not-working-using-scripted-upsert/44600/4 "2016-03-21T12:33:34Z")

</div>

@costin thanks.

---

<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:25pm UTC](https://discuss.elastic.co/t/hadoop-elasticsearch-upsert-not-working-using-scripted-upsert/44600/5 "2017-07-06T13:25:37Z")

</div>


