I would like to save some version data of mobile applications on ElasticSearch and visualize them on Kibana / Grafana. The goal is to know the use of the application version.
Say I have these "mobile app init" event entries in ElasticSearch (simplified):
* clientId: ABC, clientVersion: 1.2.3, time: 2018-01-01
* clientId: DEF, clientVersion: 1.2.3, time: 2018-01-02
* clientId: GHI, clientVersion: 1.2.3, time: 2018-01-03
* clientId: DEF, clientVersion: 1.2.3, time: 2018-01-04
* clientId: GHI, clientVersion: 1.2.4, time: 2018-01-05
And I would like to have a visualization in Kibana / Grafana, for example:
* version 1.2.3: 2 installations
* version 1.2.4: 1 installation
According to the above data, version 1.2.3 is currently used by ABC and DEF. Version 1.2.4 is used 1.2.4.
- ABC has only 1 entry since 1.2.3.
- DEF has 2 entries, as of 1.2.3. Since I would like to see the use of the application version for each client, duplicate data should be ignored.
- GHI has 2 entries, 1 with 1.2.3 and 1 with 1.2.4. But since the latest record is 1.2.4, the 1.2.3 record is ignored.
ElasticSearch, :
:
- ElasticSearch?
- , β1, , Kibana/Grafana?
, update/upsert. ElasticSearch.
: .
, top_hits
:
Elasticsearch
clientId top_hits
, clientId terms
. , top_hits
- . Google [top_hits] cannot accept sub-aggregations"
:
GET /metric/_search
{
"aggs" : {
"latestEntriesPerClients" : {
"terms" : { "field" : "clientid" },
"aggs": {
"1": {
"top_hits": {
"sort": [{
"date": {"order": "desc"}
}],
"size": 1
}
}
}
}
}
}
:
* clientId: ABC, clientVersion: 1.2.3, time: 2018-01-01
* clientId: DEF, clientVersion: 1.2.3, time: 2018-01-04
* clientId: GHI, clientVersion: 1.2.4, time: 2018-01-05
, ? , .