@techwavedev/agi-agent-kit 1.1.7 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @techwavedev/agi-agent-kit might be problematic. Click here for more details.
- package/CHANGELOG.md +82 -1
- package/README.md +190 -12
- package/bin/init.js +30 -2
- package/package.json +6 -3
- package/templates/base/AGENTS.md +54 -23
- package/templates/base/README.md +325 -0
- package/templates/base/directives/memory_integration.md +95 -0
- package/templates/base/execution/memory_manager.py +309 -0
- package/templates/base/execution/session_boot.py +218 -0
- package/templates/base/execution/session_init.py +320 -0
- package/templates/base/skill-creator/SKILL_skillcreator.md +23 -36
- package/templates/base/skill-creator/scripts/init_skill.py +18 -135
- package/templates/skills/ec/README.md +31 -0
- package/templates/skills/ec/aws/SKILL.md +1020 -0
- package/templates/skills/ec/aws/defaults.yaml +13 -0
- package/templates/skills/ec/aws/references/common_patterns.md +80 -0
- package/templates/skills/ec/aws/references/mcp_servers.md +98 -0
- package/templates/skills/ec/aws-terraform/SKILL.md +349 -0
- package/templates/skills/ec/aws-terraform/references/best_practices.md +394 -0
- package/templates/skills/ec/aws-terraform/references/checkov_reference.md +337 -0
- package/templates/skills/ec/aws-terraform/scripts/configure_mcp.py +150 -0
- package/templates/skills/ec/confluent-kafka/SKILL.md +655 -0
- package/templates/skills/ec/confluent-kafka/references/ansible_playbooks.md +792 -0
- package/templates/skills/ec/confluent-kafka/references/ec_deployment.md +579 -0
- package/templates/skills/ec/confluent-kafka/references/kraft_migration.md +490 -0
- package/templates/skills/ec/confluent-kafka/references/troubleshooting.md +778 -0
- package/templates/skills/ec/confluent-kafka/references/upgrade_7x_to_8x.md +488 -0
- package/templates/skills/ec/confluent-kafka/scripts/kafka_health_check.py +435 -0
- package/templates/skills/ec/confluent-kafka/scripts/upgrade_preflight.py +568 -0
- package/templates/skills/ec/confluent-kafka/scripts/validate_config.py +455 -0
- package/templates/skills/ec/consul/SKILL.md +427 -0
- package/templates/skills/ec/consul/references/acl_setup.md +168 -0
- package/templates/skills/ec/consul/references/ha_config.md +196 -0
- package/templates/skills/ec/consul/references/troubleshooting.md +267 -0
- package/templates/skills/ec/consul/references/upgrades.md +213 -0
- package/templates/skills/ec/consul/scripts/consul_health_report.py +530 -0
- package/templates/skills/ec/consul/scripts/consul_status.py +264 -0
- package/templates/skills/ec/consul/scripts/generate_values.py +170 -0
- package/templates/skills/ec/documentation/SKILL.md +351 -0
- package/templates/skills/ec/documentation/references/best_practices.md +201 -0
- package/templates/skills/ec/documentation/scripts/analyze_code.py +307 -0
- package/templates/skills/ec/documentation/scripts/detect_changes.py +460 -0
- package/templates/skills/ec/documentation/scripts/generate_changelog.py +312 -0
- package/templates/skills/ec/documentation/scripts/sync_docs.py +272 -0
- package/templates/skills/ec/documentation/scripts/update_skill_docs.py +366 -0
- package/templates/skills/ec/gitlab/SKILL.md +529 -0
- package/templates/skills/ec/gitlab/references/agent_installation.md +416 -0
- package/templates/skills/ec/gitlab/references/api_reference.md +508 -0
- package/templates/skills/ec/gitlab/references/gitops_flux.md +465 -0
- package/templates/skills/ec/gitlab/references/troubleshooting.md +518 -0
- package/templates/skills/ec/gitlab/scripts/generate_agent_values.py +329 -0
- package/templates/skills/ec/gitlab/scripts/gitlab_agent_status.py +414 -0
- package/templates/skills/ec/jira/SKILL.md +484 -0
- package/templates/skills/ec/jira/references/jql_reference.md +148 -0
- package/templates/skills/ec/jira/scripts/add_comment.py +91 -0
- package/templates/skills/ec/jira/scripts/bulk_log_work.py +124 -0
- package/templates/skills/ec/jira/scripts/create_ticket.py +162 -0
- package/templates/skills/ec/jira/scripts/get_ticket.py +191 -0
- package/templates/skills/ec/jira/scripts/jira_client.py +383 -0
- package/templates/skills/ec/jira/scripts/log_work.py +154 -0
- package/templates/skills/ec/jira/scripts/search_tickets.py +104 -0
- package/templates/skills/ec/jira/scripts/update_comment.py +67 -0
- package/templates/skills/ec/jira/scripts/update_ticket.py +161 -0
- package/templates/skills/ec/karpenter/SKILL.md +301 -0
- package/templates/skills/ec/karpenter/references/ec2nodeclasses.md +421 -0
- package/templates/skills/ec/karpenter/references/migration.md +396 -0
- package/templates/skills/ec/karpenter/references/nodepools.md +400 -0
- package/templates/skills/ec/karpenter/references/troubleshooting.md +359 -0
- package/templates/skills/ec/karpenter/scripts/generate_ec2nodeclass.py +187 -0
- package/templates/skills/ec/karpenter/scripts/generate_nodepool.py +245 -0
- package/templates/skills/ec/karpenter/scripts/karpenter_status.py +359 -0
- package/templates/skills/ec/opensearch/SKILL.md +720 -0
- package/templates/skills/ec/opensearch/references/ml_neural_search.md +576 -0
- package/templates/skills/ec/opensearch/references/operator.md +532 -0
- package/templates/skills/ec/opensearch/references/query_dsl.md +532 -0
- package/templates/skills/ec/opensearch/scripts/configure_mcp.py +148 -0
- package/templates/skills/ec/victoriametrics/SKILL.md +598 -0
- package/templates/skills/ec/victoriametrics/references/kubernetes.md +531 -0
- package/templates/skills/ec/victoriametrics/references/prometheus_migration.md +333 -0
- package/templates/skills/ec/victoriametrics/references/troubleshooting.md +442 -0
- package/templates/skills/knowledge/SKILLS_CATALOG.md +274 -4
- package/templates/skills/knowledge/intelligent-routing/SKILL.md +237 -164
- package/templates/skills/knowledge/parallel-agents/SKILL.md +345 -73
- package/templates/skills/knowledge/plugin-discovery/SKILL.md +582 -0
- package/templates/skills/knowledge/plugin-discovery/scripts/platform_setup.py +1083 -0
- package/templates/skills/knowledge/design-md/README.md +0 -34
- package/templates/skills/knowledge/design-md/SKILL.md +0 -193
- package/templates/skills/knowledge/design-md/examples/DESIGN.md +0 -154
- package/templates/skills/knowledge/notebooklm-mcp/SKILL.md +0 -71
- package/templates/skills/knowledge/notebooklm-mcp/assets/example_asset.txt +0 -24
- package/templates/skills/knowledge/notebooklm-mcp/references/api_reference.md +0 -34
- package/templates/skills/knowledge/notebooklm-mcp/scripts/example.py +0 -19
- package/templates/skills/knowledge/react-components/README.md +0 -36
- package/templates/skills/knowledge/react-components/SKILL.md +0 -53
- package/templates/skills/knowledge/react-components/examples/gold-standard-card.tsx +0 -80
- package/templates/skills/knowledge/react-components/package-lock.json +0 -231
- package/templates/skills/knowledge/react-components/package.json +0 -16
- package/templates/skills/knowledge/react-components/resources/architecture-checklist.md +0 -15
- package/templates/skills/knowledge/react-components/resources/component-template.tsx +0 -37
- package/templates/skills/knowledge/react-components/resources/stitch-api-reference.md +0 -14
- package/templates/skills/knowledge/react-components/resources/style-guide.json +0 -27
- package/templates/skills/knowledge/react-components/scripts/fetch-stitch.sh +0 -30
- package/templates/skills/knowledge/react-components/scripts/validate.js +0 -68
- package/templates/skills/knowledge/self-update/SKILL.md +0 -60
- package/templates/skills/knowledge/self-update/scripts/update_kit.py +0 -103
- package/templates/skills/knowledge/stitch-loop/README.md +0 -54
- package/templates/skills/knowledge/stitch-loop/SKILL.md +0 -235
- package/templates/skills/knowledge/stitch-loop/examples/SITE.md +0 -73
- package/templates/skills/knowledge/stitch-loop/examples/next-prompt.md +0 -25
- package/templates/skills/knowledge/stitch-loop/resources/baton-schema.md +0 -61
- package/templates/skills/knowledge/stitch-loop/resources/site-template.md +0 -104
|
@@ -0,0 +1,532 @@
|
|
|
1
|
+
# Query DSL Reference
|
|
2
|
+
|
|
3
|
+
Complete reference for OpenSearch Query DSL patterns.
|
|
4
|
+
|
|
5
|
+
## Full-Text Queries
|
|
6
|
+
|
|
7
|
+
### Match Query
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"query": {
|
|
12
|
+
"match": {
|
|
13
|
+
"message": {
|
|
14
|
+
"query": "error connection",
|
|
15
|
+
"operator": "and",
|
|
16
|
+
"fuzziness": "AUTO"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Multi-Match Query
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"query": {
|
|
28
|
+
"multi_match": {
|
|
29
|
+
"query": "kubernetes deployment",
|
|
30
|
+
"fields": ["title^3", "description^2", "content"],
|
|
31
|
+
"type": "best_fields",
|
|
32
|
+
"tie_breaker": 0.3
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Types:**
|
|
39
|
+
|
|
40
|
+
- `best_fields` - Score from best matching field
|
|
41
|
+
- `most_fields` - Combine scores from all fields
|
|
42
|
+
- `cross_fields` - Treat fields as one field
|
|
43
|
+
- `phrase` - Match as phrase
|
|
44
|
+
- `phrase_prefix` - Match phrase prefix
|
|
45
|
+
|
|
46
|
+
### Match Phrase
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"query": {
|
|
51
|
+
"match_phrase": {
|
|
52
|
+
"message": {
|
|
53
|
+
"query": "connection timed out",
|
|
54
|
+
"slop": 2
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Query String
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"query": {
|
|
66
|
+
"query_string": {
|
|
67
|
+
"query": "status:error AND service:(api OR auth)",
|
|
68
|
+
"default_field": "message",
|
|
69
|
+
"analyze_wildcard": true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Term-Level Queries
|
|
78
|
+
|
|
79
|
+
### Term Query (Exact Match)
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"query": {
|
|
84
|
+
"term": {
|
|
85
|
+
"status.keyword": "ERROR"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Terms Query (Multiple Values)
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"query": {
|
|
96
|
+
"terms": {
|
|
97
|
+
"service": ["api-gateway", "auth-service", "user-service"]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Range Query
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"query": {
|
|
108
|
+
"range": {
|
|
109
|
+
"@timestamp": {
|
|
110
|
+
"gte": "now-1h",
|
|
111
|
+
"lt": "now",
|
|
112
|
+
"time_zone": "+01:00"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"query": {
|
|
122
|
+
"range": {
|
|
123
|
+
"response_time_ms": {
|
|
124
|
+
"gte": 500,
|
|
125
|
+
"lte": 5000
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Exists Query
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"query": {
|
|
137
|
+
"exists": {
|
|
138
|
+
"field": "error.stack_trace"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Prefix Query
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"query": {
|
|
149
|
+
"prefix": {
|
|
150
|
+
"hostname.keyword": "prod-api-"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Wildcard Query
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"query": {
|
|
161
|
+
"wildcard": {
|
|
162
|
+
"email.keyword": "*@company.com"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Regexp Query
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"query": {
|
|
173
|
+
"regexp": {
|
|
174
|
+
"trace_id": "[a-f0-9]{32}"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Compound Queries
|
|
183
|
+
|
|
184
|
+
### Bool Query
|
|
185
|
+
|
|
186
|
+
```json
|
|
187
|
+
{
|
|
188
|
+
"query": {
|
|
189
|
+
"bool": {
|
|
190
|
+
"must": [
|
|
191
|
+
{ "match": { "status": "error" } },
|
|
192
|
+
{ "range": { "@timestamp": { "gte": "now-24h" } } }
|
|
193
|
+
],
|
|
194
|
+
"should": [
|
|
195
|
+
{ "term": { "priority": "high" } },
|
|
196
|
+
{ "term": { "priority": "critical" } }
|
|
197
|
+
],
|
|
198
|
+
"must_not": [{ "term": { "acknowledged": true } }],
|
|
199
|
+
"filter": [{ "term": { "environment": "production" } }],
|
|
200
|
+
"minimum_should_match": 1,
|
|
201
|
+
"boost": 1.0
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Clauses:**
|
|
208
|
+
|
|
209
|
+
- `must` - Must match, contributes to score
|
|
210
|
+
- `should` - Optional, contributes to score
|
|
211
|
+
- `must_not` - Must not match, no scoring
|
|
212
|
+
- `filter` - Must match, no scoring (cached)
|
|
213
|
+
|
|
214
|
+
### Boosting Query
|
|
215
|
+
|
|
216
|
+
```json
|
|
217
|
+
{
|
|
218
|
+
"query": {
|
|
219
|
+
"boosting": {
|
|
220
|
+
"positive": {
|
|
221
|
+
"match": { "content": "kubernetes" }
|
|
222
|
+
},
|
|
223
|
+
"negative": {
|
|
224
|
+
"term": { "deprecated": true }
|
|
225
|
+
},
|
|
226
|
+
"negative_boost": 0.5
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Constant Score
|
|
233
|
+
|
|
234
|
+
```json
|
|
235
|
+
{
|
|
236
|
+
"query": {
|
|
237
|
+
"constant_score": {
|
|
238
|
+
"filter": {
|
|
239
|
+
"term": { "status": "published" }
|
|
240
|
+
},
|
|
241
|
+
"boost": 1.2
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Dis Max Query
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{
|
|
251
|
+
"query": {
|
|
252
|
+
"dis_max": {
|
|
253
|
+
"queries": [
|
|
254
|
+
{ "match": { "title": "kubernetes" } },
|
|
255
|
+
{ "match": { "body": "kubernetes" } }
|
|
256
|
+
],
|
|
257
|
+
"tie_breaker": 0.7
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Aggregations
|
|
266
|
+
|
|
267
|
+
### Bucket Aggregations
|
|
268
|
+
|
|
269
|
+
```json
|
|
270
|
+
{
|
|
271
|
+
"size": 0,
|
|
272
|
+
"aggs": {
|
|
273
|
+
"by_service": {
|
|
274
|
+
"terms": {
|
|
275
|
+
"field": "service.keyword",
|
|
276
|
+
"size": 20,
|
|
277
|
+
"order": { "_count": "desc" }
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
"by_hour": {
|
|
281
|
+
"date_histogram": {
|
|
282
|
+
"field": "@timestamp",
|
|
283
|
+
"fixed_interval": "1h",
|
|
284
|
+
"min_doc_count": 0,
|
|
285
|
+
"extended_bounds": {
|
|
286
|
+
"min": "now-24h",
|
|
287
|
+
"max": "now"
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
"response_ranges": {
|
|
292
|
+
"range": {
|
|
293
|
+
"field": "response_time_ms",
|
|
294
|
+
"ranges": [
|
|
295
|
+
{ "to": 100, "key": "fast" },
|
|
296
|
+
{ "from": 100, "to": 500, "key": "normal" },
|
|
297
|
+
{ "from": 500, "key": "slow" }
|
|
298
|
+
]
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Metric Aggregations
|
|
306
|
+
|
|
307
|
+
```json
|
|
308
|
+
{
|
|
309
|
+
"size": 0,
|
|
310
|
+
"aggs": {
|
|
311
|
+
"avg_response": { "avg": { "field": "response_time_ms" } },
|
|
312
|
+
"max_response": { "max": { "field": "response_time_ms" } },
|
|
313
|
+
"min_response": { "min": { "field": "response_time_ms" } },
|
|
314
|
+
"sum_bytes": { "sum": { "field": "bytes_transferred" } },
|
|
315
|
+
"request_count": { "value_count": { "field": "request_id" } },
|
|
316
|
+
"unique_users": { "cardinality": { "field": "user_id" } },
|
|
317
|
+
"response_stats": { "stats": { "field": "response_time_ms" } },
|
|
318
|
+
"percentiles": {
|
|
319
|
+
"percentiles": {
|
|
320
|
+
"field": "response_time_ms",
|
|
321
|
+
"percents": [50, 90, 95, 99]
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Nested Aggregations
|
|
329
|
+
|
|
330
|
+
```json
|
|
331
|
+
{
|
|
332
|
+
"size": 0,
|
|
333
|
+
"aggs": {
|
|
334
|
+
"by_service": {
|
|
335
|
+
"terms": { "field": "service.keyword" },
|
|
336
|
+
"aggs": {
|
|
337
|
+
"by_status": {
|
|
338
|
+
"terms": { "field": "status.keyword" },
|
|
339
|
+
"aggs": {
|
|
340
|
+
"avg_duration": { "avg": { "field": "duration_ms" } }
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
"error_rate": {
|
|
344
|
+
"filter": { "term": { "status": "error" } },
|
|
345
|
+
"aggs": {
|
|
346
|
+
"count": { "value_count": { "field": "_id" } }
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Pipeline Aggregations
|
|
356
|
+
|
|
357
|
+
```json
|
|
358
|
+
{
|
|
359
|
+
"size": 0,
|
|
360
|
+
"aggs": {
|
|
361
|
+
"by_hour": {
|
|
362
|
+
"date_histogram": {
|
|
363
|
+
"field": "@timestamp",
|
|
364
|
+
"fixed_interval": "1h"
|
|
365
|
+
},
|
|
366
|
+
"aggs": {
|
|
367
|
+
"avg_latency": { "avg": { "field": "latency_ms" } },
|
|
368
|
+
"latency_diff": {
|
|
369
|
+
"derivative": { "buckets_path": "avg_latency" }
|
|
370
|
+
},
|
|
371
|
+
"moving_avg_latency": {
|
|
372
|
+
"moving_avg": {
|
|
373
|
+
"buckets_path": "avg_latency",
|
|
374
|
+
"window": 5
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## Pagination
|
|
386
|
+
|
|
387
|
+
### Standard Pagination
|
|
388
|
+
|
|
389
|
+
```json
|
|
390
|
+
{
|
|
391
|
+
"from": 0,
|
|
392
|
+
"size": 20,
|
|
393
|
+
"query": { ... }
|
|
394
|
+
}
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
**Limit:** `from + size` ≤ 10,000 by default.
|
|
398
|
+
|
|
399
|
+
### Search After (Deep Pagination)
|
|
400
|
+
|
|
401
|
+
```json
|
|
402
|
+
{
|
|
403
|
+
"size": 20,
|
|
404
|
+
"sort": [
|
|
405
|
+
{ "@timestamp": "desc" },
|
|
406
|
+
{ "_id": "asc" }
|
|
407
|
+
],
|
|
408
|
+
"search_after": ["2024-01-20T00:00:00.000Z", "doc123"],
|
|
409
|
+
"query": { ... }
|
|
410
|
+
}
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### Scroll API (Bulk Export)
|
|
414
|
+
|
|
415
|
+
```bash
|
|
416
|
+
# Initial request
|
|
417
|
+
POST /logs/_search?scroll=5m
|
|
418
|
+
{
|
|
419
|
+
"size": 1000,
|
|
420
|
+
"query": { "match_all": {} }
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
# Continue with scroll_id
|
|
424
|
+
POST /_search/scroll
|
|
425
|
+
{
|
|
426
|
+
"scroll": "5m",
|
|
427
|
+
"scroll_id": "<scroll_id>"
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
# Clear scroll
|
|
431
|
+
DELETE /_search/scroll
|
|
432
|
+
{
|
|
433
|
+
"scroll_id": ["<scroll_id>"]
|
|
434
|
+
}
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
### Point in Time (PIT)
|
|
438
|
+
|
|
439
|
+
```bash
|
|
440
|
+
# Create PIT
|
|
441
|
+
POST /logs/_pit?keep_alive=5m
|
|
442
|
+
|
|
443
|
+
# Search with PIT
|
|
444
|
+
POST /_search
|
|
445
|
+
{
|
|
446
|
+
"pit": {
|
|
447
|
+
"id": "<pit_id>",
|
|
448
|
+
"keep_alive": "5m"
|
|
449
|
+
},
|
|
450
|
+
"size": 100,
|
|
451
|
+
"query": { ... },
|
|
452
|
+
"search_after": [...]
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
# Delete PIT
|
|
456
|
+
DELETE /_pit
|
|
457
|
+
{
|
|
458
|
+
"id": "<pit_id>"
|
|
459
|
+
}
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
---
|
|
463
|
+
|
|
464
|
+
## Scoring & Relevance
|
|
465
|
+
|
|
466
|
+
### Function Score
|
|
467
|
+
|
|
468
|
+
```json
|
|
469
|
+
{
|
|
470
|
+
"query": {
|
|
471
|
+
"function_score": {
|
|
472
|
+
"query": { "match": { "title": "kubernetes" } },
|
|
473
|
+
"functions": [
|
|
474
|
+
{
|
|
475
|
+
"filter": { "term": { "featured": true } },
|
|
476
|
+
"weight": 2
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
"field_value_factor": {
|
|
480
|
+
"field": "popularity",
|
|
481
|
+
"factor": 1.2,
|
|
482
|
+
"modifier": "sqrt",
|
|
483
|
+
"missing": 1
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
"gauss": {
|
|
488
|
+
"publish_date": {
|
|
489
|
+
"origin": "now",
|
|
490
|
+
"scale": "7d",
|
|
491
|
+
"decay": 0.5
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
],
|
|
496
|
+
"score_mode": "multiply",
|
|
497
|
+
"boost_mode": "multiply"
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
### Explain Query
|
|
504
|
+
|
|
505
|
+
```json
|
|
506
|
+
POST /index/_explain/doc_id
|
|
507
|
+
{
|
|
508
|
+
"query": {
|
|
509
|
+
"match": { "title": "kubernetes" }
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
---
|
|
515
|
+
|
|
516
|
+
## SQL Plugin
|
|
517
|
+
|
|
518
|
+
```json
|
|
519
|
+
POST /_plugins/_sql
|
|
520
|
+
{
|
|
521
|
+
"query": "SELECT service, COUNT(*) as count, AVG(response_time_ms) as avg_response FROM logs WHERE status = 'error' AND @timestamp > NOW() - INTERVAL 1 HOUR GROUP BY service ORDER BY count DESC LIMIT 10"
|
|
522
|
+
}
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
### SQL to DSL Translation
|
|
526
|
+
|
|
527
|
+
```json
|
|
528
|
+
POST /_plugins/_sql/_explain
|
|
529
|
+
{
|
|
530
|
+
"query": "SELECT * FROM logs WHERE status = 'error'"
|
|
531
|
+
}
|
|
532
|
+
```
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Script: configure_mcp.py
|
|
4
|
+
Purpose: Configure the OpenSearch MCP server for the current environment
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
python configure_mcp.py [--url URL] [--username USER] [--password PASS] [--config-path PATH]
|
|
8
|
+
|
|
9
|
+
Arguments:
|
|
10
|
+
--url OpenSearch URL (default: https://localhost:9200)
|
|
11
|
+
--username OpenSearch username (default: admin)
|
|
12
|
+
--password OpenSearch password (from env OPENSEARCH_PASSWORD if not specified)
|
|
13
|
+
--config-path Path to MCP config file (auto-detected if not specified)
|
|
14
|
+
|
|
15
|
+
Exit Codes:
|
|
16
|
+
0 - Success
|
|
17
|
+
1 - Invalid arguments
|
|
18
|
+
2 - Config file not found
|
|
19
|
+
3 - JSON parse error
|
|
20
|
+
4 - Write error
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
import argparse
|
|
24
|
+
import json
|
|
25
|
+
import os
|
|
26
|
+
import sys
|
|
27
|
+
from pathlib import Path
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def get_default_config_path() -> Path:
|
|
31
|
+
"""Get the default MCP configuration path based on the environment."""
|
|
32
|
+
home = Path.home()
|
|
33
|
+
|
|
34
|
+
candidates = [
|
|
35
|
+
home / ".gemini" / "settings.json",
|
|
36
|
+
home / ".kiro" / "settings" / "mcp.json",
|
|
37
|
+
home / ".cursor" / "mcp.json",
|
|
38
|
+
home / ".vscode" / "mcp.json",
|
|
39
|
+
home / ".config" / "mcp" / "settings.json",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
for path in candidates:
|
|
43
|
+
if path.exists():
|
|
44
|
+
return path
|
|
45
|
+
|
|
46
|
+
return home / ".gemini" / "settings.json"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def create_opensearch_mcp_config(url: str, username: str, password: str) -> dict:
|
|
50
|
+
"""Create the OpenSearch MCP server configuration."""
|
|
51
|
+
return {
|
|
52
|
+
"opensearch-mcp": {
|
|
53
|
+
"command": "npx",
|
|
54
|
+
"args": ["-y", "opensearch-mcp-server"],
|
|
55
|
+
"env": {
|
|
56
|
+
"OPENSEARCH_URL": url,
|
|
57
|
+
"OPENSEARCH_USERNAME": username,
|
|
58
|
+
"OPENSEARCH_PASSWORD": password if password else "${OPENSEARCH_PASSWORD}",
|
|
59
|
+
"OPENSEARCH_SSL_VERIFY": "false"
|
|
60
|
+
},
|
|
61
|
+
"disabled": False,
|
|
62
|
+
"autoApprove": []
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def main():
|
|
68
|
+
parser = argparse.ArgumentParser(
|
|
69
|
+
description="Configure the OpenSearch MCP server"
|
|
70
|
+
)
|
|
71
|
+
parser.add_argument(
|
|
72
|
+
"--url",
|
|
73
|
+
default="https://localhost:9200",
|
|
74
|
+
help="OpenSearch URL (default: https://localhost:9200)"
|
|
75
|
+
)
|
|
76
|
+
parser.add_argument(
|
|
77
|
+
"--username",
|
|
78
|
+
default="admin",
|
|
79
|
+
help="OpenSearch username (default: admin)"
|
|
80
|
+
)
|
|
81
|
+
parser.add_argument(
|
|
82
|
+
"--password",
|
|
83
|
+
default=os.environ.get("OPENSEARCH_PASSWORD", ""),
|
|
84
|
+
help="OpenSearch password (default: from OPENSEARCH_PASSWORD env)"
|
|
85
|
+
)
|
|
86
|
+
parser.add_argument(
|
|
87
|
+
"--config-path",
|
|
88
|
+
type=Path,
|
|
89
|
+
help="Path to MCP config file (auto-detected if not specified)"
|
|
90
|
+
)
|
|
91
|
+
parser.add_argument(
|
|
92
|
+
"--dry-run",
|
|
93
|
+
action="store_true",
|
|
94
|
+
help="Print configuration without writing"
|
|
95
|
+
)
|
|
96
|
+
args = parser.parse_args()
|
|
97
|
+
|
|
98
|
+
config_path = args.config_path or get_default_config_path()
|
|
99
|
+
new_server_config = create_opensearch_mcp_config(args.url, args.username, args.password)
|
|
100
|
+
|
|
101
|
+
if args.dry_run:
|
|
102
|
+
print(f"Config path: {config_path}")
|
|
103
|
+
print("\nOpenSearch MCP Server configuration:")
|
|
104
|
+
print(json.dumps(new_server_config, indent=2))
|
|
105
|
+
sys.exit(0)
|
|
106
|
+
|
|
107
|
+
if config_path.exists():
|
|
108
|
+
try:
|
|
109
|
+
with open(config_path, 'r') as f:
|
|
110
|
+
config = json.load(f)
|
|
111
|
+
except json.JSONDecodeError as e:
|
|
112
|
+
print(json.dumps({
|
|
113
|
+
"status": "error",
|
|
114
|
+
"message": f"Failed to parse config: {e}"
|
|
115
|
+
}), file=sys.stderr)
|
|
116
|
+
sys.exit(3)
|
|
117
|
+
else:
|
|
118
|
+
config = {}
|
|
119
|
+
config_path.parent.mkdir(parents=True, exist_ok=True)
|
|
120
|
+
|
|
121
|
+
if "mcpServers" not in config:
|
|
122
|
+
config["mcpServers"] = {}
|
|
123
|
+
|
|
124
|
+
config["mcpServers"].update(new_server_config)
|
|
125
|
+
|
|
126
|
+
try:
|
|
127
|
+
with open(config_path, 'w') as f:
|
|
128
|
+
json.dump(config, f, indent=2)
|
|
129
|
+
|
|
130
|
+
print(json.dumps({
|
|
131
|
+
"status": "success",
|
|
132
|
+
"config_path": str(config_path),
|
|
133
|
+
"server": "opensearch-mcp",
|
|
134
|
+
"url": args.url,
|
|
135
|
+
"username": args.username
|
|
136
|
+
}, indent=2))
|
|
137
|
+
sys.exit(0)
|
|
138
|
+
|
|
139
|
+
except IOError as e:
|
|
140
|
+
print(json.dumps({
|
|
141
|
+
"status": "error",
|
|
142
|
+
"message": f"Failed to write config: {e}"
|
|
143
|
+
}), file=sys.stderr)
|
|
144
|
+
sys.exit(4)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
if __name__ == "__main__":
|
|
148
|
+
main()
|