다음을 통해 공유


search operator

Applies to: ✅Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

여러 테이블 및 열에서 텍스트 패턴을 검색합니다.

Note

If you know the specific tables and columns you want to search, it's more performant to use the union and where operators. search 많은 수의 테이블과 열을 검색할 때 연산자가 느려질 수 있습니다.

Syntax

[T|] search [kind=CaseSensitivity ] [in(TableSources)] SearchPredicate

Learn more about syntax conventions.

Parameters

Name Type Required Description
T string The tabular data source to be searched over, such as a table name, a union operator, or the results of a tabular query. Can't be specified together with TableSources.
CaseSensitivity string 대/소문자 구분과 관련하여 string모든 has 스칼라 연산자의 동작을 제어하는 플래그입니다. 유효한 값은 default, case_insensitive. case_sensitive 기본 동작은 대/소문자를 구분하지 않으므로 옵션 defaultcase_insensitive 동의어입니다.
TableSources string 검색에 참여할 "와일드카드" 테이블 이름의 쉼표로 구분된 목록입니다. The list has the same syntax as the list of the union operator. Can't be specified together with tabular data source (T).
SearchPredicate string ✔️ 입력의 모든 레코드에 대해 계산할 부울 식입니다. 반환 true되는 경우 레코드가 출력됩니다. 검색 조건자 구문을 참조 하세요.

Note

If both tabular data source (T) and TableSources are omitted, the search is carried over all unrestricted tables and views of the database in scope.

검색 조건자 구문

The SearchPredicate allows you to search for specific terms in all columns of a table. 검색 용어에 적용되는 연산자는 다음 표와 같이 용어의 와일드카드 별표(*)의 존재 및 배치에 따라 달라집니다.

Literal Operator
billg has
*billg hassuffix
billg* hasprefix
*billg* contains
bi*lg matches regex

검색을 특정 열로 제한하거나, 용어 일치 대신 정확한 일치 항목을 찾거나, 정규식으로 검색할 수도 있습니다. 이러한 각 사례에 대한 구문은 다음 표에 나와 있습니다.

Syntax Explanation
ColumnName:StringLiteral 이 구문을 사용하여 검색을 특정 열로 제한할 수 있습니다. 기본 동작은 모든 열을 검색하는 것입니다.
ColumnName==StringLiteral 이 구문을 사용하여 문자열 값에 대한 열의 정확한 일치 항목을 검색할 수 있습니다. 기본 동작은 용어 일치를 찾는 것입니다.
Columnmatches regexStringLiteral This syntax indicates regular expression matching, in which StringLiteral is the regex pattern.

부울 식을 사용하여 조건을 결합하고 더 복잡한 검색을 만듭니다. 예를 들어 "error" and x==123 열에 용어 error 가 있고 열의 값 123 이 있는 레코드를 검색합니다 x .

검색 조건자 구문 예제

# Syntax 의미(해당 where) Comments
1 search "err" where * has "err"
2 search in (T1,T2,A*) "err" union T1,T2,A* | where *에 "err"이 있습니다.
3 search col:"err" where col has "err"
4 search col=="err" where col=="err"
5 search "err*" where * hasprefix "err"
6 search "*err" where * hassuffix "err"
7 search "*err*" where * contains "err"
8 search "Lab*PC" where * matches regex @"\bLab.*PC\b"
9 search * where 0==0
10 search col matches regex "..." where col matches regex "..."
11 search kind=case_sensitive 모든 문자열 비교는 대/소문자를 구분합니다.
12 search "abc" and ("def" or "hij") where * has "abc" and (* has "def" or * has hij")
13 search "err" or (A>a and A<b) where * has "err" or (A>a and A<b)

Remarks

Unlike the find operator, the search operator doesn't support the following syntax:

  1. withsource=: 출력에는 항상 각 레코드가 검색된 테이블 이름(또는 원본이 테이블이 아니라 복합 식인 경우 시스템 생성 이름)인 $table 형식의 string 열이 포함됩니다.
  2. project=, project-smart: 연산자는 search 출력 열을 사용자 지정하기 위한 이러한 옵션을 지원하지 않습니다. 대신 출력에 대한 관련 열 집합을 자동으로 선택합니다. 이 집합은 연산자의 옵션에 project-smart 의해 find 검색된 열 집합과 동일합니다.

Examples

The examples in this article use publicly available tables in the help cluster, such as the StormEvents table in the Samples database.

The examples in this article use publicly available tables, such as the Weather table in the Weather analytics sample gallery. 작업 영역의 테이블과 일치하도록 예제 쿼리에서 테이블 이름을 수정해야 할 수 있습니다.

다음 예제에서는 전역 용어 검색을 실행하는 방법을 보여줍니다. Search for the term Green in all the tables of the ContosoSales database.

The output finds records with the term Green as a last name or a color in the Customers, Products, and SalesTable tables.

 search "Green"

Output

$table CityName ContinentName CustomerKey Education FirstName Gender LastName
Customers Ballard North America 16549 Partial College Mason M Green
Customers Bellingham North America 2070 High School Adam M Green
Customers Bellingham North America 10658 Bachelors Sara F Green
Customers Beverly Hills North America 806 Graduate Degree Richard M Green
Customers Beverly Hills North America 7674 Graduate Degree James M Green
Customers Burbank North America 5241 Graduate Degree Madeline F Green

다음 예제에서는 조건부 전역 용어 검색을 실행하는 방법을 보여줍니다. Search for records that contain the term Green and one of either terms Deluxe or Proseware in the ContosoSales database.

search "Green" and ("Deluxe" or "Proseware")

Output

$table ProductName Manufacturer ColorName ClassName ProductCategoryName
Products Contoso 8GB 시계 & 라디오 MP3 플레이어 X850 녹색 Contoso, Ltd Green Deluxe Audio
Products Proseware Scan Jet Digital Flat Bed Scanner M300 Green Proseware, Inc. Green Regular Computers
Products Proseware All-In-One Photo Printer M200 Green Proseware, Inc. Green Regular Computers
Products Proseware Ink Jet Wireless All-In-One Printer M400 Green Proseware, Inc. Green Regular Computers
Products Proseware Ink Jet Instant PDF Sheet-Fed 스캐너 M300 Green Proseware, Inc. Green Regular Computers
Products Proseware Desk Jet 올인원 프린터, 스캐너, 복사기 M350 Green Proseware, Inc. Green Regular Computers
Products Proseware Duplex Scanner M200 Green Proseware, Inc. Green Regular Computers

다음 예제에서는 특정 테이블 내에서 용어를 검색하는 방법을 보여 줍니다. Search for the term Green only in the Customers table.

search in (Products) "Green"

Output

$table ProductName Manufacturer ColorName
Products Contoso 4G MP3 플레이어 E400 Green Contoso, Ltd Green
Products Contoso 8GB Super-Slim MP3/Video Player M800 Green Contoso, Ltd Green
Products Contoso 16GB Mp5 Player M1600 Green Contoso, Ltd Green
Products Contoso 8GB 시계 & 라디오 MP3 플레이어 X850 녹색 Contoso, Ltd Green
Products NT 무선 블루투스 스테레오 헤드폰 M402 그린 Northwind Traders Green
Products NT 무선 송신기 및 블루투스 헤드폰 M150 그린 Northwind Traders Green

다음 예제에서는 대/소문자를 구분하는 용어를 검색하는 방법을 보여 줍니다. Search for records that match the case-sensitive term in the ContosoSales database.

search kind=case_sensitive "blue"

Output

$table ProductName Manufacturer ColorName ClassName
Products Contoso 16GB 차세대 MP5 플레이어 M1650 blue Contoso, Ltd blue Regular
Products Contoso Bright Light 배터리 E20 Blue Contoso, Ltd blue Economy
Products Litware 120mm Blue LED 케이스 팬 E901 blue Litware, Inc. blue Economy
NewSales Litware 120mm Blue LED 케이스 팬 E901 blue Litware, Inc. blue Economy
NewSales Litware 120mm Blue LED 케이스 팬 E901 blue Litware, Inc. blue Economy
NewSales Litware 120mm Blue LED 케이스 팬 E901 blue Litware, Inc. blue Economy
NewSales Litware 120mm Blue LED 케이스 팬 E901 blue Litware, Inc. blue Economy

다음 예제에서는 특정 열에서 용어를 검색하는 방법을 보여 줍니다. Search for the terms Aaron and Hughes, in the "FirstName" and "LastName" columns respectively, in the ContosoSales database.

search FirstName:"Aaron" or LastName:"Hughes"

Output

$table CustomerKey Education FirstName Gender LastName
Customers 18285 High School Riley F Hughes
Customers 802 Graduate Degree Aaron M Sharma
Customers 986 Bachelors Melanie F Hughes
Customers 12669 High School Jessica F Hughes
Customers 13436 Graduate Degree Mariah F Hughes
Customers 10152 Graduate Degree Aaron M Campbell

다음 예제에서는 타임스탬프를 사용하여 용어를 검색하는 방법을 보여 줍니다. Search for the term Hughes in the ContosoSales database, if the term appears in a record with a date greater than the given date in 'datetime'.

search "Hughes" and DateKey > datetime('2009-01-01')

Output

$table DateKey SalesAmount_real
SalesTable 2021-12-13T00:00:00Z 446.4715
SalesTable 2021-12-13T00:00:00Z 120.555
SalesTable 2021-12-13T00:00:00Z 48.4405
SalesTable 2021-12-13T00:00:00Z 39.6435
SalesTable 2021-12-13T00:00:00Z 56.9905

Performance Tips

# Tip Prefer Over
1 여러 연속 search 연산자보다 단일 search 연산자를 사용하는 것이 좋습니다. search "billg" and ("steveb" or "satyan") 검색 "billg" | "steveb" 또는 "satyan" 검색
2 연산자 내에서 필터링하는 것이 좋습니다.search search "billg" and "steveb" 검색 * | where *에는 "billg"가 있고 * 에는 "steveb"가 있습니다.