I'm building an application that periodically queries system resource usage and records the data into ElasticSearch. I want to eventually show this information as a graph for a given time period. Note that generally users will want to view statistics for a set time period -
- The current day
- The current month
- The current year
Because of this, I've been trying to think of the most efficient way of storing the data into ElasticSearch for optimized search speeds. Obviously each entry has a separate DateTime field (down to the millisecond), but searches will be much faster if I can perform a query only for specific indices.
My plan is to set the index as the current day (i.e. 2014_04_09
). According to this, you can link multiple indices to a single alias. In this case, I would set an alias on the above for 2014_04
as well as 2014
. The idea behind this being I can perform a search on the 2014_04
index and this will automatically search all of the individual indexed days in April. Will this work and, if so, is it optimal?
Has anyone else had a similar experience with DateTime queries in ElasticSearch? Thanks!