# How to combine 2 indexes in 1 graph

**URL:** <https://discuss.elastic.co/t/how-to-combine-2-indexes-in-1-graph/349335>\
**Category:** Kibana\
**Created:** [December 14, 2023, 8:11am UTC](https://discuss.elastic.co/t/how-to-combine-2-indexes-in-1-graph/349335 "2023-12-14T08:11:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![remco\_zwaan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/remco_zwaan/32/129991_2.png) [@remco\_zwaan](https://discuss.elastic.co/u/remco_zwaan)\
**Post date:** [December 14, 2023, 8:11am UTC](https://discuss.elastic.co/t/how-to-combine-2-indexes-in-1-graph/349335/1 "2023-12-14T08:11:18Z")

</div>

0

We have 2 indexes called lodging\_index and price\_index. The relation is lodgings has many prices. In the price\_index there is a field called lodging\_id. We use this indexes in our api for frontend purpose. First call to our API/lodging to fetch the available lodgings and then second call (available ids/lodgings) to calculate the price (total).

This works fine and fast. Now we want to make stats in Kibana. Can we combine the indexes in 1 graph with the lodging\_id field?

Best remco

---

<div class="post-metadata">

**Author:** ![Samuele\_Lolli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samuele_lolli/32/107848_2.png) [@Samuele\_Lolli](https://discuss.elastic.co/u/Samuele_Lolli)\
**Post date:** [December 14, 2023, 9:30am UTC](https://discuss.elastic.co/t/how-to-combine-2-indexes-in-1-graph/349335/2 "2023-12-14T09:30:58Z")

</div>

Hi @remco_zwaan,  
i think you can solve you problem renaming the two indices with the same prefix, for example:  
index-lodging  
index-price

Then you create a data view with the prefix index  
After creating the data view you can creare all the lens in Kibana.

To rename the indices you can use the reindex operation

Hope i helped, tell me if you need more help

---

<div class="post-metadata">

**Author:** ![remco\_zwaan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/remco_zwaan/32/129991_2.png) [@remco\_zwaan](https://discuss.elastic.co/u/remco_zwaan)\
**Post date:** [December 14, 2023, 10:10am UTC](https://discuss.elastic.co/t/how-to-combine-2-indexes-in-1-graph/349335/3 "2023-12-14T10:10:16Z")

</div>

hi Samuele,

do you mean thsi

```auto
POST /_aliases
{
  "actions": [
    {
      "add": {
        "index": "new_index",
        "alias": "new_index_alias"
      }
    },
    {
      "add": {
        "index": "old_index",
        "alias": "new_index_alias"
      }
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![Samuele\_Lolli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samuele_lolli/32/107848_2.png) [@Samuele\_Lolli](https://discuss.elastic.co/u/Samuele_Lolli)\
**Post date:** [December 14, 2023, 10:22am UTC](https://discuss.elastic.co/t/how-to-combine-2-indexes-in-1-graph/349335/4 "2023-12-14T10:22:55Z")

</div>

I didn't mean that but i think this can be a valuable alternative. Try and let me know.

The one i was talking about is that one:

```auto
POST _reindex
{
  "source": {
    "index": "my-index-000001"
  },
  "dest": {
    "index": "my-new-index-000001"
  }
}

```

Let me know

---

<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:** [January 11, 2024, 10:23am UTC](https://discuss.elastic.co/t/how-to-combine-2-indexes-in-1-graph/349335/5 "2024-01-11T10:23:23Z")

</div>

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