# Deleting an entry in a map field has no effect

**URL:** https://discuss.elastic.co/t/deleting-an-entry-in-a-map-field-has-no-effect/78567
**Category:** Elasticsearch
**Created:** [March 14, 2017, 5:25pm UTC](https://discuss.elastic.co/t/deleting-an-entry-in-a-map-field-has-no-effect/78567 "2017-03-14T17:25:01Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![amidani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amidani/32/16336_2.png) [@amidani](https://discuss.elastic.co/u/amidani)
#### Post date: [March 14, 2017, 5:25pm UTC](https://discuss.elastic.co/t/deleting-an-entry-in-a-map-field-has-no-effect/78567/1 "2017-03-14T17:25:01Z")

</div>

Hi all,

I have a map field, and I'm trying to update it with a script (Painless). when I execute the script with a rest client it works, but not working with the java API (No change, but the result in the UpdateResponse is "UPDATED"). Anyone can help me resolving this:  
Elasticsearch 5.2.2 (Tried also on 5.1.1)  
--------- Rest Client (Chrome):  
POST localhost:9200/context/profile/720c7bc5-9c52-48bd-b281-760f595c6418/\_update  
BODY :{  
"scriptedUpsert": true,  
"script": {  
"lang": "painless",  
"inline": "ctx.\_source.put("scores", params.scoringValue)",  
"params": {  
"scoringValue": {  
"\_i833rilwd": 333  
}  
}  
}  
}

--------- Java Client:  
String script = "ctx.\_source.put("scores", params.scoringValue)";

//Map where I remove and put to update  
Map\<String, Integer\> scores = toRemove.getScores();

HashMap\<String, Object\> scriptParams = new HashMap\<\>();  
scriptParams.put("scoringValue", scores);

Script actualScript = new Script(ScriptType.INLINE, "painless", script, scriptParams);

UpdateResponse resp = client.prepareUpdate(index, itemType, itemId).setScript(actualScript)  
.execute()  
.get();

Thx in advance 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: [April 11, 2017, 5:25pm UTC](https://discuss.elastic.co/t/deleting-an-entry-in-a-map-field-has-no-effect/78567/2 "2017-04-11T17:25:24Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
