Hello Guys,
I need to find a way about how to store probes 's value over the time, but I don't know from where I can start, basically I've already read the guideline of elasticsearch and I cannot find a way to do that, I've even tried to find over internet tutorial about that. My idea is to send from a site periodically the probes's value with a POST request like that one:
POST /variables/temperature?pretty
{
"id_site": "ID_site",
"name":"Probe_01",
"value":23.0,
"measure":"°C",
"description":"value proble 01",
"timestamp":"2017-08-11T14:12:12"
}
I actually have just a node named "variables", in this node I have kind of variables that I specify on _type like for probe it's "temperature", anyway the problems is, that for every site I don't know the name of the probes and how many them are, so I want automatically get last value for each probe to show them on a map, then if I want a trend of that one I need just to search for name the probe and sort it by timestamp asc.
I want automatically get last value for each probe to show them on a map
I mean get all probes name on that site and give me no duplicate name, because right now on my node I have all the probes's value at every time so maybe I have something like that:
"hits": {
"total": 12,
"max_score": null,
"hits": [
{
"_index": "variables",
"_type": "temperature",
"_id": "AV49_s-93IfmC-JQNH9Z",
"_score": null,
"_source": {
"id_site": "RMTR001",
"name": "SA1",
"value": 23,
"measure": "°C",
"description": "sonda sala vendita",
"timestamp": "2017-09-01T17:00:00"
},
"sort": [
1504285200000
]
},
{
"_index": "variables",
"_type": "temperature",
"_id": "AV49_wks3IfmC-JQNH9a",
"_score": null,
"_source": {
"id_site": "RMTR001",
"name": "SA1",
"value": 23.5,
"measure": "°C",
"description": "sonda sala vendita",
"timestamp": "2017-09-01T17:15:00"
},
"sort": [
1504286100000
]
},
{
"_index": "variables",
"_type": "temperature",
"_id": "AV49_ze13IfmC-JQNH9b",
"_score": null,
"_source": {
"id_site": "RMTR001",
"name": "SA1",
"value": 23.7,
"measure": "°C",
"description": "sonda sala vendita",
"timestamp": "2017-09-01T17:30:00"
},
"sort": [
1504287000000
]
},
{
"_index": "variables",
"_type": "temperature",
"_id": "AV49_4hc3IfmC-JQNH9c",
"_score": null,
"_source": {
"id_site": "RMTR001",
"name": "SA1",
"value": 24.2,
"measure": "°C",
"description": "sonda sala vendita",
"timestamp": "2017-09-01T17:45:00"
},
"sort": [
1504287900000
]
},
{
"_index": "variables",
"_type": "temperature",
"_id": "AV49_7qV3IfmC-JQNH9d",
"_score": null,
"_source": {
"id_site": "RMTR001",
"name": "SA1",
"value": 24.4,
"measure": "°C",
"description": "sonda sala vendita",
"timestamp": "2017-09-01T18:00:00"
},
"sort": [
1504288800000
]
},
{
"_index": "variables",
"_type": "temperature",
"_id": "AV49__F93IfmC-JQNH9e",
"_score": null,
"_source": {
"id_site": "RMTR001",
"name": "SA1",
"value": 24,
"measure": "°C",
"description": "sonda sala vendita",
"timestamp": "2017-09-01T18:15:00"
},
"sort": [
1504289700000
]
}
}
and what really I want is just the la value of SA1 and SA2.
Finally, I have to read the last value update for each probe, but also I need to have a look at the trend of each probe. Can someone help me to build a better structure to store my data from the site, which is the best way to read them for last value and for a trend?
Thanks in advance,
Mirko