範例物件群組查詢 - AWS IoT Core

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

範例物件群組查詢

查詢是以使用查詢語法的字串指定,並傳送至 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,含) 內。

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」開頭的物件群組。