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"
如需查询来自 type="User reported phishing" source="Gmail phishing"
所有用户报告的“Gmail 钓鱼式攻击提醒”,请按以下步骤操作:
source:"Gmail"
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-07-10。
[null,null,["最后更新时间 (UTC):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"]]