# Is it possible to append to a existing nested type

**URL:** https://discuss.elastic.co/t/is-it-possible-to-append-to-a-existing-nested-type/6901
**Category:** Elasticsearch
**Created:** [March 6, 2012, 5:40am UTC](https://discuss.elastic.co/t/is-it-possible-to-append-to-a-existing-nested-type/6901 "2012-03-06T05:40:47Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)
#### Post date: [March 6, 2012, 5:40am UTC](https://discuss.elastic.co/t/is-it-possible-to-append-to-a-existing-nested-type/6901/1 "2012-03-06T05:40:47Z")

</div>

Hi ,

I have following use case.

- I need to index a very big document , this document is so large that i  
cant load the whole thing to main memory
- The document is actually split into various smaller units called  
attachment , so i was thinking of indexing one attachment at a time.

Is it possible to append to the already existing nested type without  
reloading the entire array ?

That is if there is a document A with X,Y,Z attachment , i will first  
create a document in elasticSearch with details in A ,  
then create a nested type and add X,Y,Z to it.  
It is impossible to load A,X,Y,Z at the same time to ES as my machine don't  
have so much memory.

So is there a way to just add to a nested type without GET and POST of the  
whole array ?

Thanks  
Vineeth

---

<div class="post-metadata">

### Author: ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)
#### Post date: [March 6, 2012, 7:55am UTC](https://discuss.elastic.co/t/is-it-possible-to-append-to-a-existing-nested-type/6901/2 "2012-03-06T07:55:16Z")

</div>

Hi ,

I was told about the inbuild update feature later on -

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

A doubt regarding updating a list -

curl -XPOST 'localhost:9200/test/type1/1/\_update' -d '{  
"script" : "ctx.\_source.tags += tag",  
"params" : {  
"tag" : "blue"  
}  
}'

The above should add a new element to the list.  
Say i need to edit second element of the list , how am i gonna do it ?

Thanks  
Vineeth

On Tue, Mar 6, 2012 at 11:10 AM, Vineeth Mohan [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)wrote:

> Hi ,
> 
> I have following use case.
> 
> - I need to index a very big document , this document is so large that  
> i cant load the whole thing to main memory
> - The document is actually split into various smaller units called  
> attachment , so i was thinking of indexing one attachment at a time.
> 
> Is it possible to append to the already existing nested type without  
> reloading the entire array ?
> 
> That is if there is a document A with X,Y,Z attachment , i will first  
> create a document in elasticSearch with details in A ,  
> then create a nested type and add X,Y,Z to it.  
> It is impossible to load A,X,Y,Z at the same time to ES as my machine  
> don't have so much memory.
> 
> So is there a way to just add to a nested type without GET and POST of the  
> whole array ?
> 
> Thanks  
> Vineeth

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [March 6, 2012, 7:31pm UTC](https://discuss.elastic.co/t/is-it-possible-to-append-to-a-existing-nested-type/6901/3 "2012-03-06T19:31:12Z")

</div>

Update still loads the whole document and reindexes. You will need to break the large document into smaller ones.

On Tuesday, March 6, 2012 at 9:55 AM, Vineeth Mohan wrote:

> Hi ,
> 
> I was told about the inbuild update feature later on - [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/update.html)
> 
> A doubt regarding updating a list -  
> curl -XPOST 'localhost:9200/test/type1/1/\_update' -d '{  
> "script" : "ctx.\_source.tags += tag",  
> "params" : {  
> "tag" : "blue"  
> }  
> }'
> 
> The above should add a new element to the list.  
> Say i need to edit second element of the list , how am i gonna do it ?
> 
> Thanks  
> Vineeth
> 
> On Tue, Mar 6, 2012 at 11:10 AM, Vineeth Mohan \<[vineethmohan@algotree.com](mailto:vineethmohan@algotree.com) ([mailto:vineethmohan@algotree.com](mailto:vineethmohan@algotree.com))\> wrote:
> 
> > Hi ,
> > 
> > I have following use case.
> > 
> > I need to index a very big document , this document is so large that i cant load the whole thing to main memory  
> > The document is actually split into various smaller units called attachment , so i was thinking of indexing one attachment at a time.
> > 
> > Is it possible to append to the already existing nested type without reloading the entire array ?
> > 
> > That is if there is a document A with X,Y,Z attachment , i will first create a document in elasticSearch with details in A ,  
> > then create a nested type and add X,Y,Z to it.  
> > It is impossible to load A,X,Y,Z at the same time to ES as my machine don't have so much memory.
> > 
> > So is there a way to just add to a nested type without GET and POST of the whole array ?
> > 
> > Thanks  
> > Vineeth

---

<div class="post-metadata">

### Author: ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)
#### Post date: [March 6, 2012, 7:35pm UTC](https://discuss.elastic.co/t/is-it-possible-to-append-to-a-existing-nested-type/6901/4 "2012-03-06T19:35:12Z")

</div>

What if parameter tag is nested.  
Nested types are stored internally as separate documents right.  
Hopefully that might prevent from re indexing the whole document !!!

Thanks  
Vineeth

On Wed, Mar 7, 2012 at 1:01 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> Update still loads the whole document and reindexes. You will need to  
> break the large document into smaller ones.
> 
> On Tuesday, March 6, 2012 at 9:55 AM, Vineeth Mohan wrote:
> 
> Hi ,
> 
> I was told about the inbuild update feature later on -  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/update.html)
> 
> A doubt regarding updating a list -
> 
> curl -XPOST 'localhost:9200/test/type1/1/\_update' -d '{
> 
> ```
> "script" : "ctx._source.tags += tag",
> "params" : {
> "tag" : "blue"
> }
> 
> ```
> 
> }'
> 
> The above should add a new element to the list.  
> Say i need to edit second element of the list , how am i gonna do it ?
> 
> Thanks  
> Vineeth
> 
> On Tue, Mar 6, 2012 at 11:10 AM, Vineeth Mohan [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)wrote:
> 
> Hi ,
> 
> I have following use case.
> 
> - I need to index a very big document , this document is so large that  
> i cant load the whole thing to main memory
> - The document is actually split into various smaller units called  
> attachment , so i was thinking of indexing one attachment at a time.
> 
> Is it possible to append to the already existing nested type without  
> reloading the entire array ?
> 
> That is if there is a document A with X,Y,Z attachment , i will first  
> create a document in elasticSearch with details in A ,  
> then create a nested type and add X,Y,Z to it.  
> It is impossible to load A,X,Y,Z at the same time to ES as my machine  
> don't have so much memory.
> 
> So is there a way to just add to a nested type without GET and POST of the  
> whole array ?
> 
> Thanks  
> Vineeth

---

<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, 3:37am UTC](https://discuss.elastic.co/t/is-it-possible-to-append-to-a-existing-nested-type/6901/5 "2017-07-06T03:37:07Z")

</div>


