Is it possible to append to a existing nested type


(vineeth mohan) #1

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


(vineeth mohan) #2

Hi ,

I was told about the inbuild update feature later on -
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.comwrote:

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


(Shay Banon) #3

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 - 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


(vineeth mohan) #4

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 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 -
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.comwrote:

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


(system) #5