# How to update index using java api?

**URL:** https://discuss.elastic.co/t/how-to-update-index-using-java-api/5734
**Category:** Elasticsearch
**Created:** [November 1, 2011, 5:42am UTC](https://discuss.elastic.co/t/how-to-update-index-using-java-api/5734 "2011-11-01T05:42:12Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Sam\_4](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@Sam\_4](https://discuss.elastic.co/u/Sam_4)
#### Post date: [November 1, 2011, 5:42am UTC](https://discuss.elastic.co/t/how-to-update-index-using-java-api/5734/1 "2011-11-01T05:42:12Z")

</div>

Hi

I have created index using Rabbitmq.  
my database table contain the following Fields and values:

## RecordId Name Address Age

## 1 abc xxx1 11 2 def xxx2 12 3 ghi xxx3 13 4 jkl xxx4 14 5 mno xxx5 15

For indexing,i have follow the following steps:

1. create j'son document for each record for eg.  
{"recordid":"1","name":"abc","address":"xxx1","age":"11"} .
2. after preparing j son document publish into Rabbitmq queue.  
3 i have consumer class that listen those message and create  
index(using Bulk API) here is the code- [https://gist.github.com/1330001](https://gist.github.com/1330001)

it's create an index smoothly.i have question to you if i have made my  
updation,insertion or deletion in record's from database,then this  
case i should need to update index also.how i am able to update  
index(for both three case)?please help me how to make updated index.

Thanks

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [November 1, 2011, 7:20am UTC](https://discuss.elastic.co/t/how-to-update-index-using-java-api/5734/2 "2011-11-01T07:20:37Z")

</div>

Just push your new version of the document with the SAME ID. ES will update it.

David 😉

Le 1 nov. 2011 à 06:42, sam [mishra.sameek@gmail.com](mailto:mishra.sameek@gmail.com) a écrit :

> Hi
> 
> I have created index using Rabbitmq.  
> my database table contain the following Fields and values:
> 
> ## RecordId Name Address Age
> 
> ## 1 abc xxx1 11 2 def xxx2 12 3 ghi xxx3 13 4 jkl xxx4 14 5 mno xxx5 15
> 
> For indexing,i have follow the following steps:
> 
> 1. create j'son document for each record for eg.  
> {"recordid":"1","name":"abc","address":"xxx1","age":"11"} .
> 2. after preparing j son document publish into Rabbitmq queue.  
> 3 i have consumer class that listen those message and create  
> index(using Bulk API) here is the code- [This class will consume the queue messages and create index using bulk api · GitHub](https://gist.github.com/1330001)
> 
> it's create an index smoothly.i have question to you if i have made my  
> updation,insertion or deletion in record's from database,then this  
> case i should need to update index also.how i am able to update  
> index(for both three case)?please help me how to make updated index.
> 
> Thanks

---

<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:50am UTC](https://discuss.elastic.co/t/how-to-update-index-using-java-api/5734/3 "2017-07-06T03:50:19Z")

</div>


