# How to plot a line graph in kibana using 2 indexes

**URL:** <https://discuss.elastic.co/t/how-to-plot-a-line-graph-in-kibana-using-2-indexes/51985>\
**Category:** Kibana\
**Created:** [June 6, 2016, 5:44pm UTC](https://discuss.elastic.co/t/how-to-plot-a-line-graph-in-kibana-using-2-indexes/51985 "2016-06-06T17:44:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhi.kedari](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@abhi.kedari](https://discuss.elastic.co/u/abhi.kedari)\
**Post date:** [June 6, 2016, 5:44pm UTC](https://discuss.elastic.co/t/how-to-plot-a-line-graph-in-kibana-using-2-indexes/51985/1 "2016-06-06T17:44:51Z")

</div>

Hi,

I want to get data from multiple indexes and they might not have same pattern. I tried but it seems that I can get data from single index only at a time because it looks like discover works with only one index. I don't want to run query on on all indexes (because i have 200 indexes and I want to use only 2 indexes for performing search)  
So I want something like -  
Get data from index1 || index2

Thanks,  
Abhishek

---

<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:** [June 6, 2016, 10:17pm UTC](https://discuss.elastic.co/t/how-to-plot-a-line-graph-in-kibana-using-2-indexes/51985/2 "2016-06-06T22:17:08Z")

</div>

> [@abhi.kedari](#):
>
> discover works with only one index

It works with patterns. What are your index names?

---

<div class="post-metadata">

**Author:** ![abhi.kedari](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@abhi.kedari](https://discuss.elastic.co/u/abhi.kedari)\
**Post date:** [June 6, 2016, 10:28pm UTC](https://discuss.elastic.co/t/how-to-plot-a-line-graph-in-kibana-using-2-indexes/51985/3 "2016-06-06T22:28:44Z")

</div>

Lets say for example I have index names -

TEST-2015-12-30  
TEST-2015-12-31  
TEST-2016-01-01  
TEST-2016-01-02

and i want data from TEST-2015-12-31 and TEST-2016-01-01 only..

---

<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:** [June 6, 2016, 10:29pm UTC](https://discuss.elastic.co/t/how-to-plot-a-line-graph-in-kibana-using-2-indexes/51985/4 "2016-06-06T22:29:28Z")

</div>

Well, you could use a pattern like `TEST-*` and then limit the timeframe to those two days.  
But I don't think it's exactly what you want.

---

<div class="post-metadata">

**Author:** ![abhi.kedari](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@abhi.kedari](https://discuss.elastic.co/u/abhi.kedari)\
**Post date:** [June 6, 2016, 10:34pm UTC](https://discuss.elastic.co/t/how-to-plot-a-line-graph-in-kibana-using-2-indexes/51985/5 "2016-06-06T22:34:22Z")

</div>

My concern is it matches all indexes (TEST-\*) and i believe it will end up searching all documents in all index where as i really want is last 2 daysof index to show on graphs. Like anytime i open a graph I want to see today's and yesterday's data only because i have around 50 billion records and around more than 60 indexes with any one pattern (like 60 days of data)

---

<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:** [June 6, 2016, 10:35pm UTC](https://discuss.elastic.co/t/how-to-plot-a-line-graph-in-kibana-using-2-indexes/51985/6 "2016-06-06T22:35:41Z")

</div>

KB doesn't do that, if you want a specific timeframe it will only query the indices that have data that match it.

---

<div class="post-metadata">

**Author:** ![abhi.kedari](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@abhi.kedari](https://discuss.elastic.co/u/abhi.kedari)\
**Post date:** [June 6, 2016, 10:38pm UTC](https://discuss.elastic.co/t/how-to-plot-a-line-graph-in-kibana-using-2-indexes/51985/7 "2016-06-06T22:38:52Z")

</div>

and how it knows that? I mean i can have index with any name (including date in index doesnt mean anything thats what i think) So finally it needs to go to the document in each index and check the timestamp field in document to decide right ?

---

<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:** [June 6, 2016, 10:42pm UTC](https://discuss.elastic.co/t/how-to-plot-a-line-graph-in-kibana-using-2-indexes/51985/8 "2016-06-06T22:42:41Z")

</div>

It uses [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-stats.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-stats.html)

I should note, this only applies to newer versions of KB, I think it was used from 4.3 or so onwards.

---

<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:51pm UTC](https://discuss.elastic.co/t/how-to-plot-a-line-graph-in-kibana-using-2-indexes/51985/9 "2017-07-06T13:51:26Z")

</div>

Closed on July 6, 2017, 1:51pm UTC


