Is it possible to delete a subset of fields from a given document?

lets say when i create a document, i have fields "a", "b" and "c"'. later i
want to retrieve the document(s) and completely clear off fields "b" and
"c". is it possible to do so?
or do i need to delete the document and create a new one with the same id
and just 1 field - "a"?

thanks

It is not possible to delete fields from a document in the index. You
would need to reindex the document, which is standard in Lucene. The
latest version of ES has the capability to update a field based on a
script (which reindexes behind the scenes), but not delete a field.

You can always return only the relevant fields from a search by
requesting only the fields you want.

--
Ivan

On Fri, Feb 17, 2012 at 1:04 PM, T Vinod Gupta tvinod@readypulse.com wrote:

lets say when i create a document, i have fields "a", "b" and "c"'. later i
want to retrieve the document(s) and completely clear off fields "b" and
"c". is it possible to do so?
or do i need to delete the document and create a new one with the same id
and just 1 field - "a"?

thanks

You can simply get the document, clear the fields, and index it again. You can use versioning to make sure no updates has happening while you were getting the document and updating the data.

0.19 has an update API that can be used remove the need of roundtrip of getting the doc and updating it.

On Friday, February 17, 2012 at 11:48 PM, Ivan Brusic wrote:

It is not possible to delete fields from a document in the index. You
would need to reindex the document, which is standard in Lucene. The
latest version of ES has the capability to update a field based on a
script (which reindexes behind the scenes), but not delete a field.

You can always return only the relevant fields from a search by
requesting only the fields you want.

--
Ivan

On Fri, Feb 17, 2012 at 1:04 PM, T Vinod Gupta <tvinod@readypulse.com (mailto:tvinod@readypulse.com)> wrote:

lets say when i create a document, i have fields "a", "b" and "c"'. later i
want to retrieve the document(s) and completely clear off fields "b" and
"c". is it possible to do so?
or do i need to delete the document and create a new one with the same id
and just 1 field - "a"?

thanks

thanks, that helps!

On Sun, Feb 19, 2012 at 4:50 AM, Shay Banon kimchy@gmail.com wrote:

You can simply get the document, clear the fields, and index it again.
You can use versioning to make sure no updates has happening while you were
getting the document and updating the data.

0.19 has an update API that can be used remove the need of roundtrip of
getting the doc and updating it.

On Friday, February 17, 2012 at 11:48 PM, Ivan Brusic wrote:

It is not possible to delete fields from a document in the index. You
would need to reindex the document, which is standard in Lucene. The
latest version of ES has the capability to update a field based on a
script (which reindexes behind the scenes), but not delete a field.

You can always return only the relevant fields from a search by
requesting only the fields you want.

--
Ivan

On Fri, Feb 17, 2012 at 1:04 PM, T Vinod Gupta tvinod@readypulse.com
wrote:

lets say when i create a document, i have fields "a", "b" and "c"'. later i
want to retrieve the document(s) and completely clear off fields "b" and
"c". is it possible to do so?
or do i need to delete the document and create a new one with the same id
and just 1 field - "a"?

thanks