Partial index updates (merging)

Is it possible to update a document by merging data when indexed?

Eg:

$ curl -XPUT 'http://localhost:9200/test/test/1' -d '
{
"foo" : "something"
}
'

$ curl -XPUT 'http://localhost:9200/test/test/1' -d '
{
"bar" : "something else"
}
'

This will result in just "bar" existing in the index.
Is there anyway to get it so that both "foo" and "bar" are now indexed
for this document?
Eg something like "opType": "update"?

The reasoning for this is that some of the data is only available when
the document is first created, after that point updates only contain
partial data.
This is because I'm indexing the contents of uploaded files, plus
storing some other metadata with them. The user can update the
metadata, which then needs to be re-indexed, but the original file
itself has since been sent out to S3 and is no longer stored locally
to be able to index.
Plus I wouldn't want to have to re-parse the files each time a change
is made as that seems like a waste.

Cheers.

--
Richard Livsey
Minutebase - Online Meeting Minutes
http://minutebase.com
http://livsey.org

Hiya

On Mon, 2010-08-30 at 17:11 +0100, Richard Livsey wrote:

Is it possible to update a document by merging data when indexed?

This isn't possible currently (not sure if it will be in the future).

The reasoning for this is that some of the data is only available when
the document is first created, after that point updates only contain
partial data.

The data that has already been indexed will be stored in the _source
field (unless you have disabled this), so what you could do is:

  • retrieve the current doc
  • add the updated values
  • reindex

hth,

clint