Skip to content

fix(api): field_caps resolves real glob wildcards, not just bare */_all - #10

Merged
xerj-team merged 1 commit into
xerj-org:mainfrom
Vinz2168:fix/field-caps-wildcard-resolution
Jul 24, 2026
Merged

fix(api): field_caps resolves real glob wildcards, not just bare */_all#10
xerj-team merged 1 commit into
xerj-org:mainfrom
Vinz2168:fix/field-caps-wildcard-resolution

Conversation

@Vinz2168

Copy link
Copy Markdown
Collaborator

field_caps had its own inline index-resolution logic that only special-cased the literal wildcards * and _all (all indices). Any other wildcard pattern (e.g. wiki-test*) fell through to resolve_alias(n.trim()), which looks up an exact alias name — so a real glob pattern was treated as a literal, nonexistent index/alias name and silently returned empty field caps.

Why this matters: this is the root cause of Kibana's (and likely OpenSearch Dashboards') index pattern / data view creation failing with wildcarded patterns — the UI's field-discovery call against a pattern like wiki-test* comes back with "fields": {} even though the underlying indices exist and match.

Repro (clean A/B):

GET /wiki-test/_field_caps   -> all fields returned correctly
GET /wiki-test*/_field_caps  -> "indices": ["wiki-test*"] (literally unresolved), "fields": {}

Fix: delegate to resolve_index_selector(), the same glob-aware resolver (via glob_match_simple) already used by bulk/aliases/delete-by-query elsewhere in this file — no new logic, just reusing what already works correctly there.

Tested: cargo build --release -p xerj-api clean, verified via curl that wildcarded _field_caps now returns real fields instead of an empty object.

…all"

field_caps had its own inline index-resolution logic that only
special-cased the literal wildcards "*" and "_all" (all indices).
Any other wildcard pattern (e.g. "wiki-test*") fell through to
resolve_alias(n.trim()), which looks up an exact alias name — so a
real glob pattern was treated as a literal, nonexistent index/alias
name and silently returned empty field caps.

This is the root cause of Kibana's (and OpenSearch Dashboards') index
pattern / data view creation failing with wildcarded patterns: the
UI's field-discovery call against */"pattern*" comes back with
"fields": {} even though the underlying indices exist and match.

Confirmed with a clean A/B: GET /wiki-test/_field_caps returns all
fields correctly; GET /wiki-test*/_field_caps returned
"indices": ["wiki-test*"] (literally unresolved) and "fields": {}.

Fix: delegate to resolve_index_selector(), the same glob-aware
resolver already used by bulk/aliases/delete-by-query elsewhere in
this file (via glob_match_simple) — no new logic, just reusing what
already works correctly.
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.

2 participants