# Is ES es.index.store.type=memory equivalent to Lucene's RAMDirectory?

**URL:** <https://discuss.elastic.co/t/is-es-es-index-store-type-memory-equivalent-to-lucenes-ramdirectory/18023>\
**Category:** Elasticsearch\
**Created:** [June 10, 2014, 5:43pm UTC](https://discuss.elastic.co/t/is-es-es-index-store-type-memory-equivalent-to-lucenes-ramdirectory/18023 "2014-06-10T17:43:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Lu](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Mark\_Lu](https://discuss.elastic.co/u/Mark_Lu)\
**Post date:** [June 10, 2014, 5:43pm UTC](https://discuss.elastic.co/t/is-es-es-index-store-type-memory-equivalent-to-lucenes-ramdirectory/18023/1 "2014-06-10T17:43:12Z")

</div>

I would like to use MMapDirectory at the data indexing phase (in a batch).  
And then switch to index to in-memory and read only at time of serving real  
user queries to optimize the search latency. I used to achieve that when  
directly deal with Lucene by using RAMDirectory and read-only Searcher. Is  
-Des.index.store.type=memory the ElasticSearch equivalent of ensure  
RAMDirectory is used underline?

$ curl -XPUT [http://localhost:9200/myindex/](http://localhost:9200/myindex/) -d   
'  
index :  
store:  
type: memory  
'

Thanks,  
-Mark

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/53b8cd87-237c-4990-80b5-25572a14a286%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/53b8cd87-237c-4990-80b5-25572a14a286%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [June 10, 2014, 8:58pm UTC](https://discuss.elastic.co/t/is-es-es-index-store-type-memory-equivalent-to-lucenes-ramdirectory/18023/2 "2014-06-10T20:58:01Z")

</div>

Yes, it is equivalent.

MMapDirectory is already using as much memory as possible, for reading data.

RamDirectory store is when you want to push all data onto the heap,  
typically for volatile unit tests. For large index, it puts only burden on  
the heap and your performance will suffer from GC.

Jörg

On Tue, Jun 10, 2014 at 7:43 PM, Mark Lu [mark.zlu@gmail.com](mailto:mark.zlu@gmail.com) wrote:

> I would like to use MMapDirectory at the data indexing phase (in a batch).  
> And then switch to index to in-memory and read only at time of serving real  
> user queries to optimize the search latency. I used to achieve that when  
> directly deal with Lucene by using RAMDirectory and read-only Searcher. Is  
> -Des.index.store.type=memory the Elasticsearch equivalent of ensure  
> RAMDirectory is used underline?
> 
> $ curl -XPUT [http://localhost:9200/myindex/](http://localhost:9200/myindex/) -d   
> '  
> index :  
> store:  
> type: memory  
> '
> 
> Thanks,  
> -Mark
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/53b8cd87-237c-4990-80b5-25572a14a286%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/53b8cd87-237c-4990-80b5-25572a14a286%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/53b8cd87-237c-4990-80b5-25572a14a286%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/53b8cd87-237c-4990-80b5-25572a14a286%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGh8cSDzqVi5b7h7bMf621KdwC3ovWOsd-J2rHkT3DO3Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGh8cSDzqVi5b7h7bMf621KdwC3ovWOsd-J2rHkT3DO3Q%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Mark\_Lu](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Mark\_Lu](https://discuss.elastic.co/u/Mark_Lu)\
**Post date:** [June 10, 2014, 9:38pm UTC](https://discuss.elastic.co/t/is-es-es-index-store-type-memory-equivalent-to-lucenes-ramdirectory/18023/3 "2014-06-10T21:38:57Z")

</div>

Hi Jörg,

Does ES allow switching from file-based store to memory-based store without  
re-indexing? We used to use file-based store to run a batch index, then  
switch to read-only memory-based index when using Lucene directly. We've  
found that read-only RAMDirectory is 20% faster than MmapDirecotry. That's  
why we still want to use the similar type of configuration when switching  
from Lucene to ES.

Thanks,  
-Mark

On Tuesday, June 10, 2014 1:58:13 PM UTC-7, Jörg Prante wrote:

> Yes, it is equivalent.
> 
> MMapDirectory is already using as much memory as possible, for reading  
> data.
> 
> RamDirectory store is when you want to push all data onto the heap,  
> typically for volatile unit tests. For large index, it puts only burden on  
> the heap and your performance will suffer from GC.
> 
> Jörg
> 
> On Tue, Jun 10, 2014 at 7:43 PM, Mark Lu \<[mark...@gmail.com](mailto:mark...@gmail.com) \<javascript:\>\>  
> wrote:
> 
> > I would like to use MMapDirectory at the data indexing phase (in a  
> > batch). And then switch to index to in-memory and read only at time of  
> > serving real user queries to optimize the search latency. I used to achieve  
> > that when directly deal with Lucene by using RAMDirectory and read-only  
> > Searcher. Is -Des.index.store.type=memory the Elasticsearch equivalent of  
> > ensure RAMDirectory is used underline?
> > 
> > $ curl -XPUT [http://localhost:9200/myindex/](http://localhost:9200/myindex/) -d   
> > '  
> > index :  
> > store:  
> > type: memory  
> > '
> > 
> > Thanks,  
> > -Mark
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/53b8cd87-237c-4990-80b5-25572a14a286%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/53b8cd87-237c-4990-80b5-25572a14a286%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/53b8cd87-237c-4990-80b5-25572a14a286%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/53b8cd87-237c-4990-80b5-25572a14a286%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6eb553de-29b0-478f-83ae-72908275d0da%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6eb553de-29b0-478f-83ae-72908275d0da%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:23am UTC](https://discuss.elastic.co/t/is-es-es-index-store-type-memory-equivalent-to-lucenes-ramdirectory/18023/4 "2017-07-06T01:23:31Z")

</div>


