# Commit / Rollback support

**URL:** <https://discuss.elastic.co/t/commit-rollback-support/6804>\
**Category:** Elasticsearch\
**Created:** [February 24, 2012, 8:53pm UTC](https://discuss.elastic.co/t/commit-rollback-support/6804 "2012-02-24T20:53:06Z")\
**Posts on this page:** 3\
**Page:** 1

<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:** [February 24, 2012, 8:53pm UTC](https://discuss.elastic.co/t/commit-rollback-support/6804/1 "2012-02-24T20:53:06Z")

</div>

Heya,

Is it planned (or best, is it already exist) to have a support for  
transactions in ES ?

What I would like to achieve is to make my ES insert/update be part of a  
transaction.

Something like :

Try {

BeginTransaction()

Update my postgresql database

Send data to a JMS Queue

Push a document in ES

commitTransaction()

} catch (Exception) {

rollbackTransaction()

}

So, the commitTransaction() could call for example client.commit() and the  
rollbackTransaction could call something like client.rollback().

I don't know if it make sense.

The only way I found to support that on my side is to :

Get the latest version of my ES doc aka previousDoc

Push my new version of my es doc aka newDoc

In commitTransaction(), do nothing

In rollbackTransaction(), if previousDoc == null, client.delete(newDoc) else  
client.push(previousDoc)

Thanks for your feedback

David.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 26, 2012, 7:34pm UTC](https://discuss.elastic.co/t/commit-rollback-support/6804/2 "2012-02-26T19:34:30Z")

</div>

No, its not planned and I don't see ES supporting it in the future.

On Friday, February 24, 2012 at 10:53 PM, David Pilato wrote:

> Heya,
> 
> Is it planned (or best, is it already exist) to have a support for transactions in ES ?
> 
> What I would like to achieve is to make my ES insert/update be part of a transaction.
> 
> Something like :
> 
> Try {
> 
> BeginTransaction()
> 
> Update my postgresql database
> 
> Send data to a JMS Queue
> 
> Push a document in ES
> 
> commitTransaction()
> 
> } catch (Exception) {
> 
> rollbackTransaction()
> 
> }
> 
> So, the commitTransaction() could call for example client.commit() and the rollbackTransaction could call something like client.rollback().
> 
> I don’t know if it make sense.
> 
> The only way I found to support that on my side is to :
> 
> Get the latest version of my ES doc aka previousDoc
> 
> Push my new version of my es doc aka newDoc
> 
> In commitTransaction(), do nothing
> 
> In rollbackTransaction(), if previousDoc == null, client.delete(newDoc) else client.push(previousDoc)
> 
> Thanks for your feedback
> 
> David.

---

<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:38am UTC](https://discuss.elastic.co/t/commit-rollback-support/6804/3 "2017-07-06T03:38:11Z")

</div>


