# How to use the same Elastic Search Index in Multiple Environments in same server

**URL:** <https://discuss.elastic.co/t/how-to-use-the-same-elastic-search-index-in-multiple-environments-in-same-server/304220>\
**Category:** Elasticsearch\
**Created:** [May 9, 2022, 8:29am UTC](https://discuss.elastic.co/t/how-to-use-the-same-elastic-search-index-in-multiple-environments-in-same-server/304220 "2022-05-09T08:29:41Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leo\_Lawrence](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leo_lawrence/32/78386_2.png) [@Leo\_Lawrence](https://discuss.elastic.co/u/Leo_Lawrence)\
**Post date:** [May 9, 2022, 8:29am UTC](https://discuss.elastic.co/t/how-to-use-the-same-elastic-search-index-in-multiple-environments-in-same-server/304220/1 "2022-05-09T08:29:41Z")

</div>

Im having 2 environments(Dev and Test) in a same server. I want to use the same set of Indices in both dev and Test. How to achieve this in Elasticsearch

---

<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:** [May 9, 2022, 9:22am UTC](https://discuss.elastic.co/t/how-to-use-the-same-elastic-search-index-in-multiple-environments-in-same-server/304220/2 "2022-05-09T09:22:00Z")

</div>

Snapshot and restore might be the right tool for this?

---

<div class="post-metadata">

**Author:** ![Leo\_Lawrence](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leo_lawrence/32/78386_2.png) [@Leo\_Lawrence](https://discuss.elastic.co/u/Leo_Lawrence)\
**Post date:** [May 9, 2022, 10:02am UTC](https://discuss.elastic.co/t/how-to-use-the-same-elastic-search-index-in-multiple-environments-in-same-server/304220/3 "2022-05-09T10:02:41Z")

</div>

Since Index Names are unique, how can i have 2 index with same name for 2 different environments

---

<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:** [May 9, 2022, 10:43am UTC](https://discuss.elastic.co/t/how-to-use-the-same-elastic-search-index-in-multiple-environments-in-same-server/304220/4 "2022-05-09T10:43:57Z")

</div>

In a single cluster you can not. You either need to name the indices differently or have two Elasticsearch clusters.

---

<div class="post-metadata">

**Author:** ![Leo\_Lawrence](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leo_lawrence/32/78386_2.png) [@Leo\_Lawrence](https://discuss.elastic.co/u/Leo_Lawrence)\
**Post date:** [May 9, 2022, 11:07am UTC](https://discuss.elastic.co/t/how-to-use-the-same-elastic-search-index-in-multiple-environments-in-same-server/304220/5 "2022-05-09T11:07:34Z")

</div>

i will be having different set of data in the same index for different environments(dev & test). if im creating 2 different clusters, if im adding/deleting some data in the index of Cluster1, then the same is getting reflected in cluster2 as well. How to handle this?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [May 9, 2022, 1:47pm UTC](https://discuss.elastic.co/t/how-to-use-the-same-elastic-search-index-in-multiple-environments-in-same-server/304220/6 "2022-05-09T13:47:38Z")

</div>

If they are 2 completely separate clusters use Cross Cluster Search or Replication depending on your desired outcome.

I'd probably start with Cross Cluster Search

> **[Search across clusters | Elasticsearch Guide \[8.2\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-cross-cluster-search.html)**

> **[Cross-cluster replication | Elasticsearch Guide \[8.2\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-ccr.html)**

---

<div class="post-metadata">

**Author:** ![Leo\_Lawrence](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leo_lawrence/32/78386_2.png) [@Leo\_Lawrence](https://discuss.elastic.co/u/Leo_Lawrence)\
**Post date:** [May 10, 2022, 6:19am UTC](https://discuss.elastic.co/t/how-to-use-the-same-elastic-search-index-in-multiple-environments-in-same-server/304220/7 "2022-05-10T06:19:32Z")

</div>

How can i maintain different set of data in 2 different clusters so that i can use 1 cluster for dev environment and another cluster for test environment

---

<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:** [May 10, 2022, 6:22am UTC](https://discuss.elastic.co/t/how-to-use-the-same-elastic-search-index-in-multiple-environments-in-same-server/304220/8 "2022-05-10T06:22:34Z")

</div>

> [@Leo\_Lawrence](#):
>
> i will be having different set of data in the same index for different environments(dev & test). if im creating 2 different clusters, if im adding/deleting some data in the index of Cluster1, then the same is getting reflected in cluster2 as well. How to handle this?

You want to maintain 2 different sets of data but have changes relect in the other index? Are the two indices independent or not? I do not understand what you are trying to achieve here.

---

<div class="post-metadata">

**Author:** ![Leo\_Lawrence](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leo_lawrence/32/78386_2.png) [@Leo\_Lawrence](https://discuss.elastic.co/u/Leo_Lawrence)\
**Post date:** [May 10, 2022, 6:31am UTC](https://discuss.elastic.co/t/how-to-use-the-same-elastic-search-index-in-multiple-environments-in-same-server/304220/9 "2022-05-10T06:31:05Z")

</div>

im migrating my sql server database to Elasticsearch. In SQL, im having 2 database with same set of tables. Both database is having different set of data, one database pointing to dev environment and other pointing to Testing Environment.

I want to achieve this in Elasticsearch as well.

For Dev Environment, I created 3 Index in Elasticsearch similar to 3 tables in SQL.  
I want to have the same 3 index for test environment as well which will have different set of data.

Please let me know how i can achieve this scenario in Elasticsearch

---

<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:** [May 10, 2022, 7:18am UTC](https://discuss.elastic.co/t/how-to-use-the-same-elastic-search-index-in-multiple-environments-in-same-server/304220/10 "2022-05-10T07:18:21Z")

</div>

You need to have 2 separate nodes/clusters if you want the index name to be the same but with different data.

---

<div class="post-metadata">

**Author:** ![Leo\_Lawrence](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leo_lawrence/32/78386_2.png) [@Leo\_Lawrence](https://discuss.elastic.co/u/Leo_Lawrence)\
**Post date:** [May 10, 2022, 7:40am UTC](https://discuss.elastic.co/t/how-to-use-the-same-elastic-search-index-in-multiple-environments-in-same-server/304220/11 "2022-05-10T07:40:26Z")

</div>

i tried this. Im having a default cluster with 2 index and each having a set of records.  
Now i have created a new cluster named "Cluster1". This new cluster "Cluster1" is also having the same set of records available in default cluster.

If im a deleting a document from an index in default cluster then the same gets deleted in Cluster1 as well.

Am i missing anything here?

---

<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:** [May 10, 2022, 7:46am UTC](https://discuss.elastic.co/t/how-to-use-the-same-elastic-search-index-in-multiple-environments-in-same-server/304220/12 "2022-05-10T07:46:20Z")

</div>

Please share your configuration for the two clusters.

---

<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:** [June 7, 2022, 7:46am UTC](https://discuss.elastic.co/t/how-to-use-the-same-elastic-search-index-in-multiple-environments-in-same-server/304220/13 "2022-06-07T07:46:51Z")

</div>

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