API Reference
API Base URL
Section titled “API Base URL”| Environment | URL |
|---|---|
| Local | http://localhost:9200 |
| Production | https://analyticsapi.logrite.ai |
| Dashboards | http://localhost:5601 |
1. Core OpenSearch APIs
Section titled “1. Core OpenSearch APIs”Cluster & Health
Section titled “Cluster & Health”| Endpoint | Method | Purpose |
|---|---|---|
/_cluster/health | GET | Cluster health status (green/yellow/red) |
/_cluster/stats | GET | Cluster-wide statistics |
/_cat/plugins | GET | List installed plugins |
/_cat/indices | GET | List all indexes |
/_cat/nodes | GET | List cluster nodes |
/_nodes/stats | GET | Node statistics |
Index Management
Section titled “Index Management”| Endpoint | Method | Purpose |
|---|---|---|
/{index} | PUT | Create index with mappings |
/{index} | DELETE | Delete index |
/{index}/_settings | GET/PUT | Get/update index settings |
/{index}/_mapping | GET/PUT | Get/update mappings |
/{index}/_count | GET | Document count |
/{index}/_refresh | POST | Force refresh for immediate search |
Search
Section titled “Search”| Endpoint | Method | Purpose |
|---|---|---|
/{index}/_search | GET/POST | Search (supports neural, hybrid, knn) |
/_search | GET/POST | Search across all indexes |
/_msearch | POST | Multi-search in one request |
Document Operations
Section titled “Document Operations”| Endpoint | Method | Purpose |
|---|---|---|
/{index}/_doc/{id} | PUT/POST | Index a document |
/{index}/_doc/{id} | GET | Retrieve document |
/{index}/_doc/{id} | DELETE | Delete document |
/_bulk | POST | Bulk index/update/delete |
2. Anomaly Detection APIs
Section titled “2. Anomaly Detection APIs”| Endpoint | Method | Purpose |
|---|---|---|
/_plugins/_anomaly_detection/detectors | POST | Create detector |
/_plugins/_anomaly_detection/detectors/_search | POST | List detectors |
/_plugins/_anomaly_detection/detectors/{id} | GET/PUT/DELETE | Manage detector |
/_plugins/_anomaly_detection/detectors/{id}/_start | POST | Start real-time detection |
/_plugins/_anomaly_detection/detectors/{id}/_stop | POST | Stop detection |
/_plugins/_anomaly_detection/detectors/{id}/_profile | GET | Detector state/memory |
/_plugins/_anomaly_detection/detectors/results/_search | POST | Search anomaly results |
Example: Get Recent Anomalies
Section titled “Example: Get Recent Anomalies”POST /_plugins/_anomaly_detection/detectors/results/_search{ "query": { "bool": { "filter": [ { "range": { "anomaly_grade": { "gte": 0.4 } } }, { "range": { "execution_end_time": { "gte": "now-1h" } } } ] } }, "sort": [{ "execution_end_time": "desc" }], "size": 50}3. ML Commons APIs
Section titled “3. ML Commons APIs”| Endpoint | Method | Purpose |
|---|---|---|
/_plugins/_ml/models/_register | POST | Register a model |
/_plugins/_ml/models/{id}/_deploy | POST | Deploy model |
/_plugins/_ml/models/{id}/_predict | POST | Generate embeddings |
/_plugins/_ml/models/_search | GET/POST | List models |
/_plugins/_ml/model_groups/_register | POST | Register model group |
Example: Generate Text Embedding
Section titled “Example: Generate Text Embedding”POST /_plugins/_ml/models/{model_id}/_predict{ "text_docs": ["payment timeout error in Stripe webhook"], "return_number": true, "target_response": ["sentence_embedding"]}4. Neural Search APIs
Section titled “4. Neural Search APIs”| Endpoint | Method | Purpose |
|---|---|---|
/_plugins/_neural/stats | GET | Neural search statistics |
/_plugins/_neural/warmup/{indexes} | POST | Load indexes into memory |
Example: Neural Search Query
Section titled “Example: Neural Search Query”POST /payment_queries_semantic/_search{ "query": { "neural": { "text_embedding": { "query_text": "payment timeout errors", "model_id": "vZ_rRJsB11WWRaeQeT1C", "k": 10 } } }}5. Alerting APIs
Section titled “5. Alerting APIs”| Endpoint | Method | Purpose |
|---|---|---|
/_plugins/_alerting/monitors | POST | Create monitor |
/_plugins/_alerting/monitors/_search | POST | List monitors |
/_plugins/_alerting/monitors/{id} | GET/PUT/DELETE | Manage monitor |
/_plugins/_alerting/monitors/{id}/_execute | POST | Execute manually |
/.opendistro-alerting-alerts/_search | POST | Alert history |
6. Notifications APIs
Section titled “6. Notifications APIs”| Endpoint | Method | Purpose |
|---|---|---|
/_plugins/_notifications/configs | POST | Create notification channel |
/_plugins/_notifications/configs | GET | List channels |
/_plugins/_notifications/send | POST | Send notification |
7. OpenSearch Dashboards APIs (Port 5601)
Section titled “7. OpenSearch Dashboards APIs (Port 5601)”| Endpoint | Method | Purpose |
|---|---|---|
/api/saved_objects/{type}/{id} | GET/POST/PUT/DELETE | Manage saved objects |
/api/saved_objects/_find | GET | Search saved objects |
/api/saved_objects/_export | POST | Export objects (NDJSON) |
/api/saved_objects/_import | POST | Import objects |
/api/status | GET | Dashboards server status |
Saved Object Types: dashboard, visualization, index-pattern, search, lens
API Summary
Section titled “API Summary”| Category | Base Path | Total APIs |
|---|---|---|
| Core OpenSearch | / | ~40+ |
| Anomaly Detection | /_plugins/_anomaly_detection/ | ~15 |
| ML Commons | /_plugins/_ml/ | ~45+ |
| Neural Search | /_plugins/_neural/ | ~6 |
| k-NN | /_plugins/_knn/ | ~8 |
| Alerting | /_plugins/_alerting/ | ~12 |
| Notifications | /_plugins/_notifications/ | ~8 |
| Dashboards | /api/ (port 5601) | ~15+ |
Total: 150+ REST APIs