我目前正在使用Quantum /CrateDB通过Orion上下文代理来持久化时间序列数据。
设置Orion通知后,我可以查询数据。
curl -X GET "http://localhost:8668/v2/entities/urn:ngsi-ld:Pmr_obs:001/attrs/slotStatus?limit=3" -H "Accept: application/json" -H "Fiware-Service: atos" -H "Fiware-ServicePath: /mtp"响应
{
"attrName": "slotStatus",
"entityId": "urn:ngsi-ld:Pmr_obs:001",
"index": [
"2019-07-28T19:00:00.000+00:00",
"2019-07-29T07:00:00.000+00:00",
"2019-07-29T10:00:00.000+00:00"
],
"values": [
0,
1,
0
]
}但是,当我试图查询特定时间段(两个日期之间)的数据时,服务器将返回所有索引和值,而不是我选择的时间段。
curl -X GET "http://localhost:8668/v2/entities/urn:ngsi-ld:Pmr_obs:001/attrs/slotStatus?dateFrom=2020-12-01T00:00:00.000Z&dateTo=2020-12-31T23:59:59.999Z" -H "Accept: application/json" -H "Fiware-Service: atos" -H "Fiware-ServicePath: /mtp"Response (all the values from 2019 to end of 2020)奇怪的是,如果我使用聚合方法,它就会使用特定的日期周期正确地过滤数据。
curl -X GET "http://localhost:8668/v2/entities/urn:ngsi-ld:Pmr_obs:001/attrs/slotStatus?aggrMethod=count&dateFrom=2020-12-01&dateTo=2020-12-31" -H "Accept: application/json" -H "Fiware-Service: atos" -H "Fiware-ServicePath: /mtp"响应
{
"attrName": "slotStatus",
"entityId": "urn:ngsi-ld:Pmr_obs:001",
"index": [],
"values": [
1101
]
}在没有聚合方法的情况下,我应该做些什么来只查询特定时间段的数据?
提前谢谢。
量子跳跃:0.8箱:4.1.4
发布于 2022-05-23 12:35:32
我们调查了问题。
所使用的查询包含dateFrom和dateTo,但是按照quantumleap的API规范,它应该是fromDate和toDate (应该工作得很好)。
https://stackoverflow.com/questions/67932711
复制相似问题