# Update api, empty object update results in array

**URL:** <https://discuss.elastic.co/t/update-api-empty-object-update-results-in-array/10153>\
**Category:** Elasticsearch\
**Created:** [December 21, 2012, 12:43pm UTC](https://discuss.elastic.co/t/update-api-empty-object-update-results-in-array/10153 "2012-12-21T12:43:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![michalj](https://avatars.discourse-cdn.com/v4/letter/m/b9e5f3/32.png) [@michalj](https://discuss.elastic.co/u/michalj)\
**Post date:** [December 21, 2012, 12:43pm UTC](https://discuss.elastic.co/t/update-api-empty-object-update-results-in-array/10153/1 "2012-12-21T12:43:32Z")

</div>

Hi.  
I'm facing some wierd problem with update api.  
I have a document with object type inside.  
for example:  
{  
"a":"a",  
"b": {"c", "c"}  
}  
Now I want to update b entry with "{}" (clear object)  
I would expect result:  
{  
"a":"a",  
"b": {}  
}  
But I get:  
{  
"a":"a",  
"b": []  
}

ES converts object {} into array []  
Why?  
Is it issues with ES configuration?

I was testing it on 0.19.8 and 0.20.1  
For updates I'm using java api

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 21, 2012, 1:06pm UTC](https://discuss.elastic.co/t/update-api-empty-object-update-results-in-array/10153/2 "2012-12-21T13:06:17Z")

</div>

In the case of

> {  
> "a":"a",  
> "b": {"c", "c"}  
> }

I don't think that b is an object.

In the following JSon b should be an object.  
{  
"a":"a",  
"b": {"c" :"value1", "d":"value2"}  
}

My two cents.  
David.

Le 21 décembre 2012 à 13:43, michalj [oniron9th@hotmail.com](mailto:oniron9th@hotmail.com) a écrit :

> Hi.  
> I'm facing some wierd problem with update api.  
> I have a document with object type inside.  
> for example:  
> {  
> "a":"a",  
> "b": {"c", "c"}  
> }  
> Now I want to update b entry with "{}" (clear object)  
> I would expect result:  
> {  
> "a":"a",  
> "b": {}  
> }  
> But I get:  
> {  
> "a":"a",  
> "b":   
> }
> 
> ES converts object {} into array   
> Why?  
> Is it issues with ES configuration?
> 
> I was testing it on 0.19.8 and 0.20.1  
> For updates I'm using java api
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/Update-api-empty-object-update-results-in-array-tp4027330.html](http://elasticsearch-users.115913.n3.nabble.com/Update-api-empty-object-update-results-in-array-tp4027330.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).
> 
> --

--  
David Pilato  
[http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<div class="post-metadata">

**Author:** ![michalj](https://avatars.discourse-cdn.com/v4/letter/m/b9e5f3/32.png) [@michalj](https://discuss.elastic.co/u/michalj)\
**Post date:** [December 21, 2012, 2:07pm UTC](https://discuss.elastic.co/t/update-api-empty-object-update-results-in-array/10153/3 "2012-12-21T14:07:59Z")

</div>

Yeah, right, my bad.  
It's shortcut but problem exists.  
BR

---

<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, 2:58am UTC](https://discuss.elastic.co/t/update-api-empty-object-update-results-in-array/10153/4 "2017-07-06T02:58:45Z")

</div>


