Repository navigation
fix(es-compat): shared index-selector resolver + migrate the get_index->first read endpoints (#451 class B) - #555
Conversation
… alias only sees the first member
Failing repro (WIP): a 2-member alias 'tri' with id 1 in idx-a and id 2 in idx-b;
POST /tri/_mget {docs:[{_id:1},{_id:2}]} returns id 1 found:true but id 2 found:false —
mget_index resolves each entry via Engine::get_index, which collapses an alias to
aliased.first() (es_compat.rs:18406). Read-side twin of #450.
NOTE: #451 class A (resolve_indices_for_op 404ing on aliases for _refresh/_close/etc.)
is ALREADY fixed on main — that resolver now has an alias branch. Remaining: class B
(get_index->first on _mget/_explain/_flush/...) and class C (alias filters ignored on
msearch/scroll). The proper fix is one shared (concrete_indices, alias_filters) resolver
every site calls, per the issue — not a per-site branch; this test is what it must satisfy.
…class B, WIP) Adds resolve_selector_with_filters(state, spec) -> (Vec<(name, Arc<Index>)>, Vec<filter>): the single resolver #451 asks for (an alias expands to every member, #433; carries alias filters like resolve_by_query_targets on the write path, #450). Migrates _mget: each entry now searches every alias member for the id and reports the concrete member in _index, so a doc in a non-first member is found. Repro mget_through_alias_sees_every_member now passes under 1.98.0 (was found:false for id 2). WIP — remaining class-B sites (_explain/_segments/_cat-segments/_eql/_async_search/_flush) migrate onto the same resolver, then per-site get_index copies deleted, before the PR opens.
…class B) _explain used Engine::get_index -> aliased.first(), so explaining a doc that lives in a non-first alias member returned matched:false / 'document not found'. Now resolves via resolve_selector_with_filters, finds the member that actually holds the doc, and explains against it (reporting the concrete member in _index). Fail-before: doc 2 in idx-b through alias tri -> matched:false; now matched:true. Repro test added. Second class-B site migrated (after _mget); remaining: _segments/_cat-segments/_eql/ _async_search, then the class-C filter sites, before the PR opens.
…451 class B) _cat/segments listed only [index] and resolved it via get_index -> aliased.first(), so a multi-index alias showed one row under the alias name (first member's stats) and a glob matched nothing. Now resolves via resolve_selector_with_filters, listing a row per concrete member and handling _all/glob/comma uniformly. Fail-before: alias tri -> one 'tri' row; now one row each for idx-a and idx-b. Repro test added. Third class-B site migrated (_mget, _explain, _cat/segments). Remaining: verify _eql/_async_search actually need it (they may delegate to search_impl), then class-C.
…class B)
GET /{index}/_segments used get_index -> aliased.first(), returning one 'indices'
entry under the alias name (first member's segments). Now resolves via
resolve_selector_with_filters and emits one indices entry per concrete member,
with _shards counting one shard per member. Fail-before: alias tri -> {tri:...};
now {idx-a:..., idx-b:...}. Repro test added.
Fourth class-B site migrated (_mget, _explain, _cat/segments, _segments).
cargo fmt wrapped a method chain in mget_through_alias_sees_every_member.rs that exceeded the line width. No behavior change.
Independent 3-skeptic verification (each REFUTES, own worktree, rustc 1.98.0)Verdict: 0 BLOCKING — all three refuted=false / severity=none. correctness (none): regression-risk (none): Full evidence-holds (none): Empirically confirmed the fail-before — reverting Gate: (a) all checks green, none pending; (b) 0 BLOCKING; (c) CLEAN. Merging. |
Newest tag is now v1.0.0-rc.25 (includes xerj-org#555 fix xerj-org#451 class-B alias fan-out + xerj-org#556 fix xerj-org#553 filtered-alias over-delete safety lock). Footer XERJ.AI stamps + llms*.txt 'Current release' bumped rc.24 -> rc.25 across landing/ (48 files). landing-constants-guard passes with VERSION=1.0.0-rc.25.
Advances #451 (does not close it — see Scope). Introduces the single selector resolver the issue asks for and migrates the trivially-mergeable class-B read endpoints onto it, deleting their per-site
get_indexcopies.The defect (class B)
Several read endpoints resolved the path index with
Engine::get_index, which collapses an alias toaliased.first()— one member. So over a multi-index alias they silently answered from the first member only: a doc in another member was invisible.The shape (what the issue asked for)
resolve_selector_with_filters(state, spec) -> (Vec<(name, Arc<Index>)>, Vec<alias_filter>)— one resolver that expands_all/*/glob/alias/comma uniformly (viaresolve_index_selector, #433) and carries any alias filter (mirroringsearch_impl, asresolve_by_query_targetsdoes on the write path, #450). Every migrated site calls it; the per-siteget_indexis gone.Migrated this PR (each with a fail-before→pass repro test)
_mget— a doc in a non-first member reportedfound:false; now searches every member._explain— a non-first member's doc reportedmatched:false/"document not found"; now explains against the member that holds it, reporting the concrete member in_index._cat/segments— an alias showed one row under the alias name (and globs matched nothing); now one row per member._segments(/{index}/_segments) — oneindicesentry under the alias name; now one entry per member.Scope / tracked follow-up (why #451 stays open)
eql_search— alsoget_index→first, but fanning it out needs proper search-result merging (sort + size across members), not per-member iteration; a naive concat would mis-order EQL events. Wants a decision on routing it through the shared multi-index search path.msearch/search_with_scroll/msearch_template/_cat/count) — the resolver now returns the filters; wiring them in is a separate change.async_search_submitis already alias-safe (delegates tosearch_impl).Verification (rustc 1.98.0)
Full
xerj-apisuite 469 passed, 0 failed;fmt --check,clippy --workspace --all-targets -D warnings,build --profile ci-testall clean.