1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Kusto の contains 演算子 と has 演算子

Posted at

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")

image.png

EpisordNarrative フィールドには、Thunder というキーワード以外にも Thunderstorms といった単語を含むレコードや、 Thunderstroms などの typo を含むレコードがあるので、それぞれ hasでは検索結果がことなる。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?