# Can we store two Elastic search indices in different data directory

**URL:** <https://discuss.elastic.co/t/can-we-store-two-elastic-search-indices-in-different-data-directory/256221>\
**Category:** Elasticsearch\
**Created:** [November 21, 2020, 12:44pm UTC](https://discuss.elastic.co/t/can-we-store-two-elastic-search-indices-in-different-data-directory/256221 "2020-11-21T12:44:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vivek\_Sagar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_sagar/32/76044_2.png) [@Vivek\_Sagar](https://discuss.elastic.co/u/Vivek_Sagar)\
**Post date:** [November 21, 2020, 12:44pm UTC](https://discuss.elastic.co/t/can-we-store-two-elastic-search-indices-in-different-data-directory/256221/1 "2020-11-21T12:44:14Z")

</div>

Can we have multiple indices in different data paths in elastic search? In my application, I want to separate index to keep sensitive data in dm-crypted volume and others on non encrypted volume. So separate indices for both in different data paths. I don't want performance hit due to dm-crypted volume to effect the non sensitive data?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [November 21, 2020, 1:31pm UTC](https://discuss.elastic.co/t/can-we-store-two-elastic-search-indices-in-different-data-directory/256221/2 "2020-11-21T13:31:45Z")

</div>

You can specify multiple paths for an Elasticsearch node, but as far as I know not control what is stored where so you may need to run multiple nodes, each with one type of storage and allocate indices to the appropriate nodes using shard allocation filtering.

---

<div class="post-metadata">

**Author:** ![Vivek\_Sagar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_sagar/32/76044_2.png) [@Vivek\_Sagar](https://discuss.elastic.co/u/Vivek_Sagar)\
**Post date:** [November 21, 2020, 1:48pm UTC](https://discuss.elastic.co/t/can-we-store-two-elastic-search-indices-in-different-data-directory/256221/3 "2020-11-21T13:48:25Z")

</div>

Thanks Christian, seems this should solve my problem. Will try.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 22, 2020, 11:58pm UTC](https://discuss.elastic.co/t/can-we-store-two-elastic-search-indices-in-different-data-directory/256221/4 "2020-11-22T23:58:39Z")

</div>

No, you cannot. You will need to run multiple nodes and use allocation filtering to do this.

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [November 23, 2020, 6:20am UTC](https://discuss.elastic.co/t/can-we-store-two-elastic-search-indices-in-different-data-directory/256221/5 "2020-11-23T06:20:06Z")

</div>

It is technically possible, but not documented.  
(See: [https://github.com/elastic/elasticsearch/issues/34446](https://github.com/elastic/elasticsearch/issues/34446))

You can configure `path.shared_data` and then configure specific indices to write to those custom data directories.

I general, however, I would recommend using custom node allocation instead, per the advice from @Christian_Dahlqvist and @warkolm.

---

<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:** [December 21, 2020, 6:20am UTC](https://discuss.elastic.co/t/can-we-store-two-elastic-search-indices-in-different-data-directory/256221/6 "2020-12-21T06:20:10Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
