# Optimizing Elasticsearch for Timeseries data

**URL:** <https://discuss.elastic.co/t/optimizing-elasticsearch-for-timeseries-data/35942>\
**Category:** Elasticsearch\
**Created:** [November 30, 2015, 7:30pm UTC](https://discuss.elastic.co/t/optimizing-elasticsearch-for-timeseries-data/35942 "2015-11-30T19:30:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![spiral\_circ](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@spiral\_circ](https://discuss.elastic.co/u/spiral_circ)\
**Post date:** [November 30, 2015, 7:30pm UTC](https://discuss.elastic.co/t/optimizing-elasticsearch-for-timeseries-data/35942/1 "2015-11-30T19:30:25Z")

</div>

Hi,

We use elasticsearch to store financial stock data, and was wondering if there is any optimizations that can be done to improve the performance w.r.t timeseries data.

We have around 3 million documents on a 2 node cluster. We have a field in the documents called "Time" which holds date+time value till milliseconds in epoch format, ex: 1448841600000.

Our basic use-case is to fetch the given number of the documents going back in time. Ex: Fetch the latest 1000 documents. This takes 5 seconds currently.

I was wondering if there is any tweaking that can be done so that elasticsearch optimizes the way it stores data for such usecases ?

Our current mapping for "Time" field:

"Time": {  
"type": "long",  
"fielddata": { }  
},

Any help is appreciated.

Thanks,  
Srikanth

---

<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 30, 2015, 8:16pm UTC](https://discuss.elastic.co/t/optimizing-elasticsearch-for-timeseries-data/35942/2 "2015-11-30T20:16:58Z")

</div>

Check out [https://www.elastic.co/blog/elasticsearch-as-a-time-series-data-store](https://www.elastic.co/blog/elasticsearch-as-a-time-series-data-store) to start.

Are you using time series indices?

---

<div class="post-metadata">

**Author:** ![spiral\_circ](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@spiral\_circ](https://discuss.elastic.co/u/spiral_circ)\
**Post date:** [December 1, 2015, 9:38pm UTC](https://discuss.elastic.co/t/optimizing-elasticsearch-for-timeseries-data/35942/3 "2015-12-01T21:38:45Z")

</div>

Warkolm,

Thanks for the link, we kind of have similar mapping on our side.  
By time series indices if you mean having different indices based on date/time, we dont. We have one index which holds all the data. Our usecase is to fetch the latest N documents irrespective of the date they below to.

Thanks,  
Srikanth

---

<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:** [December 2, 2015, 6:38am UTC](https://discuss.elastic.co/t/optimizing-elasticsearch-for-timeseries-data/35942/4 "2015-12-02T06:38:39Z")

</div>

> [@spiral\_circ](#):
>
> By time series indices if you mean having different indices based on date/time, we dont. We have one index which holds all the data.

That's not ideal, I would change that.

---

<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 5, 2017, 11:34pm UTC](https://discuss.elastic.co/t/optimizing-elasticsearch-for-timeseries-data/35942/5 "2017-07-05T23:34:16Z")

</div>


