aiagent/skill/embedded/builtin/query-datasource/datasources/opensearch.md
opensearchOpenSearch is queried exactly the same way as Elasticsearch, using dedicated API endpoints.
POST /api/n9e/os-indices
Authorization: Bearer <token>
Content-Type: application/json
{
"cate": "opensearch",
"datasource_id": 1
}
POST /api/n9e/os-fields
Authorization: Bearer <token>
Content-Type: application/json
{
"cate": "opensearch",
"datasource_id": 1,
"index": "logs-*"
}
POST /api/n9e/os-variable
Authorization: Bearer <token>
Content-Type: application/json
{
"cate": "opensearch",
"datasource_id": 1,
"index": "logs-*",
"query": {
"find": "terms",
"field": "service",
"query": ""
}
}
Execute _msearch through the proxy; usage is exactly the same as Elasticsearch:
POST /api/n9e/proxy/<datasource_id>/_msearch
Authorization: Bearer <token>
Content-Type: application/x-ndjson
{"search_type":"query_then_fetch","ignore_unavailable":true,"index":"logs-*"}
{"size":50,"query":{"bool":{"filter":[{"range":{"@timestamp":{"gte":"now-1h","lte":"now","format":"strict_date_optional_time"}}},{"query_string":{"query":"level:ERROR"}}]}},"sort":[{"@timestamp":{"order":"desc"}}]}
For detailed usage, see elasticsearch.md.
/os-indices, /os-fields, /os-variable (not /indices, /fields, /es-variable)_msearch) is executed through the generic proxy /proxy/<id>/, consistent with Elasticsearch