# Questions about real time indexing & search

**URL:** <https://discuss.elastic.co/t/questions-about-real-time-indexing-search/4879>\
**Category:** Elasticsearch\
**Created:** [July 18, 2011, 2:28am UTC](https://discuss.elastic.co/t/questions-about-real-time-indexing-search/4879 "2011-07-18T02:28:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andy\_2](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Andy\_2](https://discuss.elastic.co/u/Andy_2)\
**Post date:** [July 18, 2011, 2:28am UTC](https://discuss.elastic.co/t/questions-about-real-time-indexing-search/4879/1 "2011-07-18T02:28:17Z")

</div>

Hi,

I'm new to elasticsearch, been using Solr but looking for something  
that support real time indexing

1. When I index a document in ES, do I need to commit that document  
for it to be visible in search? Or does the concept of "commit" even  
exist in ES?

2. A lot of my indexing is not adding new documents but updating  
existing documents. Does real time search work for updating existing  
documents? For example, if I updated document id:123 and then  
immediately did a search, would I be seeing the updated document, the  
original document, or even both documents?

Thanks

---

<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 18, 2011, 4:41am UTC](https://discuss.elastic.co/t/questions-about-real-time-indexing-search/4879/2 "2011-07-18T04:41:55Z")

</div>

On Mon, Jul 18, 2011 at 5:28 AM, Andy [selforganized@gmail.com](mailto:selforganized@gmail.com) wrote:

> Hi,
> 
> I'm new to elasticsearch, been using Solr but looking for something  
> that support real time indexing
> 
> 1. When I index a document in ES, do I need to commit that document  
> for it to be visible in search? Or does the concept of "commit" even  
> exist in ES?

There is no concept of commit in elasticsearch as you think it is. When you  
index/delete/update a document, the changes is persisted (and replicated).  
The document will become visible for search once the index is "refreshed"  
(note, does not map to a Lucene commit). By default, the index is refreshed  
every 1 second.

> 1. A lot of my indexing is not adding new documents but updating  
> existing documents. Does real time search work for updating existing  
> documents? For example, if I updated document id:123 and then  
> immediately did a search, would I be seeing the updated document, the  
> original document, or even both documents?

An updated document will be visible for search once the index has been  
refreshed. One thing to note is that in master (upcoming 0.17), a full  
realtime GET API (get by id) has been implemented.

> Thanks

---

<div class="post-metadata">

**Author:** ![Andy\_2](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Andy\_2](https://discuss.elastic.co/u/Andy_2)\
**Post date:** [July 18, 2011, 9:41am UTC](https://discuss.elastic.co/t/questions-about-real-time-indexing-search/4879/3 "2011-07-18T09:41:01Z")

</div>

> There is no concept of commit in elasticsearch as you think it is. When you  
> index/delete/update a document, the changes is persisted (and replicated).  
> The document will become visible for search once the index is "refreshed"  
> (note, does not map to a Lucene commit). By default, the index is refreshed  
> every 1 second.

Does refresh slow down concurrent searching? In Solr commits tend to  
be blocking and slow everything down.

> An updated document will be visible for search once the index has been  
> refreshed. One thing to note is that in master (upcoming 0.17), a full  
> realtime GET API (get by id) has been implemented.

A lot of my updates is to update the "popularity" field of a document,  
which I use to rank search results. Users votes are used to change the  
"popularity" of a document.

Since the "popularity" field changes frequently, in Solr I'd need to  
update the "popularity" field in MySQL, then use cron jobs to pull  
data out from MySQL to index to Solr periodically so as not to  
overwhelm Solr. It's kind of messy. Do I need to do something similar  
in ES? Or can I just update the "popularity" field in ES whenever a  
user casts a vote, and then set refresh\_interval to say 5s and let ES  
handles the periodic index updates (every 5s in this case)?

---

<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:** [July 18, 2011, 9:56am UTC](https://discuss.elastic.co/t/questions-about-real-time-indexing-search/4879/4 "2011-07-18T09:56:52Z")

</div>

Hi Andy

> Does refresh slow down concurrent searching? In Solr commits tend to  
> be blocking and slow everything down.

An Elasticsearch refresh is not the same as a Solr commit. It has some  
performance impact, but is much much lighter than a commit:

[http://engineering.socialcast.com/2011/05/realtime-search-solr-vs-elasticsearch/](http://engineering.socialcast.com/2011/05/realtime-search-solr-vs-elasticsearch/)

> Since the "popularity" field changes frequently, in Solr I'd need to  
> update the "popularity" field in MySQL, then use cron jobs to pull  
> data out from MySQL to index to Solr periodically so as not to  
> overwhelm Solr. It's kind of messy. Do I need to do something similar  
> in ES? Or can I just update the "popularity" field in ES whenever a  
> user casts a vote, and then set refresh\_interval to say 5s and let ES  
> handles the periodic index updates (every 5s in this case)?

You can just update the popularity field immediately. I wouldn't bother  
about changing the default refresh value until you have actual evidence  
that it is a problem.

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:00am UTC](https://discuss.elastic.co/t/questions-about-real-time-indexing-search/4879/5 "2017-07-06T04:00:18Z")

</div>


