TL;DR
Alias 的な感じで同じだと思っていたが別物だった。
contains
は文字列を検索し、has
は用語(term
)を検索する。
雑な検索をするときは、| * has "keyword"
より | * contains "keyword"
のほうが良さそう。
大文字と小文字を区別しない文字列を含む、データのレコード セットをフィルター処理します。 contains は、用語ではなく任意のサブ文字列を検索します。
Filters a record set for data containing a case-insensitive string. contains searches for arbitrary sub-strings rather than terms.
大文字と小文字を区別しない文字列を使用して、データのレコード セットをフィルター処理します。 has は、インデックス付き用語を検索します。インデックス付き 用語 は 3 つ以上の文字です。 用語が 3 文字未満の場合、クエリは列内の値をスキャンします。これは、用語インデックスで用語を検索するよりも低速です。
Filters a record set for data with a case-insensitive string. has searches for indexed terms, where an indexed term is three or more characters. If your term is fewer than three characters, the query scans the values in the column, which is slower than looking up the term in the term index.
例
StormEvents
| summarize has_Thunder = countif(EpisodeNarrative has "Thunder"),
has_ThunderStom = countif(EpisodeNarrative has "ThunderStom"),
has_ThunderStorms = countif(EpisodeNarrative has "ThunderStorms"),
has_ThunderStroms = countif(EpisodeNarrative has "ThunderStroms"),
contains_Thunder = countif(EpisodeNarrative contains "Thunder"),
contains_ThunderStorm = countif(EpisodeNarrative contains "ThunderStorm")
EpisordNarrative
フィールドには、Thunder
というキーワード以外にも Thunderstorms
といった単語を含むレコードや、 Thunderstroms
などの typo を含むレコードがあるので、それぞれ has
では検索結果がことなる。