# Elasticsearch data storage design

**URL:** <https://discuss.elastic.co/t/elasticsearch-data-storage-design/75266>\
**Category:** Elasticsearch\
**Created:** [February 16, 2017, 3:10am UTC](https://discuss.elastic.co/t/elasticsearch-data-storage-design/75266 "2017-02-16T03:10:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ans76](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ans76/32/31446_2.png) [@ans76](https://discuss.elastic.co/u/ans76)\
**Post date:** [February 16, 2017, 3:10am UTC](https://discuss.elastic.co/t/elasticsearch-data-storage-design/75266/1 "2017-02-16T03:10:06Z")

</div>

I have sensor data from devices. looks like:  
[status:1,temperature:20,date:20160101]  
[status:1,temperature:21,date:20160101]  
[status:1,temperature:21,date:20160101]  
[status:1,temperature:21,date:20160101]  
[status:2,temperature:5,date:20160101]  
[status:2,temperature:5,date:20160101]  
[status:2,temperature:5,date:20160101]  
[status:1,temperature:21,date:20160101]  
[status:1,temperature:21,date:20160101]

also there is timestamp field in each data, I prepare to storage them to elasticsearch, I have 2 requirements

1. query temperature list in different status and do the pagination  
[status:1,temperature[20,21,21,21]]  
[status:2,temperature[5,5,5]]  
[status:1,temperature[21,21]]

2. query average temperature per day avgTemperature(date)

is there any proper way to storage these data in es or need to change the data structure? pls provide some advices about this case.

---

<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:** [February 16, 2017, 6:36am UTC](https://discuss.elastic.co/t/elasticsearch-data-storage-design/75266/2 "2017-02-16T06:36:49Z")

</div>

Store them as you have them, just make sure you map the date and time fields correctly.

Then you can run various aggregations to get what you want. The best place to start with that is in Kibana.

---

<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:** [March 16, 2017, 6:37am UTC](https://discuss.elastic.co/t/elasticsearch-data-storage-design/75266/3 "2017-03-16T06:37:39Z")

</div>

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