Summary
elastic sanitize index-name lowercases and strips whitespace, but leaves characters that Elasticsearch rejects in index names (e.g. !). The current --help description ("Sanitize an Elasticsearch index or alias name") implies the output is always a valid index name.
Reproducer
$ elastic version
{"version": "0.1.1"}
$ elastic sanitize index-name 'Foo Bar!'
# changes: lowercased, stripped whitespace
foobar!
$ elastic sanitize index-name 'My/Bad:Name*'
# changes: lowercased, stripped forbidden characters
mybadname
The first case still contains !, which Elasticsearch rejects in index names. The second case correctly strips forbidden characters.
Expected behavior
Either:
- Strip every character that Elasticsearch's index-name validator rejects, so the output is always a valid identifier, or
- Document the limited guarantee in
--help and the stderr "changes" line (e.g. "removes characters known to be invalid; full validation still required").
Environment
elastic v0.1.1 (Homebrew on macOS, Darwin 25.5.0)
Summary
elastic sanitize index-namelowercases and strips whitespace, but leaves characters that Elasticsearch rejects in index names (e.g.!). The current--helpdescription ("Sanitize an Elasticsearch index or alias name") implies the output is always a valid index name.Reproducer
The first case still contains
!, which Elasticsearch rejects in index names. The second case correctly strips forbidden characters.Expected behavior
Either:
--helpand the stderr "changes" line (e.g. "removes characters known to be invalid; full validation still required").Environment
elasticv0.1.1 (Homebrew on macOS, Darwin 25.5.0)