# Kibana dashboard using 2 indices

**URL:** https://discuss.elastic.co/t/kibana-dashboard-using-2-indices/363292
**Category:** Kibana
**Created:** [July 17, 2024, 3:19pm UTC](https://discuss.elastic.co/t/kibana-dashboard-using-2-indices/363292 "2024-07-17T15:19:46Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Riccardo\_Robb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/riccardo_robb/32/136108_2.png) [@Riccardo\_Robb](https://discuss.elastic.co/u/Riccardo_Robb)
#### Post date: [July 17, 2024, 3:19pm UTC](https://discuss.elastic.co/t/kibana-dashboard-using-2-indices/363292/1 "2024-07-17T15:19:46Z")

</div>

Hi guys, I want to know if it is possible to create a dashboard using 2 indices.

I have 2 indices, one "collections" with \_id and related\_files\_sha256 (keyword array); one "files" with \_id, sha256 (text) and date (date).

I want to create a line graph where taken a "collections" \_id it plots the line graph of all the "files" sha256 in the "related\_files\_sha256".

For each file in the collection I want a line graph of "date" over time.

Ty

---

<div class="post-metadata">

### Author: ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)
#### Post date: [July 18, 2024, 12:41pm UTC](https://discuss.elastic.co/t/kibana-dashboard-using-2-indices/363292/2 "2024-07-18T12:41:48Z")

</div>

Hi @Riccardo_Robb,

Welcome! Do you want to show a line series for each index? If so you should be able to achieve that using layers [as covered in the documentation](https://www.elastic.co/guide/en/kibana/current/lens.html#create-the-visualization-panel).

Hope that helps!

---

<div class="post-metadata">

### Author: ![Riccardo\_Robb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/riccardo_robb/32/136108_2.png) [@Riccardo\_Robb](https://discuss.elastic.co/u/Riccardo_Robb)
#### Post date: [July 18, 2024, 3:55pm UTC](https://discuss.elastic.co/t/kibana-dashboard-using-2-indices/363292/3 "2024-07-18T15:55:42Z")

</div>

Thanks for the reply.  
I want to have a single line graph based on query2, after performing query1 on a different index.

query1 would be "get related\_files\_sha256 for collection with \_id : x" on index "collections"  
query2 would be "get date array for sha256: ()" on index "files"

I work daily with visualizations and I also tried to use Vega, but it is the first case in which I have to create a line graph from 2 indices.

---

<div class="post-metadata">

### Author: ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)
#### Post date: [July 19, 2024, 8:45am UTC](https://discuss.elastic.co/t/kibana-dashboard-using-2-indices/363292/4 "2024-07-19T08:45:57Z")

</div>

Thanks for confirming. Are the queries the same but on different indices or different?

---

<div class="post-metadata">

### Author: ![Riccardo\_Robb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/riccardo_robb/32/136108_2.png) [@Riccardo\_Robb](https://discuss.elastic.co/u/Riccardo_Robb)
#### Post date: [July 19, 2024, 9:05am UTC](https://discuss.elastic.co/t/kibana-dashboard-using-2-indices/363292/5 "2024-07-19T09:05:53Z")

</div>

Different queries on different indices

---

<div class="post-metadata">

### Author: ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)
#### Post date: [July 22, 2024, 9:08am UTC](https://discuss.elastic.co/t/kibana-dashboard-using-2-indices/363292/6 "2024-07-22T09:08:54Z")

</div>

Thanks for confirming. If it was the same query you could create a data view on top of both indices and then use a Lens visualization to get a single line series. Or you could have two line series using layers.

I've not played with Timelion much, but if you are trying to use timeseries data from multiple indices this could be an option. Check out the documentation and initial example [here](https://www.elastic.co/guide/en/kibana/current/timelion.html).

Vega is an option too as you mention. You can specify both aggregations in the `data` attribute as an array of sources similar to [this example](https://github.com/elastic/elasticsearch-labs/blob/main/supporting-blog-content/building-advanced-visualizations-kibana-vega/airline-radar-chart.hjson#L72-L153) which I've condensed below:

```auto
data: [
    {
      name: source
      url: {
        %context%: true
        %timefield%: timestamp
        index: kibana_sample_data_flights
        body: {
          aggs: {
            destinations_and_carriers: {
              multi_terms: {
                terms: [
                  {
                    field: DestCityName
                  }
                  {
                    field: Carrier
                  }
                ]
              }
            }
          }
          size: 0
        }
      }
      format: {
        property: aggregations.destinations_and_carriers.buckets
      }
    }
    {
      name: table
      source: source
    }
  // Other sources omitted
  ]

```

This seems to be the recommended approach as discussed in this Vega issue where [someone is requesting a union transform](https://github.com/vega/vega-transforms/issues/10).

Let me know if that helps. Alternatively please share what you've tried with Vega or Timelion and we'll do our best to help.
