# Partial index updates (merging)

**URL:** <https://discuss.elastic.co/t/partial-index-updates-merging/3275>\
**Category:** Elasticsearch\
**Created:** [August 30, 2010, 4:11pm UTC](https://discuss.elastic.co/t/partial-index-updates-merging/3275 "2010-08-30T16:11:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard\_Livsey](https://avatars.discourse-cdn.com/v4/letter/r/dc4da7/32.png) [@Richard\_Livsey](https://discuss.elastic.co/u/Richard_Livsey)\
**Post date:** [August 30, 2010, 4:11pm UTC](https://discuss.elastic.co/t/partial-index-updates-merging/3275/1 "2010-08-30T16:11:44Z")

</div>

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

Eg:

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

$ curl -XPUT '[http://localhost:9200/test/test/1](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://minutebase.com)  
[http://livsey.org](http://livsey.org)

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [August 30, 2010, 4:21pm UTC](https://discuss.elastic.co/t/partial-index-updates-merging/3275/2 "2010-08-30T16:21:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:20am UTC](https://discuss.elastic.co/t/partial-index-updates-merging/3275/3 "2017-07-06T04:20:06Z")

</div>


