Manage Kibana Data Views (formerly "index patterns") via the Kibana REST API.
text
http://<kibana-host>/api/data_views
For Omni-Monitor: http://192.168.99.43/api/data_views
Kibana API requires kbn-xsrf: true header. For authenticated requests, use Kibana's session cookie or Basic auth.
text
GET /api/data_views
Response:
json
{
"data_views": [
{
"id": "...",
"title": "zbx-metrics-*",
"name": "Zabbix Metrics",
"timeFieldName": "@timestamp"
}
]
}
text
GET /api/data_views/{viewId}
Path Parameters:
viewId (string, required): Data view identifierResponse 200:
json
{
"data_view": {
"id": "...",
"title": "zbx-metrics-*",
"name": "Zabbix Metrics",
"timeFieldName": "@timestamp",
"fields": {...}
}
}
text
POST /api/data_views/data_view
Headers:
kbn-xsrf: true (required)Content-Type: application/jsonRequest Body:
json
{
"data_view": {
"title": "zbx-metrics-*",
"name": "Zabbix Metrics",
"timeFieldName": "@timestamp",
"allowNoIndex": true
}
}
Response 200: Returns created data_view object
Response 400: Bad request (e.g., duplicate title)
text
PUT /api/data_views/{viewId}
Path Parameters:
viewId (string, required): Data view identifierRequest Body:
json
{
"data_view": {
"title": "zbx-metrics-*",
"name": "Zabbix Metrics Updated",
"timeFieldName": "@timestamp"
}
}
text
DELETE /api/data_views/{viewId}
Headers:
kbn-xsrf: true (required)Response 204: Successfully deleted
Response 404: Data view not found
text
GET /api/data_views
Then search results for matching title.
text
POST /api/data_views/validate
Check if indices exist without creating a data view.
TitleDescriptionzbx-metrics-*Zabbix CPU/Memory/Disk metricszbx-hosts-*Zabbix hostszbx-problems-*Zabbix problemszbx-triggers-*Zabbix triggersk8s-pod-logs-*K8s pod logsk8s-audit-logs-*K8s audit logsvm-system-logs-*VM system logsingress-nginx-logs-*Ingress nginx logs*-logs-*All logs
When accessing Kibana API from external tool, you may need to proxy through Kibana:
text
http://192.168.99.43/api/console/proxy?path=<encoded-path>&method=<GET|POST|PUT|DELETE>
Example - List data views via proxy:
text
GET http://192.168.99.43/api/console/proxy?path=%2Fapi%2Fdata_views&method=GET
If Lens fails with error Cannot read properties of undefined (reading 'indexpattern'):
bash
curl -s "http://192.168.99.43/api/data_views" \
-H "kbn-xsrf: true"
indexpattern-datasource-layer-<uuid> referencesbash
curl -X POST "http://192.168.99.43/api/data_views/data_view" \
-H "kbn-xsrf: true" \
-H "Content-Type: application/json" \
-d '{
"data_view": {
"title": "zbx-metrics-*",
"name": "Zabbix Metrics",
"timeFieldName": "@timestamp",
"allowNoIndex": true
}
}'
bash
# Query from within k8s cluster
kubectl exec -n elastic elasticsearch-0 -- curl -s -u 'elastic:Changeme123' \
'http://localhost:9200/.kibana/_search?size=100' \
-H 'Content-Type: application/json' \
-d '{"query": {"prefix": {"type": "index-pattern"}}}'
ScriptPurposelist_data_views.pyList all data views from Kibanacreate_data_view.pyCreate a new data viewdelete_data_view.pyDelete a data viewcheck_and_fix_data_views.pyDiagnose and fix missing data views