Skip to content

chore: composable index template default + document DECIMAL mapping (#36) - #58

Merged
y-ken merged 1 commit into
masterfrom
chore/default-composable-template
Jun 17, 2026
Merged

chore: composable index template default + document DECIMAL mapping (#36)#58
y-ken merged 1 commit into
masterfrom
chore/default-composable-template

Conversation

@y-ken

@y-ken y-ken commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Summary

Two small, related follow-ups to the index-template feature (#57, still unreleased):

1. Default use_legacy_template to false (composable)

New users starting today should get the modern composable _index_template
API (ES ≥ 7.8) rather than the deprecated legacy _template. Since #57 is not
yet released, no shipped version is affected by the default change.

  • use_legacy_template false (default) → PUT /_index_template (ES ≥ 7.8)
  • use_legacy_template truePUT /_template (legacy, ES 6.x+)

The "skipped on ES < 7.8" warning now tells the user to set
use_legacy_template true for older Elasticsearch. (Param names still mirror
fluent-plugin-elasticsearch; only the default differs.)

2. Document DECIMAL → numeric mapping (#36)

Answers "why is decimal sent as text?": not a type-inference issue — it's
that BigDecimal can't cross Fluentd's msgpack buffer (the original #3 fix), so
it is stringified (which also preserves exact precision). The README now explains
that to index decimals as numbers you map the field as double/scaled_float in
a template, and Elasticsearch's coerce converts the numeric string at index
time
— so no value conversion (and no precision loss) is needed in the plugin.

This resolves the remaining half of #36 (the geo_point half was handled by #57).

Tests

Reworked the template unit tests for the new default (composable install by
default; legacy install when explicitly enabled; skip on ES < 7.8; skip when the
template exists). 24 tests, 0 failures locally on Ruby 3.4.

Follow-up

🤖 Generated with Claude Code

…pping

Flip use_legacy_template default from true to false so new users get the
modern composable _index_template API (ES >= 7.8). #57 is still unreleased,
so no shipped version is affected by the default change. The "skipped on
ES < 7.8" warning now hints at setting 'use_legacy_template true'.

Also document (#36) that DECIMAL columns are sent to Elasticsearch as strings
-- BigDecimal cannot cross Fluentd's msgpack buffer, so it is stringified,
which also preserves exact precision -- and should be mapped as double or
scaled_float in a template, where Elasticsearch's coerce converts the numeric
string to a number at index time. No value conversion is needed in the plugin.

Update the README examples to the composable template format and the unit
tests to the new default.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@y-ken
y-ken merged commit 5acd577 into master Jun 17, 2026
9 checks passed
@y-ken
y-ken deleted the chore/default-composable-template branch June 17, 2026 00:42
@y-ken y-ken mentioned this pull request Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant