diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/kv/BaseReadTsKvQuery.java b/common/data/src/main/java/org/thingsboard/server/common/data/kv/BaseReadTsKvQuery.java
index 3c48adf..739586e 100644
--- a/common/data/src/main/java/org/thingsboard/server/common/data/kv/BaseReadTsKvQuery.java
+++ b/common/data/src/main/java/org/thingsboard/server/common/data/kv/BaseReadTsKvQuery.java
@@ -42,4 +42,8 @@ public class BaseReadTsKvQuery extends BaseTsKvQuery implements ReadTsKvQuery {
this(key, startTs, endTs, endTs - startTs, 1, Aggregation.AVG, "DESC");
}
+ public BaseReadTsKvQuery(String key, long startTs, long endTs, int limit, String orderBy) {
+ this(key, startTs, endTs, endTs - startTs, limit, Aggregation.AVG, orderBy);
+ }
+
}
diff --git a/dao/src/main/java/org/thingsboard/server/dao/timeseries/BaseTimeseriesService.java b/dao/src/main/java/org/thingsboard/server/dao/timeseries/BaseTimeseriesService.java
index 605c941..3829df6 100644
--- a/dao/src/main/java/org/thingsboard/server/dao/timeseries/BaseTimeseriesService.java
+++ b/dao/src/main/java/org/thingsboard/server/dao/timeseries/BaseTimeseriesService.java
@@ -75,7 +75,10 @@ public class BaseTimeseriesService implements TimeseriesService {
EntityView entityView = entityViewService.findEntityViewById((EntityViewId) entityId);
Collection<String> matchingKeys = chooseKeysForEntityView(entityView, keys);
List<ReadTsKvQuery> queries = new ArrayList<>();
- matchingKeys.forEach(key -> queries.add(new BaseReadTsKvQuery(key, entityView.getStartTs(), entityView.getEndTs())));
+
+ matchingKeys.forEach(key -> queries.add(
+ new BaseReadTsKvQuery(key, entityView.getStartTs(), entityView.getEndTs(), 1, "ASC")));
+
return timeseriesDao.findAllAsync(entityView.getEntityId(), updateQueriesForEntityView(entityView, queries));
}
keys.forEach(key -> futures.add(timeseriesDao.findLatest(entityId, key)));