Filter query results using selector shortcuts and the where argument — operators, nested filters, OR logic, and defaults
There are two ways to filter data in ChainStream GraphQL:
Selector shortcuts — top-level arguments like tokenAddress that provide a convenient shorthand for common filters
where argument — a nested filter object that supports the full range of operators and arbitrary dimension filtering
Best Practice: Always add a time filter. For DWD (detail) Cubes like DEXTrades, Transfers, and BalanceUpdates, queries without a Block.Time filter may scan very large table partitions. Always include where: {Block: {Time: {after: "..."}}} to limit the scan range and avoid potential memory limits on the OLAP engine.
Selectors are convenience arguments on Cube fields that map to common where filter patterns. They accept the same filter input types as where fields (e.g., StringFilter with is, in, like, etc.), not plain strings.
Selectors support all filter operators — not just exact match. For example, tokenAddress: {in: ["ADDR_1", "ADDR_2"]} matches multiple tokens, and date: {after: "2025-01-01T00:00:00Z"} filters by time.
The where argument accepts a nested input object that mirrors the Cube’s dimension hierarchy. Each leaf field maps to a filter primitive with typed operators.
By default, all conditions in where are combined with AND. To express OR logic, use the any array field — each element is a full filter object, and records matching any of them are returned.
Or remove the filter entirely by not specifying IsSuspect in where — the default false still applies. To query all trades regardless of suspect status, use OR: