Query filters
請在提供篩選功能的 API 要求中使用下方的查詢篩選器規格,篩選字串必須指定為運算式或運算式清單。
簡單運算式
您必須使用以下文法指定篩選器:
運算式具有下列一般格式:
<expr> |
::= |
<field> <operator> <value> |
<field>
是「string
」。當 <field>
包含空格或冒號時,必須以雙引號括住。
<operator>
可以是等式或關係運算子,並遵循下列規格:
等式運算子 "="
僅適用於字串欄位。
只有字串欄位才能定義前置字串比對運算子 ":"
。
關係運算子 "<" | ">" | "<=" | ">="
僅定義於時間戳記欄位。
- 提供的
<value>
應為 string
,可能為 Timestamp
格式,視 <field>
而定。如果 <value>
包含空格或冒號,必須以雙引號括住。
運算式清單
運算式可以彙整來形成較複雜的查詢。BNF 規格如下:
<exprList> |
::= |
<expr> |
<exprList> <conjunction> <expr> |
<negation> <expr>
|
<conjunction> |
::= |
"AND" | "OR" | "" |
<negation> |
::= |
"NOT" |
使用空字串作為隱含 AND 的結合。
彙整作業的優先順序 (從最高到最低) 為 NOT、AND 和 OR。
示例
以下是部分篩選器範例。請注意,實際支援的欄位可能因 API 版本而異。如需 v1beta1
中提供的篩選器欄,請參閱這裡。
如何查詢 2018 年 4 月 5 日當天或之後建立的所有快訊:
createTime >= "2018-04-05T00:00:00Z"
如何查詢來自「Gmail 網路釣魚」來源的所有警示:
source="Gmail phishing"
如要查詢來源開頭為「Gmail」的所有快訊:
source:"Gmail"
如何查詢所有使用者在 2017 年開始傳送的網路釣魚警示:
startTime >= "2017-01-01T00:00:00Z" AND startTime <
"2018-01-01T00:00:00Z"
Gmail 來源:
type="User reported phishing" source="Gmail phishing"
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-07-10 (世界標準時間)。
[null,null,["上次更新時間:2024-07-10 (世界標準時間)。"],[[["Filter strings are constructed using expressions or lists of expressions, applying operators to specified fields and values."],["Operators include equality (`=`), prefix match (`:`), and relational operators (`\u003c`, `\u003e`, `\u003c=`, `\u003e=`) with specific usage depending on the field type."],["Expression lists combine expressions using conjunctions (`AND`, `OR`, implicit `AND`) and negation (`NOT`) with precedence order: `NOT`, `AND`, `OR`."],["Values and fields containing spaces or colons must be enclosed in double quotes."],["Refer to the provided documentation for specific filter columns available in different API versions and examples of constructing filter strings."]]],["API requests with filtering use filter strings as expressions or lists. Expressions follow the format: `\u003cfield\u003e \u003coperator\u003e \u003cvalue\u003e`. Fields can be strings, enclosed in double quotes if containing spaces or colons. Operators include `=` (equality), `:` (prefix match) for strings, and `\u003c`, `\u003e`, `\u003c=`, `\u003e=` (relational) for timestamps. Values are strings, potentially in Timestamp format, also quoted if necessary. Expression lists are joined by `AND`, `OR`, or implicit `AND` and can be negated with `NOT`, with precedence of NOT, AND, and then OR.\n"]]