has_all 運算子

篩選資料的記錄集,該資料集具有一或多個不區分大小寫的搜尋字串。 has_all 會搜尋索引字詞,其中索引 字詞 為三個或多個字元。 如果您的詞彙少於三個字元,查詢就會掃描資料行中的值,而這比查閱詞彙索引中的詞彙還要慢。

如需其他運算子的詳細資訊,以及如何判斷哪一個運算子最適合您的查詢,請參閱 datatype 字串運算子

Syntax

T|wherecolhas_all(表達, ... )

深入瞭解 語法慣例

參數

名稱 類型 必要 Description
T string ✔️ 要篩選的表格式輸入。
col string ✔️ 要篩選的數據行。
expression 純量或表格式 ✔️ 表達式,指定要搜尋的值。 每個運算式可以是 純量值 或產生一組值的 表格式表達式 。 如果表格式表達式有多個數據行,則會使用第一個數據行。 搜尋最多會考慮 256 個不同的值。

傳回

T 中的資料列,其述詞是 true

範例

一組純量

下列查詢示範如何搭配逗號分隔純量值集使用 has_all

StormEvents 
| where EpisodeNarrative has_all ("cold", "strong", "afternoon", "hail")
| summarize Count=count() by EventType
| top 3 by Count

輸出

EventType Count
Thunderstorm Wind 517
Hail 392
Flash Flood 24

Dynamic array

您可以使用動態陣列表示法來達成相同的結果。

StormEvents 
| where EpisodeNarrative has_all (dynamic(["cold", "strong", "afternoon", "hail"]))
| summarize Count=count() by EventType
| top 3 by Count

輸出

EventType Count
Thunderstorm Wind 517
Hail 392
Flash Flood 24

您也可以使用 let 語句來撰寫相同的查詢。

let criteria = dynamic(["cold", "strong", "afternoon", "hail"]);
StormEvents 
| where EpisodeNarrative has_all (criteria)
| summarize Count=count() by EventType
| top 3 by Count
EventType Count
Thunderstorm Wind 517
Hail 392
Flash Flood 24