# Update Index

**URL:** https://discuss.elastic.co/t/update-index/7450
**Category:** Elasticsearch
**Created:** [April 24, 2012, 11:34am UTC](https://discuss.elastic.co/t/update-index/7450 "2012-04-24T11:34:51Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![andavar](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@andavar](https://discuss.elastic.co/u/andavar)
#### Post date: [April 24, 2012, 11:34am UTC](https://discuss.elastic.co/t/update-index/7450/1 "2012-04-24T11:34:51Z")

</div>

Dear Elastic Search User,

```
I come to know there is an <b>UpdateRequest is availble in ES

```

version0.19.0, and i can use it like  
UpdateRequest updateRequest = new  
UpdateRequest(indexName,indexType,indexId);  
**client.update(updateRequest);**  
and I am not sure how to pass the updated source to do updateIndex.

so far I am doing update index by the below steps in **ES version  
0.18.7** by

1. GetRequest getRequest = new GetRequest(indexName,indexType,  
indexId);
2. GetResponse response = client.get(getRequest).get();  
//document already existing in the elastic search engine  
3 .Map\<String, Object\> responseSourceMap = response.getSource();
3. responseSourceMap .put(document to update);
4. create a indexrequest with source as responseSourceMap
5. client.index(indexRequest);

I have a question of what is the **advantage** of using  
**client.update(updateRequest)** instead of  
**client.index(indexRequest)** and **how to use properly  
client.update(updateRequest)**?  
Please share your thoughts.

---

<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, 3:31am UTC](https://discuss.elastic.co/t/update-index/7450/2 "2017-07-06T03:31:16Z")

</div>


