Documentation Index
Fetch the complete documentation index at: https://docs.kubiya.ai/llms.txt
Use this file to discover all available pages before exploring further.
The Query interface allows you to run Cypher queries directly against your Context Graph. Use it for advanced exploration, data extraction, and complex relationship queries.
Access
Click Context Graph > Queries in the sidebar.
Interface Layout
Query Editor
The top panel contains the Cypher query editor:
Enter your Cypher query here... (e.g., MATCH (n) RETURN n LIMIT 10)
Features:
- Syntax highlighting for Cypher
- Auto-completion suggestions
- Query history access
- Format/beautify option
Action Bar
- Execute (Cmd+Enter) - Run the current query
- Copy - Copy query to clipboard
- Clear - Reset the editor
Example Queries Panel
Expandable section with optimized queries that work with backend limitations:
| Query | Purpose |
|---|
| Get all nodes | MATCH (n) RETURN n LIMIT 20 |
| Get nodes with properties | Find nodes with specific properties |
| Find nodes with relationships | Show nodes and their connections |
| Count relationships by type | Get relationship statistics |
Results Panel
The right panel shows query results:
- Ready to Query - Initial state before running
- Results table - Query output in tabular format
- Expand/Collapse - Toggle result row details
Running Queries
Basic Query
MATCH (n) RETURN n LIMIT 10
Returns the first 10 nodes in the graph.
Filter by Type
MATCH (n:GitHubRepository) RETURN n.name, n.url LIMIT 20
Returns repository names and URLs.
Find Relationships
MATCH (source)-[r]->(target)
WITH source, target, type(r) as rel_type
RETURN source.id, rel_type, target.id
LIMIT 20
Returns source-relationship-target triples.
Count by Type
MATCH (n)
RETURN labels(n) as type, count(*) as count
ORDER BY count DESC
LIMIT 20
Returns entity type distribution.
Search by Property
MATCH (n)
WHERE n.name CONTAINS 'production'
RETURN n.name, labels(n)
LIMIT 20
Finds entities with “production” in the name.
Query Best Practices
Always Use LIMIT
-- Good
MATCH (n) RETURN n LIMIT 50
-- Avoid (may timeout)
MATCH (n) RETURN n
Optimize Relationship Queries
-- Good: Specific path
MATCH (a:Service)-[:DEPENDS_ON]->(b:Database)
RETURN a.name, b.name
-- Avoid: Unbounded paths
MATCH (a)-[*]->(b) RETURN a, b
Use Property Filters Early
-- Good: Filter in MATCH
MATCH (n:Instance {region: 'us-east-1'})
RETURN n
-- Less efficient: Filter in WHERE
MATCH (n:Instance)
WHERE n.region = 'us-east-1'
RETURN n
Keyboard Shortcuts
| Shortcut | Action |
|---|
Cmd/Ctrl + Enter | Execute query |
Cmd/Ctrl + / | Comment/uncomment line |
Query History
Click the history icon to see previous queries:
- Recent queries listed by timestamp
- Click to restore a query
- Search through history
Exporting Results
Query results can be:
- Copied to clipboard
- Used as input for further analysis
For larger exports, use the Kubiya SDK or CLI.
Common Patterns
Find Dependencies
MATCH (a)-[:DEPENDS_ON]->(b)
RETURN a.name as dependent, b.name as dependency
LIMIT 50
Find Resources by Label
MATCH (n)
WHERE 'production' IN n.labels
RETURN n.name, n.type
LIMIT 30
Count Relationships
MATCH ()-[r]->()
RETURN type(r) as relationship, count(*) as count
ORDER BY count DESC
Error Handling
Common errors:
| Error | Cause | Solution |
|---|
| Query timeout | Query too complex | Add LIMIT, simplify pattern |
| Syntax error | Invalid Cypher | Check example queries |
| No results | No matching data | Verify entity types exist |
For most exploration tasks, use the Meta Agent with natural language instead of writing Cypher manually.
Related Pages