Re: Only update a single field in existing document

If you are going to do that, make sure you use the versioning support in order not to need to refresh. Get the doc, change it, and index it back with the version received from the get operation. A conflict will be raised if it has been updated in the meantime (or since the last refresh ran).
On Wednesday, March 9, 2011 at 8:38 PM, Rob Faraj wrote:

Thanks for the info Clint.

I don't have a ton of fields for each document, so your advise of
retrieving from ES and then reindexing is what I'm going to try first.

On Mar 2, 12:37 pm, Clinton Gormley clin...@iannounce.co.uk wrote:

Hi Rob

On Wed, 2011-03-02 at 09:32 -0800, Rob Faraj wrote:

I did some searching and found a couple threads that were similar, but
not exactly what I'm trying to do. I would like to update one field of
an existing document and reindex this new value of the field while
keeping all existing fields the same. Is this possible?

I'm afraid you have to reindex the whole document. That said, you
already have the full source for the document stored in ES, so you could
retrieve that, update the single field, then reindex it.

You might also want to look at parent/child relationships as that was
introduced specifically to get around having to reindex whole documents.

BTW: I posted this originally through Nabble and it sat in a Pending
status of >15hrs. Apologies if it's frowned upon to repost through
google groups.

It happens quite a lot - no worries :slight_smile:

clint

isn't a parent-child solution a better option?

I will be trying a use case which requires updating a single field - it is more
like a content management use case, not one for search engine but I love to see
how ES can handle this without using a separate system:

  • I would like to support full text search with use access permissions:
    not all documents are accessible by all users; some users can only access
    some documents.
    documents here are binary documents, Office or PDF for example.

So if I would use parent-child to support this, is it correct that:

  • create a parent document for the binary file
  • create the child document with user-permissions

yet to understand how exactly the parent-child works and how I can exec full
text search yet filtering based on the permissions in the child doc...
thanks,
canal


From: Shay Banon shay.banon@elasticsearch.com
To: users@elasticsearch.com
Sent: Thu, March 10, 2011 3:06:02 AM
Subject: Re: Only update a single field in existing document

If you are going to do that, make sure you use the versioning support in order
not to need to refresh. Get the doc, change it, and index it back with the
version received from the get operation. A conflict will be raised if it has
been updated in the meantime (or since the last refresh ran).

On Wednesday, March 9, 2011 at 8:38 PM, Rob Faraj wrote:
Thanks for the info Clint.

I don't have a ton of fields for each document, so your advise of
retrieving from ES and then reindexing is what I'm going to try first.

On Mar 2, 12:37 pm, Clinton Gormley clin...@iannounce.co.uk wrote:

Hi Rob

On Wed, 2011-03-02 at 09:32 -0800, Rob Faraj wrote:

I did some searching and found a couple threads that were similar, but

not exactly what I'm trying to do. I would like to update one field of
an existing document and reindex this new value of the field while
keeping all existing fields the same. Is this possible?

I'm afraid you have to reindex the whole document. That said, you
already have the full source for the document stored in ES, so you could
retrieve that, update the single field, then reindex it.

You might also want to look at parent/child relationships as that was
introduced specifically to get around having to reindex whole documents.

BTW: I posted this originally through Nabble and it sat in a Pending

status of >15hrs. Apologies if it's frowned upon to repost through
google groups.

It happens quite a lot - no worries :slight_smile:

clint