事物查询示例
机群索引功能在预览版中 Amazon IoT Device Defender 支持名为影子和 Amazon IoT Device Management 违规数据本文档,随时可能更改。 |
使用查询语法在查询字符串中指定查询。查询将传递给SearchIndex
API。下表列出了一些查询字符串示例。
查询字符串 | 结果 |
---|---|
abc |
在任何注册表、影子(经典未命名影子和命名影子)或 Device Defender 违规字段中查询“abc”。 |
thingName:myThingName |
查询名为“myThingName”的事物。 |
thingName:my* |
查询名称以“my”开头的事物。 |
thingName:ab? |
查询名称为“ab”加另外一个字符的事物(例如:“aba”、“abb”、“abc”等)。 |
thingTypeName:aa |
查询与类型 aa 关联的事物。 |
attributes.myAttribute:75 |
查询属性名为“myAttribute”且属性值为 75 的事物。 |
attributes.myAttribute:[75 TO 80] |
查询属性名为“myAttribute”,且属性值在数字范围(75-80,含 75 和 80)之内的事物。 |
attributes.myAttribute:{75 TO 80] |
查询属性名为“myAttribute”,且属性值在数字范围(大于 75 且小于等于 80)之内的事物。 |
attributes.serialNumber:["abcd" TO "abcf"] |
查询属性名为“serialNumber”,且属性值在字母数字字符串范围之内的事物。此查询将返回属性名为“serialNumber”,且其值为“abcd”、“abce”或“abcf”的事物。 |
attributes.myAttribute:i*t |
查询属性名为“myAttribute”,且属性值为以“i”开头、以“t”结尾、中间有任意数量字符的事物。 |
attributes.attr1:abc AND attributes.attr2<5 NOT attributes.attr3>10 |
使用布尔表达式组合术语来查询事物。此查询将返回具有下列特征的事物:属性名为“attr1”且值为“abc”;属性名为“attr2”且值小于 5;以及属性名为“attr3”且值不大于 10。 |
shadow.hasDelta:true |
查询具有增量元素的未命名影子的事物。 |
NOT attributes.model:legacy |
查询属性名为“model”且不是“legacy”的事物。 |
shadow.reported.stats.battery:{70 TO 100} (v2 OR v3) NOT attributes.model:legacy |
查询具有以下特征的事物:
|
shadow.reported.myvalues:2 |
查询具有以下特征的事物:影子的“reported”部分中的 |
shadow.reported.location:* NOT shadow.desired.stats.battery:* |
查询具有以下特征的事物:
|
shadow.name.<shadowName>.hasDelta:true |
查询具有给定名称和增量元素影子的东西。用于支持名为影子的索引的机群组索引功能位于 Amazon IoT Device Management 的预览版本中。 |
shadow.name.<shadowName>.desired.filament:* |
查询具有给定名称和所需灯丝特性的阴影的对象。支持索引命名影子的机群索引功能已在 Amazon IoT Device Management 预览版中。 |
shadow.name.<shadowName>.reported.location:* |
查询具有具有给定命名影子且 |
connectivity.connected:true |
查询所有连接的设备。 |
connectivity.connected:false |
查询所有断开连接的设备。 |
connectivity.connected:true AND connectivity.timestamp : [1557651600000 TO 1557867600000] |
查询所有已连接且连接时间戳 >= 1557651600000 且 <= 1557867600000 的设备。时间戳以自纪元以来的毫秒数给出。 |
connectivity.connected:false AND connectivity.timestamp : [1557651600000 TO 1557867600000] |
查询所有已断开连接且断开连接时间戳 >= 1557651600000 且 <= 1557867600000 的设备。时间戳以自纪元以来的毫秒数给出。 |
connectivity.connected:true AND connectivity.timestamp > 1557651600000 |
查询所有已连接且连接时间戳 > 1557651600000 的设备。时间戳以自纪元以来的毫秒数给出。 |
connectivity.connected:* |
查询具有连接信息的所有设备。 |
connectivity.disconnectReason:* |
查询具有连接断开原因的所有设备。 |
connectivity.disconnectReason:CLIENT_INITIATED_DISCONNECT |
查询由于 CLIENT_INITATE_DISKINATE_DISKINTION 而断开的所有设备 |
deviceDefender.violationCount:[0 TO 100] |
查询设备计数值在数字范围(0-100)内的 Device Defender 违规事物。支持索引 Device Defender 违规数据的机群索引功能在 Amazon IoT Device Management 预览版中。 |
deviceDefender.<device-SecurityProfile>.disconnectBehavior.inViolation:true |
查询违反安全配置文件 device-SecurityProfile 中定义的行为 disconnectBehavior 的事物。请注意,inViolation:false 不是有效的查询。支持索引 Device Defender 违规数据的机群索引功能在 Amazon IoT Device Management 预览版中。 |
deviceDefender.<device-SecurityProfile>.disconnectBehavior.lastViolationValue.number>2 |
查询上次违规事件值大于 2 的安全配置文件设备 SecurityProfile 中定义的行为 disconnectBehavior 违规事物。支持索引 Device Defender 违规数据的机群索引功能在 Amazon IoT Device Management 预览版中。 |
deviceDefender.<device-SecurityProfile>.disconnectBehavior.lastViolationTime>1634227200000 |
查询上次违规事件特定纪元时间后的安全配置文件设备 SecurityProfile 中定义的行为 |