Skip to content

fix(outputs.elasticsearch): Only update index template if necessary - #19947

Merged
skartikey merged 2 commits into
influxdata:masterfrom
srebhan:elasticsearch_cleanup_1
Oct 28, 2026
Merged

skartikey merged 2 commits into
influxdata:masterfrom
srebhan:elasticsearch_cleanup_1

Conversation

@srebhan

@srebhan srebhan commented Oct 20, 2026

Copy link
Copy Markdown
Member

Summary

In the current code, the plugin will always update index templates if manage_template is true even if the template already exists and overwrite_template is false. This is due to the fact that the templatePattern cannot never be empty when reaching the check as we error out if there is no static prefix.

This PR fixes the behavior to respect overwrite_template and implements the documented (and expected) behavior.

Checklist

Related issues

@telegraf-tiger telegraf-tiger Bot added area/elasticsearch fix pr to fix corresponding bug plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins labels Oct 20, 2026
@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Oct 20, 2026

@skartikey skartikey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srebhan nice catch. Left one question on the changelog note since this changes nine years of observed behaviour.

@srebhan
srebhan requested a review from skartikey October 27, 2026 12:20
@telegraf-tiger

Copy link
Copy Markdown
Contributor

Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip.
Downloads for additional architectures and packages are available below.

⚠️ This pull request increases the Telegraf binary size by 6.65 % for linux amd64 (new size: 328.7 MB, nightly size 308.2 MB)

📦 Click here to get additional PR build artifacts

Artifact URLs

. DEB . RPM . TAR . GZ . ZIP
amd64.deb aarch64.rpm darwin_amd64.tar.gz windows_amd64.zip
arm64.deb armel.rpm darwin_arm64.tar.gz windows_arm64.zip
armel.deb armv6hl.rpm freebsd_amd64.tar.gz windows_i386.zip
armhf.deb i386.rpm freebsd_armv7.tar.gz
i386.deb ppc64le.rpm freebsd_i386.tar.gz
mips.deb riscv64.rpm linux_amd64.tar.gz
mipsel.deb s390x.rpm linux_arm64.tar.gz
ppc64el.deb x86_64.rpm linux_armel.tar.gz
riscv64.deb linux_armhf.tar.gz
s390x.deb linux_i386.tar.gz
linux_mips.tar.gz
linux_mipsel.tar.gz
linux_ppc64le.tar.gz
linux_riscv64.tar.gz
linux_s390x.tar.gz

@skartikey skartikey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srebhan Thanks for the test. LGTM.

@skartikey
skartikey merged commit e4b67f9 into influxdata:master Oct 28, 2026
27 checks passed
@skartikey
skartikey deleted the elasticsearch_cleanup_1 branch October 28, 2026 18:48
@github-actions github-actions Bot added this to the v1.40.3 milestone Oct 28, 2026
srebhan added a commit that referenced this pull request Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/elasticsearch fix pr to fix corresponding bug plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants