Addition/Deletion Operation on Nested Documents


(Deepak Chezhian) #1

Hi,

I have an use case in which i am often adding or removing the nested
documents but there is no change in the parent document. Is it possible to
do Add or Remove nested documents without re-indexing the whole parent
document?

Regards,
Deepak

--


(Lukáš Vlček) #2

Simple answer: no

I think it would be theoretically possible to delete the nested document at
the Lucene level but elasticsearch does not have API for that.

Lukas
Dne 19.9.2012 7:10 "Deepak Chezhian" cdeepakcse@gmail.com napsal(a):

Hi,

I have an use case in which i am often adding or removing the nested
documents but there is no change in the parent document. Is it possible to
do Add or Remove nested documents without re-indexing the whole parent
document?

Regards,
Deepak

--

--


(Lukáš Vlček) #3

BTW: if you did not disable _source you might want to look at Update API,
it does reindexing for you but gives you an elegant shortcut for that.
Dne 19.9.2012 9:31 "Lukáš Vlček" lukas.vlcek@gmail.com napsal(a):

Simple answer: no

I think it would be theoretically possible to delete the nested document
at the Lucene level but elasticsearch does not have API for that.

Lukas
Dne 19.9.2012 7:10 "Deepak Chezhian" cdeepakcse@gmail.com napsal(a):

Hi,

I have an use case in which i am often adding or removing the nested
documents but there is no change in the parent document. Is it possible to
do Add or Remove nested documents without re-indexing the whole parent
document?

Regards,
Deepak

--

--


(Deepak Chezhian) #4

Hi Lukas,

I tried update api with scripting, am able to add nested document but am
not able to remove the existing documents.

I have used the examples in the following url for creating index and
documents.

For Addition, i have tried the following query. It worked.

{
"script" : "ctx._source.works += work",
"params" : {
"work" : {
"title" : "dad",
"current" : true
}
}
}

For removal, i have used the following query but it doesnt work.

{
"script" : "ctx._source.works -= work",
"params" : {
"work" : {
"title" : "dad",
"current" : true
}
}
}

Is there any other way of adding or removing documents from the nested
documents using update api.

Regards,
Deepak

On Wednesday, 19 September 2012 11:35:36 UTC+4, Lukáš Vlček wrote:

BTW: if you did not disable _source you might want to look at Update API,
it does reindexing for you but gives you an elegant shortcut for that.
Dne 19.9.2012 9:31 "Lukáš Vlček" <lukas...@gmail.com <javascript:>>
napsal(a):

Simple answer: no

I think it would be theoretically possible to delete the nested document
at the Lucene level but elasticsearch does not have API for that.

Lukas
Dne 19.9.2012 7:10 "Deepak Chezhian" <cdeep...@gmail.com <javascript:>>
napsal(a):

Hi,

I have an use case in which i am often adding or removing the nested
documents but there is no change in the parent document. Is it possible to
do Add or Remove nested documents without re-indexing the whole parent
document?

Regards,
Deepak

--

--


(system) #5