# Indexing, transaction and isolation

**URL:** <https://discuss.elastic.co/t/indexing-transaction-and-isolation/4872>\
**Category:** Elasticsearch\
**Created:** [July 15, 2011, 5:57pm UTC](https://discuss.elastic.co/t/indexing-transaction-and-isolation/4872 "2011-07-15T17:57:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spring\_Ninja](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spring_ninja/32/2719_2.png) [@Spring\_Ninja](https://discuss.elastic.co/u/Spring_Ninja)\
**Post date:** [July 15, 2011, 5:57pm UTC](https://discuss.elastic.co/t/indexing-transaction-and-isolation/4872/1 "2011-07-15T17:57:28Z")

</div>

Hi there all!

I have an embedded ES running in a Spring backed application.

I have synchronized ES with the TransactionManager. Updates and  
deletes are logged into a TransactionSynchronization context. If the  
transaction commits successfully, the operations are replayed to ES.  
Works great but...

We are trying to use ES to satisfy all of our search needs, not just  
for client facing queries. Thus, our service layer operations would  
like to rely as much as possible on ES to do searching but some  
usecases can't. As soon as you need to search for something that was  
created or updated within the current transaction, ES will only see  
these changes after the transaction actually commits.

Question is: I know some work was done around this in Compass. Lucene  
also has some basic transactional support. How would you approach  
implementing 2PC in ES?

Another bit of info, we are using MySQL, Hibernate and Spring.

Thanks for your comments.

Remy

---

<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:** [July 15, 2011, 6:18pm UTC](https://discuss.elastic.co/t/indexing-transaction-and-isolation/4872/2 "2011-07-15T18:18:10Z")

</div>

There isn't support for that, and its not slated to be done, especially since there isn't really a good way to do that in an acceptable perfomant manner.

On Friday, July 15, 2011 at 8:57 PM, Spring Ninja wrote:

> Hi there all!
> 
> I have an embedded ES running in a Spring backed application.
> 
> I have synchronized ES with the TransactionManager. Updates and  
> deletes are logged into a TransactionSynchronization context. If the  
> transaction commits successfully, the operations are replayed to ES.  
> Works great but...
> 
> We are trying to use ES to satisfy all of our search needs, not just  
> for client facing queries. Thus, our service layer operations would  
> like to rely as much as possible on ES to do searching but some  
> usecases can't. As soon as you need to search for something that was  
> created or updated within the current transaction, ES will only see  
> these changes after the transaction actually commits.
> 
> Question is: I know some work was done around this in Compass. Lucene  
> also has some basic transactional support. How would you approach  
> implementing 2PC in ES?
> 
> Another bit of info, we are using MySQL, Hibernate and Spring.
> 
> Thanks for your comments.
> 
> Remy

---

<div class="post-metadata">

**Author:** ![Spring\_Ninja](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spring_ninja/32/2719_2.png) [@Spring\_Ninja](https://discuss.elastic.co/u/Spring_Ninja)\
**Post date:** [July 15, 2011, 6:36pm UTC](https://discuss.elastic.co/t/indexing-transaction-and-isolation/4872/3 "2011-07-15T18:36:05Z")

</div>

Makes sense in a distributed engine like ES.

We'll fallback to the database for queries that need to see new data  
from the current transaction.

Thanks!

Remy

---

<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:00am UTC](https://discuss.elastic.co/t/indexing-transaction-and-isolation/4872/4 "2017-07-06T04:00:29Z")

</div>


