# Updating a nested object (or other solutions ?)

**URL:** <https://discuss.elastic.co/t/updating-a-nested-object-or-other-solutions/18600>\
**Category:** Elasticsearch\
**Created:** [July 11, 2014, 1:50pm UTC](https://discuss.elastic.co/t/updating-a-nested-object-or-other-solutions/18600 "2014-07-11T13:50:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aleks](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@Aleks](https://discuss.elastic.co/u/Aleks)\
**Post date:** [July 11, 2014, 1:50pm UTC](https://discuss.elastic.co/t/updating-a-nested-object-or-other-solutions/18600/1 "2014-07-11T13:50:15Z")

</div>

Hi there,

I'm working for an e-commerce website and I want to visualize stocks  
evolutions.  
This stock should be visualizable by (group) different hierarchy level.

Here is the mapping I did to represent the sale (=operation) hierarchy :

{  
"operations": {  
"mappings": {  
"operation": {  
"properties": {  
"Sites": {  
"properties": {  
"siteid": {  
"type": "long"  
},  
"siteuniversid": {  
"type": "long"  
},  
"univers": {  
"properties": {  
"id": {  
"type": "long"  
},  
"level": {  
"type": "long"  
},  
"name": {  
"type": "string"  
},  
"productFamilies": {  
"properties": {  
"id": {  
"type": "long"  
},  
"name": {  
"type": "string"  
},  
"references": {  
"type": "nested",  
"properties": {  
"name": {  
"type": "string"  
},  
"referenceid": {  
"type": "long"  
},  
_"stockevol"_: {  
"properties": {  
"date": {  
"type": "date",  
"format": "yyyy-MM-dd  
HH:mm:ss"  
},  
"initial": {  
"type": "integer"  
},  
"real": {  
"type": "integer"  
},  
"sold": {  
"type": "integer"  
}  
}  
}  
}  
}  
}  
},  
"univers": {  
"properties": {  
"id": {  
"type": "long"  
},  
"level": {  
"type": "long"  
},  
"name": {  
"type": "string"  
},  
"productFamilies": {  
"properties": {  
"id": {  
"type": "long"  
},  
"name": {  
"type": "string"  
},  
"references": {  
"type": "nested",  
"properties": {  
"name": {  
"type": "string"  
},  
"referenceid": {  
"type": "long"  
},  
_"stockevol"_: {  
"properties": {  
"date": {  
"type": "date",  
"format": "yyyy-MM-dd  
HH:mm:ss"  
},  
"initial": {  
"type": "integer"  
},  
"real": {  
"type": "integer"  
},  
"sold": {  
"type": "integer"  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}  
},  
"code": {  
"type": "string"  
},  
"query": {  
"properties": {  
"match\_all": {  
"type": "object"  
}  
}  
}  
}  
}  
}  
}  
}

As you can see, a _product_ (reference) is grouped into _product Family_  
witch is placed into a _univers_ (that can contains others universes) and  
this one is in a _site_ (country).  
When I get stocks informations, I do have only _referenceid_. I do not have  
information about the sale or other things. The sale informations  
(hierarchy) is already present with references (_referenceid_ and _name_)  
loaded but nothing in _stockevol_.  
So, I'd like to be able to add elements into my _stockevol_ but I don't  
know how to do it.

I thought that, by setting _references_ to nested type, I would be able to  
update it directly from the [http://myserver:9200/myindex/references](http://myserver:9200/myindex/references) but I  
failed.

Any help would be appreciated 🙂

Thank you.  
Aleks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/cffe9fd5-e091-437e-b0d8-fa850d87eb7f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/cffe9fd5-e091-437e-b0d8-fa850d87eb7f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:16am UTC](https://discuss.elastic.co/t/updating-a-nested-object-or-other-solutions/18600/2 "2017-07-06T01:16:32Z")

</div>

Closed on July 6, 2017, 1:16am UTC


