kubectl and the Elasticsearch REST API.
This page shows you how to list indices, check their health, delete indices that you no longer need, and set the retention period that deletes old indices automatically.
The
elasticsearch.<base-domain> endpoint doesn’t work for these tasks. The NGINX proxy in front of Elasticsearch allows only the _search, _count, _bulk, _cluster/health, and _cluster/state/version paths, and it rewrites the first three so that each caller reads only its own indices. The proxy denies every other path, including _cat and index deletion. Run the commands in this document from inside the cluster.Prerequisites
kubectlaccess to the namespace where you installed the APC platform.- The name of your platform release. Run
helm ls -Ato find it.
Connect to the Elasticsearch API
Each Elasticsearch client Pod serves the REST API on port 9200.kubectl exec runs the request inside the Pod, so the network policy that protects Elasticsearch doesn’t block it.
-
Set the namespace and find a client Pod:
-
Confirm that the API answers:
The response includes the cluster name and the Elasticsearch version.
Index names
Vector creates one index for each Deployment for each day. The index name has three parts:fluentd.spacious-orbit-4832.2026.02.14.
The prefix depends on your logging configuration:
List indices and check their health
List every index with its health, document count, and size on disk:green when all of its shards are assigned, yellow when a replica shard is unassigned, and red when a primary shard is missing. A red index can’t serve all of its logs.
To list only the indices that need attention, filter on health:
Delete an index
Delete one index by name:{"acknowledged":true}.
Delete several indices
Elasticsearch 8 setsaction.destructive_requires_name to true, and APC keeps that default. A wildcard such as fluentd.* therefore fails with Wildcard expressions or all indices are not allowed. Name each index that you want to delete.
-
Review the names first. A
GETrequest accepts a wildcard, so you can list the candidates: -
Delete the reviewed names in one request, separated by commas:
Verify the result
After a delete, check the health of the cluster:status is green when every shard is assigned, and unassigned_shards is 0. List the indices again to confirm that the deleted ones are gone.
Delete old indices automatically
APC runs an Elasticsearch curator CronJob named<your-platform-release-name>-elasticsearch-curator. By default it runs at 01:00 every day and deletes indices that are more than 10 days old. Curator reads the date from the index name, so it only deletes indices that follow the <prefix>.<deployment-release-name>.<YYYY.MM.DD> pattern.
To change the retention period, set the following values in your values.yaml file: