We are trying to model an IoT scenario and find that we may have two needs for most of our sensor indices and I wanted to throw it out there to see what others think and if they have already solved this issue.
Lets take a simple scenario, a WiFi temperature sensor. It reports data 10 times every second. For each sensor we have location data, the temperature reading, the name of the sensor and the datetime in UTC of the event.
Our indexing plan is...
Index 1 (Historical): Use _id = null, to get the historical index built.
Index 2 (Last): Use _id = "the name of the sensor itself", to keep track of the most recent value for the sensor.
I understand that for most situations we can easily query the Historical index for the last by version or DateTime with a size of 1 and we can get the most recent value.
There are two "issues" that I see:
- We want to use Kibana to show the LAST reading on a Map, and not see any historical data. Since, in Kibana, we cant express our custom "Last" filter we will not be able to achieve this.
Is there a way to achieve this, easily?
- We think, querying by _id on the the "Last" index will outperform querying the "Historical" with a Size of 1.
Anyone have any concrete evidence either way?
Questions, comments, concerns all welcome.