Deleting unused Kibana data views keeps Discover, dashboards, and rule configuration screens from filling up with stale choices and reduces accidental use of an outdated index target.
A Kibana data view (formerly an index pattern) is a saved object that points to one or more Elasticsearch indices, data streams, or aliases and stores metadata such as default time field selection, runtime fields, source filters, and field formatting. Removing the data view deletes that saved object in Kibana, but does not delete indices or documents in Elasticsearch.
Deletion is irreversible and can break saved objects that reference the deleted data view id, including visualizations and saved Discover sessions. API access requires credentials with the Data View Management Kibana privilege; when targeting a non-default Kibana space, prefix the endpoint path with /s/<space_id> before /api/data_views.
Steps to delete a Kibana data view:
- List data views to locate the id.
$ curl --silent --show-error --user elastic:password --header "kbn-xsrf: true" "http://localhost:5601/api/data_views" { "data_view": [ { "id": "9f28f1c0-7b51-11ee-98e5-69b85a31d6b2", "name": "Logs", "title": "logs-*", "namespaces": [ "default" ] } ] }Use http://localhost:5601/s/<space_id>/api/data_views for a non-default space.
- Delete the data view by id.
$ curl --silent --show-error --user elastic:password --header "kbn-xsrf: true" --request DELETE "http://localhost:5601/api/data_views/data_view/9f28f1c0-7b51-11ee-98e5-69b85a31d6b2" --output /dev/null --write-out "%{http_code}\n" 204Deleting a data view cannot be undone and breaks visualizations, saved searches, and other saved objects that reference the deleted data view id.
- Verify the data view is no longer listed.
$ curl --silent --show-error --user elastic:password --header "kbn-xsrf: true" "http://localhost:5601/api/data_views" { "data_view": [] }
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
