Skip to content

Commit 313e83a

Browse files
committed
docs: enhance JMESPath documentation with Enterprise examples
- Add Quick Start section with simple examples - Add comprehensive Enterprise-specific examples for databases, nodes, modules - Include practical examples for license checking and alert monitoring - Reorganize to separate Cloud and Enterprise examples - Add examples showing memory conversion and status filtering
1 parent 82a1d95 commit 313e83a

File tree

1 file changed

+107
-1
lines changed

1 file changed

+107
-1
lines changed

docs/src/common-features/jmespath-queries.md

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,30 @@ JMESPath is a query language for JSON that allows you to extract and transform d
88
redisctl [command] -o json -q "query_expression"
99
```
1010

11+
## Quick Start Examples
12+
13+
```bash
14+
# Get just one field
15+
redisctl enterprise cluster get -o json -q 'name'
16+
# Output: "docker-cluster"
17+
18+
# Get multiple fields as object
19+
redisctl enterprise database get 1 -o json -q '{name: name, port: port}'
20+
# Output: {"name": "default-db", "port": 12000}
21+
22+
# Get field from all items in a list
23+
redisctl enterprise database list -o json -q '[].name'
24+
# Output: ["default-db", "cache-db", "persistent-db"]
25+
26+
# Filter list by condition
27+
redisctl enterprise database list -o json -q "[?port > `12000`].name"
28+
# Output: ["cache-db", "persistent-db"]
29+
30+
# Count items
31+
redisctl enterprise database list -o json -q 'length(@)'
32+
# Output: 3
33+
```
34+
1135
## Common Query Patterns
1236

1337
### Select Specific Fields
@@ -103,7 +127,89 @@ redisctl cloud subscription list -o json \
103127
}"
104128
```
105129

106-
## Practical Examples
130+
## Enterprise-Specific Examples
131+
132+
### Database Management
133+
134+
```bash
135+
# Get all database names and their persistence settings
136+
redisctl enterprise database list -o json \
137+
-q '[].{name: name, persistence: data_persistence}'
138+
139+
# Find databases using AOF persistence
140+
redisctl enterprise database list -o json \
141+
-q "[?data_persistence=='aof'].name"
142+
143+
# Get database endpoints for connection strings
144+
redisctl enterprise database get 1 -o json \
145+
-q 'endpoints[0].{host: addr[0], port: port}'
146+
147+
# Monitor database creation status
148+
redisctl enterprise database list -o json \
149+
-q "[?status!='active'].{name: name, status: status}"
150+
```
151+
152+
### Node and Cluster Monitoring
153+
154+
```bash
155+
# Get node addresses with their status
156+
redisctl enterprise node list -o json \
157+
-q '[].{address: addr, status: status, shards: shard_count}'
158+
159+
# Extract specific node details
160+
redisctl enterprise node get 1 -o json \
161+
-q '{address: addr, cores: cores, memory_gb: total_memory / `1073741824`}'
162+
163+
# Check cluster resource usage
164+
redisctl enterprise cluster stats -o json \
165+
-q '{cpu: cpu_usage, memory: memory_usage, databases: total_databases}'
166+
167+
# Get cluster version and license status
168+
redisctl enterprise cluster get -o json \
169+
-q '{name: name, version: software_version, licensed: !license_expired}'
170+
```
171+
172+
### Module Management
173+
174+
```bash
175+
# List all module names and versions
176+
redisctl enterprise module list -o json \
177+
-q '[].{name: module_name, version: semantic_version}'
178+
179+
# Find specific module version
180+
redisctl enterprise module list -o json \
181+
-q "[?module_name=='search'].semantic_version | [0]"
182+
183+
# Get modules configured for a database
184+
redisctl enterprise database get 1 -o json \
185+
-q 'module_list[].{name: module_name, args: module_args}'
186+
```
187+
188+
### License and Compliance
189+
190+
```bash
191+
# Check license expiration
192+
redisctl enterprise license get -o json \
193+
-q '{expired: expired, expires_on: expiration_date}'
194+
195+
# Count total shards across all databases
196+
redisctl enterprise database list -o json \
197+
-q 'sum([].shards_count)'
198+
```
199+
200+
### Alert Monitoring
201+
202+
```bash
203+
# Count active alerts
204+
redisctl api enterprise get /v1/cluster/alerts -o json \
205+
-q 'length(@)'
206+
207+
# Get alert details if any exist
208+
redisctl api enterprise get /v1/cluster/alerts -o json \
209+
-q '[].{severity: severity, message: message}'
210+
```
211+
212+
## Cloud-Specific Examples
107213

108214
### Find Resources by Tags
109215

0 commit comments

Comments
 (0)