本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
事物组查询示例
系统在查询字符串中使用查询语法指定查询,并将其传送至 SearchIndex
API。下表列出了一些查询字符串示例。
查询字符串 | 结果 |
---|---|
abc
|
在所有字段中查询“abc”。 |
thingGroupName:myGroupThingName
|
查询名为 “myGroupThing名称” 的事物组。 |
thingGroupName:my*
|
查询名称以“my”开头的事物组。 |
thingGroupName:ab?
|
查询名称为“ab”加另外一个字符的事物组(例如:“aba”、“abb”、“abc”等。) |
attributes.myAttribute:75
|
查询属性名为“myAttribute”且属性值为 75 的事物组。 |
attributes.myAttribute:[75 TO 80]
|
查询属性名为“myAttribute”,且属性值在数字范围(75-80,含 75 和 80)之内的事物组。 |
attributes.myAttribute:[75 TO 80]
|
查询属性名为“myAttribute”,且属性值在数字范围(大于 75 且小于等于 80)之内的事物组。 |
attributes.myAttribute:["abcd" TO "abcf"]
|
查询属性名为“myAttribute”,且属性值在字母数字字符串范围之内的事物组。此查询将返回属性名为“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。 |
NOT attributes.myAttribute:cde
|
查询属性名为“myAttribute”且不是“cde”的事物组。 |
parentGroupNames:(myParentThingGroupName)
|
查询父组名称与 “myParentThingGroupName” 匹配的事物组。 |
parentGroupNames:(myParentThingGroupName OR myRootThingGroupName)
|
查询父组名称与 “” 或 “myParentThingGroupName” 匹配的事物组。myRootThing GroupName |
parentGroupNames:(myParentThingGroupNa*)
|
查询父组名称以 “myParentThingGroupNa” 开头的事物组。 |