Filebeat Error: 'dataset ... has no template' — Cause, Fix, and Troubleshooting Guide
Fix Filebeat 'dataset ... has no template': load the correct index template or data stream so events for the dataset index instead of being rejected.
- #filebeat
- #logging
- #troubleshooting
- #errors
Fixing errors like this? Get 500 free DevOps AI prompts
500 copy-paste AI prompts for the stack you actually run — one PDF, free.
Overview
When Filebeat writes to a target that has no matching index template — often a custom index name, a module dataset whose template was never loaded, or a data stream that does not exist — Elasticsearch cannot apply the expected mappings and the write is rejected:
Failed to publish events caused by: dataset [nginx.error] has no template; the index template for the data stream may not have been installed. Run 'filebeat setup' or reload the template.
Filebeat (and Elastic Agent style integrations) resolve events to a type-dataset-namespace data stream. If the backing index template for that dataset was never installed, Elasticsearch has no mappings/settings to create the stream and refuses the bulk items. Nothing indexes for that dataset until the template is present.
Symptoms
has no templatein the publish error, naming a specific dataset likenginx.error.- Only some datasets fail — the ones whose module/integration template was not loaded.
filebeat setupwas skipped, or run against a different cluster than the output points at.GET _index_template/<name>returns 404 for the expected template.
Common Root Causes
filebeat setupnever ran against the target cluster, so templates were not installed.- Module template missing — a module was enabled after setup, so its dataset template is absent.
setup.template.enabled: falsewith no template loaded out of band.- Wrong cluster — setup ran against a dev cluster but the output ships to prod.
- Custom
index:name that no template pattern matches.
How to diagnose
Check whether the template for the dataset exists:
curl -sk 'https://es01:9200/_index_template?pretty' -u elastic:$ES_PASS | \
grep -i 'filebeat\|nginx'
curl -sk 'https://es01:9200/_index_template/filebeat?pretty' -u elastic:$ES_PASS
Confirm which output cluster Filebeat targets and which modules are enabled:
grep -A5 'output.elasticsearch' /etc/filebeat/filebeat.yml
filebeat modules list
Fixes
Run setup against the cluster the output points at to install templates and pipelines:
filebeat setup --index-management -e \
-E 'output.elasticsearch.hosts=["https://es01:9200"]' \
-E 'output.elasticsearch.username=elastic' \
-E 'output.elasticsearch.password=${ES_PASS}'
If a module was enabled after setup, re-run setup so its dataset template loads:
filebeat modules enable nginx
filebeat setup --index-management
systemctl restart filebeat
For a custom index:, make sure a template pattern matches it, or point back at the managed data stream:
output.elasticsearch:
hosts: ["https://es01:9200"]
# index: "custom-%{[agent.version]}" # only if a matching template exists
setup.template.name: "filebeat"
setup.template.pattern: "filebeat-*"
What to watch out for
filebeat setupmust run against the same cluster the output writes to.- Enabling a module later requires re-running setup for its template.
- If you disable
setup.template.enabled, you own installing the template yourself. - Custom index names need a custom template pattern, or writes will hit this error.
Related
- Filebeat Error Guide: ‘could not load index template’
- Filebeat Error Guide: ‘ILM policy not found’
- Filebeat Error: ‘Filebeat is unable to load the ingest pipelines’
Get 500 Battle-Tested DevOps AI Prompts — Free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.