Skip to main content
Graph Node provides powerful filtering and querying capabilities for precise data retrieval. This guide covers all available filter operators, sorting options, and advanced query patterns.

Filter Operators

Filters are applied using the where argument on collection queries. Each field in your entity type supports multiple filter operators.

Equality Filters

Value
Exact match filter. Matches entities where the field equals the specified value.
Value
Negation filter. Matches entities where the field does not equal the specified value.

Comparison Filters

Available for numeric types (Int, Int8, BigInt, BigDecimal) and Timestamp:
Value
Greater than. Matches entities where the field is greater than the specified value.
Value
Greater than or equal to.
Value
Less than.
Value
Less than or equal to.

String Filters

String fields support various text matching operators:
String
Case-sensitive substring match.
String
Case-insensitive substring match.
String
Does not contain substring (case-sensitive).
String
Does not contain substring (case-insensitive).
String
Starts with prefix (case-sensitive).
String
Starts with prefix (case-insensitive).
String
Does not start with prefix (case-sensitive).
String
Does not start with prefix (case-insensitive).
String
Ends with suffix (case-sensitive).
String
Ends with suffix (case-insensitive).

List Filters

[Value]
Matches entities where the field value is in the provided list.
[Value]
Matches entities where the field value is not in the provided list.

Boolean Operators

AND Operator

By default, multiple filter conditions at the same level are combined with AND:
Explicit AND using the and operator:

OR Operator

The or operator matches entities that satisfy any of the provided conditions:
Important: You cannot mix column filters with or at the same level. This is invalid:
Instead, wrap all conditions in or:

Nested Entity Filters

Filter by related entity fields using nested filters:
Query tokens by owner properties:

Derived Field Filters

Filter parent entities by properties of derived child entities:
Find tokens with large transfers:

Sorting

Simple Sorting

Sort by any field using orderBy and orderDirection:

Child Entity Sorting

Sort by fields of related entities using double underscore notation:
Graph Node automatically appends id to the ORDER BY clause to ensure deterministic ordering:
  • orderBy: name becomes ORDER BY name, id
  • This guarantees consistent pagination even when the sort field has duplicate values

Pagination

Basic Pagination

Use first and skip for offset-based pagination:

Keyset Pagination

For better performance with large offsets, use keyset (cursor-based) pagination:
Full-text search requires explicit declaration in the subgraph manifest:
Define full-text fields in your schema:
Query using the text argument:

Change Block Filter

Query entities that changed at or after a specific block:
This is useful for:
  • Incremental data synchronization
  • Detecting entities modified in recent blocks
  • Change tracking and auditing

Complex Query Examples

Combine multiple filters with boolean logic:
Filter by nested entities and sort results:
Query entities within a specific time range:

Query Limits

Graph Node enforces configurable limits to prevent excessive resource usage:
  • Maximum first value: Default is 1000, configurable per instance
  • Maximum skip value: Default is 5000, configurable per instance
  • Query timeout: Queries that take too long are automatically cancelled
  • Query complexity: Very complex queries may be rejected
Exceeding query limits returns an error:

Best Practices

  1. Use specific filters: Narrow down results with precise filters to reduce data transferred
  2. Limit field selection: Only query fields you need
  3. Prefer keyset pagination: For large datasets, use id_gt instead of large skip values
  4. Sort explicitly: Always specify orderBy for consistent pagination
  5. Index appropriately: Graph Node automatically indexes fields, but query patterns matter
  6. Monitor query performance: Use query execution time to optimize data access patterns

Next Steps