AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.
Rust agent-memoryai-agentsbm25claude-codeclicode-searchcursordatabaseelasticsearchfull-text-searchhybrid-searchjsonllocal-firstmcpmcp-servermodel-context-protocolragrustsearch-enginevector-search
docs+test: derive the capability lists from the source, and fail the build when they drift
xerj-org1f627ba8eff6
diff --git a/ROADMAP.md b/ROADMAP.mdindex 4e64114e6..52a518461 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -9,9 +9,9 @@ Last reviewed: 2026-07-12 (against `v1.0.0-rc.3` + RC4 wave-4 `main` HEAD, live-These are implemented and exercised by real API requests / the test suite / benchmarks:- Elasticsearch REST wire compatibility (1,365 / 1,368 ES-YAML conformance cases).-- Full-text search (BM25) and the **26 publicly-documented query types** (`match_all`, `match_none`, `match`, `match_phrase`, `match_phrase_prefix`, `multi_match`, `term`, `terms`, `range`, `prefix`, `wildcard`, `exists`, `ids`, `bool`, `fuzzy`, `regexp`, `query_string`, `simple_query_string`, `constant_score`, `boosting`, `dis_max`, `geo_distance`, `knn`, `semantic`, `hybrid`) — **all 26 parse and execute correctly on the live binary.**-- **~14 additional query types execute** beyond the documented 26: `combined_fields`, `match_bool_prefix`, `terms_set`, `intervals`, `function_score`, `script_score`, `distance_feature`, `rank_feature`, `geo_bounding_box`, `geo_polygon`, `geo_shape`, `more_like_this`, `pinned`, `wrapper`. The parser dispatches ~49 distinct type keys in total; roughly 38 run without a `400`. **Honest caveat:** not every dispatched type has correct ES semantics — several are stubs (see *Partial / in progress*), so "38 supported query types" describes the dispatch surface, not 38 types that are all semantically faithful.-- **Aggregations:** the 15 publicly-documented aggregations (`terms`, `stats`, `avg`, `sum`, `min`, `max`, `value_count`, `cardinality`, `range`, `histogram`, `date_histogram`, `percentiles`, `filter`, `missing`, `composite`) **plus ~15 more that execute with correct math** — `date_range`, `extended_stats`, `percentile_ranks`, `filters`, `geo_bounds`, `geo_centroid`, `geohash_grid`, `median_absolute_deviation`, `matrix_stats`, `rare_terms`, `adjacency_matrix`, `ip_range`, `global`, `sampler`, `diversified_sampler`, `top_hits` — and the full **pipeline family** (`avg_bucket`, `sum_bucket`, `max_bucket`, `min_bucket`, `stats_bucket`, `cumulative_sum`, `derivative`, `bucket_script`, `bucket_selector`, `moving_fn`). All verified live at `size:0`. (The README under-lists these — a docs gap, not a defect.)+- Full-text search (BM25) and **50 query types**. The list is no longer maintained by hand here: it is generated from `xerj_query::parser::SUPPORTED_QUERY_TYPES`, printed in full in [engine/README.md](./engine/README.md#query-types-supported) and [llms-full.txt](https://xerj.org/llms-full.txt), and pinned to `parse_query`'s dispatch table by `parser::tests::dispatch_table_matches_capability_manifest`. Two further keys — `has_child` and `has_parent` — are recognised and **rejected with a 400**, and are listed as such in the same places (issue #211).+ **Honest caveat, unchanged:** those 50 are the *dispatch* surface — every one of them parses, plans and executes, which is not a claim that all 50 are semantically faithful to ES. The known divergences are enumerated under *Partial / in progress* below, and the ES-YAML conformance suite is the measured answer.+- **Aggregations: 62 types**, likewise generated from `xerj_engine::aggs::SUPPORTED_AGG_TYPES` and printed in [engine/README.md](./engine/README.md#aggregation-types-supported) and [llms-full.txt](https://xerj.org/llms-full.txt). This includes the full **pipeline family** (`avg_bucket`, `sum_bucket`, `min_bucket`, `max_bucket`, `stats_bucket`, `extended_stats_bucket`, `percentiles_bucket`, `derivative`, `cumulative_sum`, `serial_diff`, `moving_avg`, `moving_fn`, `bucket_script`, `bucket_selector`, `bucket_sort`), which was absent from every published list until issue #211 — a reviewer reading those lists concluded XERJ had no pipeline aggregations and nearly filed a roadmap item to build them a second time. All aggregations are exact (no HLL, no sampling). `weighted_avg` is **not** among the 62 — see *Aggregations that are stubbed or silently degrade*.- **Dense-vector kNN** (`knn` query and ES 8.x top-level `knn`): unfiltered kNN on a full-precision cosine field (≥1,024 docs) is served by a **persisted HNSW graph with exact rescoring** — measured recall@10 1.00 on the official bench query, 100-probe mean 0.976 (ES 8.13.4 same protocol: 0.937); filtered/nested kNN, non-cosine similarity, SQ8 fields, and small indexes run the exact brute-force scan (cosine mapped to `(1+cos)/2`). See "Landed since rc-2" below.- **Hybrid search** — BM25 + kNN combined in a single request via the `hybrid` **query type**: `{"query":{"hybrid":{"queries":[{"query":…,"weight":…}, …],"fusion":"rrf|linear|learned"}}}`. RRF-fused union verified live. (See *Partial* for the ES-native top-level `query`+`knn` path, which does **not** fuse.)- **Columnar storage** — the ZBS2 columnar block (per-column codec) with exactly **9 domain-aware encodings** (`BitsetEnum`, `DeltaTimestamp`, `PackedIp`, `UrlTemplate`, `Varint`, `Dictionary`, `RawString`, `Bitpacked`, `FixedPrecision`), ZSTD/LZ4 codecs, and SQ8 vector quantization — all real and wired into the segment write path.@@ -99,9 +99,9 @@ Still open (tracked, **not** closed by RC4): the RSS-runaway ingest-heap ticketCounting these toward "supported query types" overstates correctness — they resolve without a `400` but do not implement ES semantics:-- **`nested`** — returns 0 hits (no real nested-document indexing/scoring). (`percolate` and `has_child` / `has_parent` used to sit here — `percolate` is real now and the join queries fail loud; see *Stub-surface correctness flips* above.)+- **`nested`** — *matching* is real and was mis-described here until issue #211: the inner query is evaluated **per nested element** (`index.rs`, `QueryNode::Nested` → `arr.iter().any(|elem| doc_matches_query(&inner, elem))`), so a document matches only when one element satisfies the whole inner query — covered by `test_nested_query` in `xerj-engine/tests/integration.rs`. What is missing is ES's separate nested-document indexing: `score_mode` is parsed and then ignored, and `inner_hits` is not parsed at all, so neither affects the response. Those two are accepted-and-ignored inputs (#204) and should either be honoured or rejected. (`percolate` and `has_child` / `has_parent` used to sit here — `percolate` is real now and the join queries fail loud; see *Stub-surface correctness flips* above.)- **`span_term` / `span_or` / `span_not`** — return 0 hits **standalone**, even though `span_near` / `span_first` / `span_containing` using the same clauses return correct hits. Only composite span queries work.-- **`type`** — mapped to `MatchAll` (`parser.rs:330`).+- **`type`** — mapped to `MatchAll` (`parser.rs`, the `"type"` arm of `parse_query`; the line number that used to be quoted here was already stale).- **`combined_fields`** — mapped to `multi_match cross_fields`; scoring is not exact. `rank_feature` passes through on plain fields (no `rank_feature` field type).### Aggregations that are stubbed or silently degrade@@ -134,7 +134,7 @@ Counting these toward "supported query types" overstates correctness — they re### Correctness of stubbed surface-- Real join / parent-child semantics for `has_child` / `has_parent` / `nested`.+- Real join / parent-child semantics for `has_child` / `has_parent`, and nested-document indexing behind `nested` (`score_mode` / `inner_hits`).- Standalone `span_term` / `span_or` / `span_not`.- `weighted_avg` execution (and returning `400` for genuinely-unsupported aggs rather than a buried error). (`percolate`, `scripted_metric`, and `significant_terms` have shipped — see *Stub-surface correctness flips*.)- ES-native top-level `{query, knn}` fusion.diff --git a/demo/playbooks/CONSOLE_UX_REWORK.md b/demo/playbooks/CONSOLE_UX_REWORK.mdindex e2c7772c3..b09416189 100644--- a/demo/playbooks/CONSOLE_UX_REWORK.md+++ b/demo/playbooks/CONSOLE_UX_REWORK.md@@ -21,7 +21,7 @@ Two file-disjoint branches, both forked from `66bd53a` (just before the smoke coThe smoke playbook + baseline screenshots survived both 3-way merges (neither branch ever contained them). Full scoped rebuild: `cargo build --release -j 16 -p xerj-server` (exit 0). The new frontend modules are confirmed bundled in the binary (`dashboard-api.js`, `panel-query.js`, `panel-render.js` all served `200`; unique tokens `renderUserPanelChrome` / `data-builder-save` / `panelResult` present in the binary).-**What wires the fix:** `index.html` boot now runs, before app.js first paint: `GET /me` → `sync.pullAll()` → **`dashboard-store.hydrate()` (GET /dashboards)**. `dashboard-store.js` is an async facade over the new `dashboard-api.js` CRUD client; `createUserDashboard()` **POSTs** a real doc and every panel mutation **PATCHes** it. The backend seeds 13 built-in dashboards as durable `default`/`managed` rows on first launch (`.xerj_dashboards` had 14 docs on a fresh boot before any user action).+**What wires the fix:** `index.html` boot now runs, before app.js first paint: `GET /me` → `sync.pullAll()` → **`dashboard-store.hydrate()` (GET /dashboards)**. `dashboard-store.js` is an async facade over the new `dashboard-api.js` CRUD client; `createUserDashboard()` **POSTs** a real doc and every panel mutation **PATCHes** it. The backend seeds 14 built-in dashboards as durable `default`/`managed` rows on first launch (`.xerj_dashboards` holds 14 docs on a fresh boot before any user action). The count lives in one place, `xerj_console_api::seed::BUILTIN_DASHBOARD_COUNT`, and is pinned to the registry list by `seed::tests::seeds_every_registry_dashboard` — this sentence used to say 13 and 14 in the same breath (issue #211).---diff --git a/engine/README.md b/engine/README.mdindex fde49a58f..31c797e6f 100644--- a/engine/README.md+++ b/engine/README.md@@ -146,48 +146,87 @@ xerj --config /etc/xerj/xerj.toml## Query Types Supported-| Query Type | Notes |-|---|---|-| `match_all` / `match_none` | Universal matchers |-| `match` | Full-text BM25 search |-| `match_phrase` | Ordered phrase search |-| `match_phrase_prefix` | Autocomplete-style |-| `multi_match` | Search across multiple fields |-| `term` / `terms` | Exact keyword match |-| `range` | Numeric, date, keyword ranges |-| `prefix` | Prefix match on keyword fields |-| `wildcard` | `*` and `?` glob patterns |-| `regexp` | Full regex on keyword fields |-| `fuzzy` | Edit-distance fuzzy match |-| `exists` | Field presence check |-| `ids` | Match by document ID list |-| `bool` | `must`, `should`, `must_not`, `filter` |-| `query_string` | Lucene query syntax |-| `simple_query_string` | Simplified query syntax |-| `constant_score` | Wrap any query with a fixed score |-| `boosting` | Positive/negative boosting |-| `dis_max` | Disjunction max across queries |-| `geo_distance` | Filter by radius from a geo point |-| `knn` | k-Nearest neighbour vector search |-| `semantic` | Semantic search via embedding proxy |-| `hybrid` | Combine BM25 + vector scores |+Complete and machine-checked. The list is generated from+`xerj_query::parser::SUPPORTED_QUERY_TYPES`, that constant is pinned to+`parse_query`'s dispatch table by a unit test, and this file is compared+against it by `crates/xerj-engine/tests/docs_capability_lists.rs` — so a query+type cannot be added or removed without the build failing until the docs+follow.++**Acceptance is not a fidelity claim.** A type listed here parses, plans and+executes; it is not a promise that every parameter matches Elasticsearch in+every corner. Per-type gaps are tracked in [ROADMAP.md](../ROADMAP.md), and the+ES-YAML conformance suite is the measured answer.++<!-- generated:query-types -->+Full-text — `match`, `match_phrase`, `match_phrase_prefix`, `match_bool_prefix`,+`multi_match`, `combined_fields`, `query_string`, `simple_query_string`,+`intervals`, `more_like_this`++Term-level — `term`, `terms`, `terms_set`, `range`, `prefix`, `wildcard`,+`regexp`, `fuzzy`, `exists`, `ids`, `script`++Universal — `match_all`, `match_none`++Compound and scoring — `bool`, `boosting`, `constant_score`, `dis_max`,+`function_score`, `script_score`, `distance_feature`, `rank_feature`, `pinned`++Vector, semantic and hybrid — `knn`, `semantic`, `hybrid`++Geo — `geo_distance`, `geo_bounding_box`, `geo_polygon`, `geo_shape`++Span — `span_term`, `span_near`, `span_or`, `span_not`, `span_first`,+`span_containing`, `span_within`++Document structure — `nested`++Other — `percolate`, `type`, `wrapper`+<!-- /generated:query-types -->++Recognised and **deliberately rejected with a 400**:++<!-- generated:rejected-query-types -->+`has_child`, `has_parent`+<!-- /generated:rejected-query-types -->++XERJ never materialises a parent/child join, so a `has_child` that ran would+match against flat documents and return silently wrong hits. It refuses at+parse time instead, with a message that names the alternative (denormalize the+relationship). Any other query type answers `unknown query type`.## Aggregation Types Supported-| Aggregation | Type |-|---|---|-| `terms` | Bucket — group by field value |-| `range` | Bucket — group by numeric/date ranges |-| `histogram` | Bucket — fixed-width numeric intervals |-| `date_histogram` | Bucket — calendar-aware time buckets |-| `filter` | Bucket — apply a query as a filter |-| `missing` | Bucket — documents missing a field |-| `composite` | Bucket — paginate across combinations |-| `avg` / `sum` / `min` / `max` | Metric — basic statistics |-| `stats` | Metric — all basic statistics in one pass |-| `value_count` | Metric — count of non-null values |-| `cardinality` | Metric — approximate distinct count |-| `percentiles` | Metric — p50, p95, p99, etc. |+Complete and machine-checked the same way, from+`xerj_engine::aggs::SUPPORTED_AGG_TYPES`. All xerj aggregations are exact —+`cardinality` is a true distinct count, not an HLL estimate, and `terms`+`doc_count` is precise.++<!-- generated:agg-types -->+Metric — `avg`, `sum`, `min`, `max`, `stats`, `extended_stats`, `value_count`,+`cardinality`, `percentiles`, `percentile_ranks`, `median_absolute_deviation`,+`matrix_stats`, `string_stats`, `boxplot`, `top_metrics`, `top_hits`,+`scripted_metric`++Bucket — `terms`, `multi_terms`, `rare_terms`, `significant_terms`,+`significant_text`, `range`, `date_range`, `ip_range`, `ip_prefix`,+`histogram`, `variable_width_histogram`, `date_histogram`,+`auto_date_histogram`, `filter`, `filters`, `missing`, `composite`,+`adjacency_matrix`, `time_series`, `global`++Sampling — `sampler`, `random_sampler`, `diversified_sampler`++Scope — `nested`, `reverse_nested`++Geo — `geo_bounds`, `geo_centroid`, `geo_distance`, `geohash_grid`,+`geotile_grid`++Pipeline — `avg_bucket`, `sum_bucket`, `min_bucket`, `max_bucket`,+`stats_bucket`, `extended_stats_bucket`, `percentiles_bucket`, `derivative`,+`cumulative_sum`, `serial_diff`, `moving_avg`, `moving_fn`, `bucket_script`,+`bucket_selector`, `bucket_sort`+<!-- /generated:agg-types -->++Bucket aggregations take nested sub-aggregations via an inner `aggs` key.## Architecture Overview@@ -220,6 +259,16 @@ HTTP Request| `xerj-compress` | Block compression codecs (LZ4, Zstd) || `xerj-logs` | Columnar log ingestion and time-based retention || `xerj-ai` | Text chunking, embedding proxy, memory store |+| `xerj-autoindex` | `xerj autoindex` — zero-config folder onboarding; a pure ES-compat HTTP client, it does not link the engine |+| `xerj-console-api` | Console backend at `/_xerj-console/api/v1` — auth, prefs, dashboards, saved views, data sources |+| `xerj-cluster` | Embedded Raft consensus for cluster metadata, written from scratch |+| `xerj-mcp` | MCP stdio server exposing XERJ's REST surface to agent hosts as tools |+| `xerj-wasm` | Pluggable ingest-time document transform pipeline |++Every crate under `crates/` appears in this table — `crates/xerj-engine/tests/docs_capability_lists.rs`+fails if one is missing or if the table names a crate that no longer exists. Five of them+(`xerj-autoindex`, `xerj-console-api`, `xerj-cluster`, `xerj-mcp`, `xerj-wasm`) were absent until+issue #211. The conformance runner lives outside `crates/`, at `tests/es-compat-yaml`.### Storage Modeldiff --git a/engine/crates/xerj-console-api/src/lib.rs b/engine/crates/xerj-console-api/src/lib.rsindex 77d71c556..aeb0cc09d 100644--- a/engine/crates/xerj-console-api/src/lib.rs+++ b/engine/crates/xerj-console-api/src/lib.rs@@ -22,8 +22,9 @@//! User-state (drop the localStorage hacks)://! - [`prefs`] — `GET/PUT /prefs`.//! - [`dashboards`] — full CRUD with If-Match etag concurrency.-//! - [`seed`] — first-launch materialisation of the 13 built-in dashboards-//! as editable backend data (idempotent, revisioned).+//! - [`seed`] — first-launch materialisation of the built-in dashboards+//! ([`seed::BUILTIN_DASHBOARD_COUNT`] of them) as editable backend data+//! (idempotent, revisioned).//! - [`views`] — saved views CRUD.//! - [`data_sources`] — `/data-sources/connections` + descendants//! (read-only MVP backed by an auto-provisioned `built-in` adapter).diff --git a/engine/crates/xerj-console-api/src/seed.rs b/engine/crates/xerj-console-api/src/seed.rsindex 9534348d0..ce16b5404 100644--- a/engine/crates/xerj-console-api/src/seed.rs+++ b/engine/crates/xerj-console-api/src/seed.rs@@ -4,7 +4,8 @@//! (`xerj-ux/src/dashboards/*.js` + `registry.js`). That made them a fixed,//! un-editable set: a layout tweak or a rename never survived a reload, and//! there was no server object to attach a per-panel query to. This module-//! materialises those same 14 dashboards as rows in `.xerj_dashboards` on+//! materialises those same dashboards ([`BUILTIN_DASHBOARD_COUNT`] of them) as+//! rows in `.xerj_dashboards` on//! first launch, so from that point on they are *data* the operator can edit//! (title, layout, panel geometry, per-panel query/viz) and that persists//! through the CRUD surface in [`crate::dashboards`].@@ -125,9 +126,18 @@ fn pd(}}-/// The 14 built-in dashboards, in registry order. Titles are the panel-/// `eyebrow` strings from the `.js` sources; dynamic eyebrows are captured as-/// a stable static string.+/// How many dashboards ship built in.+///+/// The one place this number is written down. Issue #211: it was also written+/// into two module doc comments, which disagreed with each other (13 vs 14) and+/// with [`seed_specs`], so a reader had to guess which prose was current. Prose+/// elsewhere links here instead of repeating the figure, and+/// [`tests::seeds_every_registry_dashboard`] pins it to the actual list.+pub const BUILTIN_DASHBOARD_COUNT: usize = 14;++/// The built-in dashboards ([`BUILTIN_DASHBOARD_COUNT`] of them), in registry+/// order. Titles are the panel `eyebrow` strings from the `.js` sources;+/// dynamic eyebrows are captured as a stable static string.fn seed_specs() -> Vec<DashboardSpec> {vec![// ── AI group ────────────────────────────────────────────────────────@@ -784,12 +794,13 @@ mod tests {use super::*;#[test]- fn seeds_the_fourteen_dashboards() {+ fn seeds_every_registry_dashboard() {let specs = seed_specs();assert_eq!(specs.len(),- 14,- "must seed exactly the 14 registry dashboards"+ BUILTIN_DASHBOARD_COUNT,+ "seed_specs() and BUILTIN_DASHBOARD_COUNT disagree — update the \+ constant in this file, which is what the docs quote");// Deterministic ids, all `default-` prefixed and unique.let mut ids: Vec<String> = specsdiff --git a/engine/crates/xerj-engine/src/aggs.rs b/engine/crates/xerj-engine/src/aggs.rsindex 4ff756655..86d3948e8 100644--- a/engine/crates/xerj-engine/src/aggs.rs+++ b/engine/crates/xerj-engine/src/aggs.rs@@ -16,17 +16,14 @@//!//! ## Supported aggregation types//!-//! | Type | ES key | Output shape |-//! |------------------|-------------------|-------------------------------------|-//! | Terms | `terms` | bucket agg with `key`/`doc_count` |-//! | Value count | `value_count` | metric — `{"value": N}` |-//! | Avg | `avg` | metric — `{"value": f64}` |-//! | Sum | `sum` | metric — `{"value": f64}` |-//! | Min | `min` | metric — `{"value": f64}` |-//! | Max | `max` | metric — `{"value": f64}` |-//! | Stats | `stats` | metric — combined count/min/max/... |-//! | Cardinality | `cardinality` | metric — exact distinct count |-//! | Date histogram | `date_histogram` | bucket agg keyed by time interval |+//! The complete list is [`SUPPORTED_AGG_TYPES`] — it is checked against the+//! dispatch table in `execute_agg_with_all_cached` by a test in this file, and+//! the published docs are checked against it by+//! `tests/docs_capability_lists.rs`. A hand-written table here would be a+//! fourth place to forget to update, which is exactly what issue #211 is+//! about: this module doc used to list nine types out of the sixty-plus that+//! run, and the pipeline family (`bucket_script` and friends) appeared in none+//! of the lists at all.//!//! Bucket aggregations support nested sub-aggregations (`aggs` key inside).@@ -34,6 +31,85 @@ use std::collections::{HashMap, HashSet};use serde_json::{json, Map, Value};+// ─────────────────────────────────────────────────────────────────────────────+// Capability manifest — the single source of truth for "what aggregations exist"+// ─────────────────────────────────────────────────────────────────────────────++/// Every aggregation-type name the agg dispatcher routes to a real+/// implementation.+///+/// **Acceptance, not fidelity.** A name here means the aggregation runs and+/// produces output of the ES shape; it is not a claim that every parameter of+/// every type is honoured. Per-type gaps are tracked in+/// `demo/playbooks/STUB_AUDIT.md`.+///+/// Kept in step with the dispatch table by+/// `tests::dispatch_table_matches_capability_manifest` in this file.+pub const SUPPORTED_AGG_TYPES: &[&str] = &[+ "adjacency_matrix",+ "auto_date_histogram",+ "avg",+ "avg_bucket",+ "boxplot",+ "bucket_script",+ "bucket_selector",+ "bucket_sort",+ "cardinality",+ "composite",+ "cumulative_sum",+ "date_histogram",+ "date_range",+ "derivative",+ "diversified_sampler",+ "extended_stats",+ "extended_stats_bucket",+ "filter",+ "filters",+ "geo_bounds",+ "geo_centroid",+ "geo_distance",+ "geohash_grid",+ "geotile_grid",+ "global",+ "histogram",+ "ip_prefix",+ "ip_range",+ "matrix_stats",+ "max",+ "max_bucket",+ "median_absolute_deviation",+ "min",+ "min_bucket",+ "missing",+ "moving_avg",+ "moving_fn",+ "multi_terms",+ "nested",+ "percentile_ranks",+ "percentiles",+ "percentiles_bucket",+ "random_sampler",+ "range",+ "rare_terms",+ "reverse_nested",+ "sampler",+ "scripted_metric",+ "serial_diff",+ "significant_terms",+ "significant_text",+ "stats",+ "stats_bucket",+ "string_stats",+ "sum",+ "sum_bucket",+ "terms",+ "time_series",+ "top_hits",+ "top_metrics",+ "value_count",+ "variable_width_histogram",+];+// ── Field value cache ─────────────────────────────────────────────────────────/// Per-aggregation-level cache of pre-extracted field values.@@ -14729,3 +14805,96 @@ mod date_range_filter_tests {assert!(!doc_matches_filter(&json!({"status": 200}), &f));}}++// ─────────────────────────────────────────────────────────────────────────────+// Capability-manifest drift guard (issue #211)+// ─────────────────────────────────────────────────────────────────────────────++#[cfg(test)]+mod capability_manifest_tests {+ use super::SUPPORTED_AGG_TYPES;+ use std::collections::BTreeSet;++ /// Names in the agg dispatch table, read out of this file's own source at+ /// compile time.+ ///+ /// A pattern line is one whose text before `=>` is nothing but quoted+ /// string literals, `|` and whitespace — true of every match-arm head and+ /// of no arm body, so nothing has to be marked up by hand. The scan is+ /// bounded by the `match` head and the catch-all arm that closes it.+ fn dispatch_table_names() -> Vec<String> {+ const SRC: &str = include_str!("aggs.rs");+ const START: &str = "let mut result = match agg_type {";+ const END: &str =+ "other => json!({\"error\": format!(\"unsupported aggregation type '{}'\", other)}),";++ let start = SRC.find(START).expect("agg dispatch head moved") + START.len();+ let end = SRC[start..].find(END).expect("agg catch-all arm moved") + start;++ let mut names = Vec::new();+ for line in SRC[start..end].lines() {+ let code = line.split("//").next().unwrap_or("");+ let head = code.split("=>").next().unwrap_or("");+ if !head.contains('"') {+ continue;+ }+ let mut literals = Vec::new();+ let mut rest = String::new();+ let mut current = String::new();+ let mut in_str = false;+ for ch in head.chars() {+ match (ch, in_str) {+ ('"', false) => in_str = true,+ ('"', true) => {+ in_str = false;+ literals.push(std::mem::take(&mut current));+ }+ (c, true) => current.push(c),+ (c, false) => rest.push(c),+ }+ }+ if in_str || rest.chars().any(|c| c != '|' && !c.is_whitespace()) {+ continue;+ }+ names.extend(literals);+ }+ names+ }++ /// The drift guard: [`SUPPORTED_AGG_TYPES`] must be exactly the dispatch+ /// table.+ ///+ /// Issue #211: the pipeline family (`bucket_script`, `derivative`,+ /// `cumulative_sum`, …) shipped and was absent from every published list,+ /// and a reviewer trusting those lists nearly opened a roadmap item to+ /// build it a second time.+ #[test]+ fn dispatch_table_matches_capability_manifest() {+ let dispatched: BTreeSet<String> = dispatch_table_names().into_iter().collect();+ assert!(+ dispatched.len() > 50,+ "scraper found only {} arms — the dispatch table shape changed and the \+ scan is silently under-reading it",+ dispatched.len()+ );++ let manifest: BTreeSet<String> =+ SUPPORTED_AGG_TYPES.iter().map(|s| s.to_string()).collect();+ assert_eq!(+ manifest.len(),+ SUPPORTED_AGG_TYPES.len(),+ "SUPPORTED_AGG_TYPES contains duplicates"+ );++ let missing: Vec<_> = dispatched.difference(&manifest).collect();+ let extra: Vec<_> = manifest.difference(&dispatched).collect();+ assert!(+ missing.is_empty() && extra.is_empty(),+ "capability manifest has drifted from the agg dispatch table.\n \+ dispatched but not in the manifest: {missing:?}\n \+ in the manifest but not dispatched: {extra:?}\n \+ Fix SUPPORTED_AGG_TYPES in this file; the docs are checked against \+ it by tests/docs_capability_lists.rs."+ );+ }+}diff --git a/engine/crates/xerj-engine/tests/docs_capability_lists.rs b/engine/crates/xerj-engine/tests/docs_capability_lists.rsnew file mode 100644index 000000000..0bee1dde5--- /dev/null+++ b/engine/crates/xerj-engine/tests/docs_capability_lists.rs@@ -0,0 +1,221 @@+//! Docs-vs-source drift guard for the published capability lists (issue #211).+//!+//! A source review concluded XERJ had no pipeline aggregations. It has fifteen.+//! The reviewer had read a hand-maintained list that stopped at `composite`,+//! and nearly opened a roadmap item to build a feature that already shipped.+//! The same lists advertised `has_child` / `has_parent`, which the parser+//! rejects with a 400.+//!+//! The root cause is that "what XERJ supports" was written down in prose in+//! several places and derived from the code in none of them. It is now derived+//! in exactly one place per subsystem —+//! [`xerj_query::parser::SUPPORTED_QUERY_TYPES`] and+//! [`xerj_engine::aggs::SUPPORTED_AGG_TYPES`], each pinned to its own dispatch+//! table by a unit test — and every published list is a marked region checked+//! against those constants here.+//!+//! Adding a query type or an aggregation now fails this test until the docs+//! are updated. That is the point: the failure is cheap, and the wrong+//! conclusion it prevents is not.++use std::collections::BTreeSet;+use std::path::{Path, PathBuf};++/// Repository root, derived from this crate's manifest directory+/// (`<repo>/engine/crates/xerj-engine`).+fn repo_root() -> PathBuf {+ Path::new(env!("CARGO_MANIFEST_DIR"))+ .ancestors()+ .nth(3)+ .expect("crate manifest dir must be <repo>/engine/crates/xerj-engine")+ .to_path_buf()+}++/// Every documentation file that carries a machine-checked capability list.+///+/// Paths are repo-relative. A file listed here that has lost its markers is a+/// hard failure, not a skip — a silently unchecked doc is the state this test+/// exists to end.+const CHECKED_DOCS: &[&str] = &["engine/README.md", "landing/llms-full.txt"];++/// Pull the names out of a `<!-- generated:<section> -->` … `<!-- /generated:<section> -->`+/// region.+///+/// Only backtick-delimited tokens count, so the region can carry readable+/// family labels ("Full-text:", "Pipeline:") without them being mistaken for+/// capability names. Anything backticked that is not an ES type name is a hard+/// error rather than a silently mis-parsed entry.+fn documented(doc: &str, path: &str, section: &str) -> BTreeSet<String> {+ let open = format!("<!-- generated:{section} -->");+ let close = format!("<!-- /generated:{section} -->");++ let start = doc.find(&open).unwrap_or_else(|| {+ panic!(+ "{path} has no `{open}` marker. Every capability list is generated \+ from the source constants and delimited by these markers; if the \+ section was renamed or removed, update CHECKED_DOCS/SECTIONS in \+ this test rather than leaving the list unchecked."+ )+ }) + open.len();+ let end = doc[start..]+ .find(&close)+ .unwrap_or_else(|| panic!("{path} opens `{open}` but never closes it with `{close}`"))+ + start;++ let region = &doc[start..end];+ let mut names = BTreeSet::new();+ let mut rest = region;+ while let Some(o) = rest.find('`') {+ let after = &rest[o + 1..];+ let Some(c) = after.find('`') else {+ panic!("{path} section `{section}` has an unclosed backtick");+ };+ let token = after[..c].trim();+ assert!(+ !token.is_empty()+ && token+ .chars()+ .all(|ch| ch.is_ascii_lowercase() || ch.is_ascii_digit() || ch == '_'),+ "{path} section `{section}` contains `{token}`, which is not a bare type name. \+ The region is machine-checked and may hold only backticked type names plus \+ plain-text family labels — put prose outside the markers."+ );+ names.insert(token.to_string());+ rest = &after[c + 1..];+ }+ names+}++fn assert_section(section: &str, expected: &[&str]) {+ let root = repo_root();+ let expected: BTreeSet<String> = expected.iter().map(|s| s.to_string()).collect();++ for rel in CHECKED_DOCS {+ let path = root.join(rel);+ let doc = std::fs::read_to_string(&path)+ .unwrap_or_else(|e| panic!("cannot read {}: {e}", path.display()));+ let listed = documented(&doc, rel, section);++ let missing: Vec<_> = expected.difference(&listed).collect();+ let extra: Vec<_> = listed.difference(&expected).collect();+ assert!(+ missing.is_empty() && extra.is_empty(),+ "{rel} section `{section}` has drifted from the source of truth.\n \+ implemented but undocumented: {missing:?}\n \+ documented but not implemented: {extra:?}\n \+ The lists are generated: copy them from the constants in \+ xerj-query/src/parser.rs and xerj-engine/src/aggs.rs."+ );+ }+}++#[test]+fn documented_query_types_match_the_parser() {+ assert_section("query-types", xerj_query::parser::SUPPORTED_QUERY_TYPES);+}++/// The other direction of the same defect: types the docs must show as+/// *rejected*, so nobody plans around a `has_child` that answers 400.+#[test]+fn documented_rejected_query_types_match_the_parser() {+ assert_section(+ "rejected-query-types",+ xerj_query::parser::REJECTED_QUERY_TYPES,+ );+}++#[test]+fn documented_agg_types_match_the_engine() {+ assert_section("agg-types", xerj_engine::aggs::SUPPORTED_AGG_TYPES);+}++/// The markers are load-bearing, so prove the extractor actually rejects a+/// drifted list rather than passing on an empty or unparsed region.+#[test]+fn the_extractor_notices_drift() {+ let doc = "<!-- generated:query-types -->\n`match`, `term`\n<!-- /generated:query-types -->";+ let listed = documented(doc, "synthetic", "query-types");+ assert_eq!(+ listed,+ ["match", "term"]+ .iter()+ .map(|s| s.to_string())+ .collect::<BTreeSet<_>>()+ );+ assert!(!listed.contains("bucket_script"));+}++/// The crate map is the same defect in a different list: it named eleven of the+/// sixteen crates, so an agent orienting from it never learned that+/// `xerj-autoindex` — the flagship feature — exists.+///+/// Checked by containment rather than by markers, because the map is a table+/// with a prose column: every `crates/*` workspace member must be named in it,+/// and every crate it names must still be a member.+#[test]+fn the_readme_crate_map_lists_every_workspace_crate() {+ let root = repo_root();+ let manifest =+ std::fs::read_to_string(root.join("engine/Cargo.toml")).expect("engine manifest");+ let readme_path = root.join("engine/README.md");+ let readme = std::fs::read_to_string(&readme_path).expect("engine README");++ let members: BTreeSet<String> = manifest+ .lines()+ .filter_map(|l| l.trim().strip_prefix("\"crates/"))+ .filter_map(|l| l.split('"').next())+ .map(str::to_string)+ .collect();+ assert!(+ members.len() > 10,+ "only {} workspace members parsed out of engine/Cargo.toml — the manifest \+ layout changed and this check is reading nothing",+ members.len()+ );++ let map_start = readme+ .find("### Crate Map")+ .expect("engine/README.md lost its `### Crate Map` heading");+ let map = &readme[map_start..];+ let map = &map[..map.find("\n### ").unwrap_or(map.len())];++ // Only the first cell of a table row counts. A crate merely *mentioned* in+ // the surrounding prose is not documented, and an earlier draft of this+ // test accepted exactly that — the guard has to be harder to satisfy than+ // the thing it guards.+ let rows: BTreeSet<String> = map+ .lines()+ .filter_map(|l| l.trim().strip_prefix("| `"))+ .filter_map(|l| l.split('`').next())+ .map(str::to_string)+ .collect();++ let undocumented: Vec<_> = members.difference(&rows).collect();+ assert!(+ undocumented.is_empty(),+ "engine/README.md's crate map has no row for {undocumented:?} — every crate \+ under engine/crates/ needs its own `| `<crate>` | purpose |` row"+ );++ let phantom: Vec<_> = rows+ .iter()+ .filter(|r| r.starts_with("xerj-") && !members.contains(*r))+ .collect();+ assert!(+ phantom.is_empty(),+ "engine/README.md's crate map has a row for {phantom:?}, which is not a workspace member"+ );+}++/// A backticked qualifier — the shape the old prose lists used, e.g.+/// `knn (HNSW-served unfiltered / exact filtered)` — must fail loudly rather+/// than be absorbed as a capability name that then never matches anything.+/// Accepted-and-ignored input is the failure mode this repo tracks in issue+/// #204; the docs guard must not add a documentation-flavoured instance of it.+#[test]+#[should_panic(expected = "is not a bare type name")]+fn a_backticked_qualifier_inside_a_region_is_refused() {+ let doc =+ "<!-- generated:query-types -->\n`knn (HNSW-served)`\n<!-- /generated:query-types -->";+ documented(doc, "synthetic", "query-types");+}diff --git a/engine/crates/xerj-query/src/parser.rs b/engine/crates/xerj-query/src/parser.rsindex 7a6200035..e1ca52974 100644--- a/engine/crates/xerj-query/src/parser.rs+++ b/engine/crates/xerj-query/src/parser.rs@@ -136,6 +136,86 @@ fn unknown_type<T>(name: impl Into<String>) -> Result<T> {Err(QueryError::Parse(ParseError::UnknownQueryType(name.into())))}+// ─────────────────────────────────────────────────────────────────────────────+// Capability manifest — the single source of truth for "what queries exist"+// ─────────────────────────────────────────────────────────────────────────────+//+// Issue #211: hand-maintained lists of supported query types drifted from the+// dispatch table in `parse_query`, in both directions — docs advertised+// `has_child`/`has_parent`, which are rejected with a 400, and omitted a dozen+// types that do run. Every such list now derives from these two constants, and+// `dispatch_table_matches_capability_manifest` (below) fails the build if a+// `parse_query` arm is added or removed without updating them. Docs are checked+// against the same constants by `xerj-engine/tests/docs_capability_lists.rs`.++/// Every query-type name [`parse_query`] dispatches to a real implementation.+///+/// **Acceptance, not fidelity.** A name here means the parser builds a+/// [`QueryNode`] the planner and executor will run; it is not a claim that the+/// semantics match Elasticsearch in every corner. Per-type gaps are tracked in+/// `ROADMAP.md`.+pub const SUPPORTED_QUERY_TYPES: &[&str] = &[+ "bool",+ "boosting",+ "combined_fields",+ "constant_score",+ "dis_max",+ "distance_feature",+ "exists",+ "function_score",+ "fuzzy",+ "geo_bounding_box",+ "geo_distance",+ "geo_polygon",+ "geo_shape",+ "hybrid",+ "ids",+ "intervals",+ "knn",+ "match",+ "match_all",+ "match_bool_prefix",+ "match_none",+ "match_phrase",+ "match_phrase_prefix",+ "more_like_this",+ "multi_match",+ "nested",+ "percolate",+ "pinned",+ "prefix",+ "query_string",+ "range",+ "rank_feature",+ "regexp",+ "script",+ "script_score",+ "semantic",+ "simple_query_string",+ "span_containing",+ "span_first",+ "span_near",+ "span_not",+ "span_or",+ "span_term",+ "span_within",+ "term",+ "terms",+ "terms_set",+ "type",+ "wildcard",+ "wrapper",+];++/// Query-type names [`parse_query`] recognises and **deliberately rejects**+/// with a 400.+///+/// These are listed separately rather than dropped so the rejection is a+/// documented contract: an ES client sending `has_child` gets a specific+/// "not supported, denormalize the relationship" message instead of the+/// generic unknown-query-type error — and never gets silently wrong hits.+pub const REJECTED_QUERY_TYPES: &[&str] = &["has_child", "has_parent"];+// ─────────────────────────────────────────────────────────────────────────────// Public entry points// ─────────────────────────────────────────────────────────────────────────────@@ -5458,4 +5538,138 @@ mod tests {assert!(err.to_string().contains("too_many_clauses"), "got {err}");}}++ // ── Capability manifest (issue #211) ─────────────────────────────────────++ /// Names in `parse_query`'s dispatch table, read out of this file's own+ /// source at compile time.+ ///+ /// A pattern line is one whose text before `=>` is nothing but quoted+ /// string literals, `|` and whitespace — which is true of every match arm+ /// head and of no arm body, so no marker comments are needed and nothing+ /// has to be kept in sync by hand. The scan is bounded by the `match` head+ /// and the catch-all arm that closes it.+ fn dispatch_table_names() -> Vec<String> {+ const SRC: &str = include_str!("parser.rs");+ const START: &str = "match query_type.as_str() {";+ const END: &str = "unknown => unknown_type(unknown),";++ let start = SRC.find(START).expect("parse_query dispatch head moved") + START.len();+ let end = SRC[start..]+ .find(END)+ .expect("parse_query catch-all arm moved")+ + start;++ let mut names = Vec::new();+ for line in SRC[start..end].lines() {+ let code = line.split("//").next().unwrap_or("");+ let head = code.split("=>").next().unwrap_or("");+ if !head.contains('"') {+ continue;+ }+ // Everything that is not a string literal must be `|`/whitespace,+ // otherwise this is an arm body that merely mentions a literal.+ let mut literals = Vec::new();+ let mut rest = String::new();+ let mut in_str = false;+ let mut current = String::new();+ for ch in head.chars() {+ match (ch, in_str) {+ ('"', false) => in_str = true,+ ('"', true) => {+ in_str = false;+ literals.push(std::mem::take(&mut current));+ }+ (c, true) => current.push(c),+ (c, false) => rest.push(c),+ }+ }+ if in_str || rest.chars().any(|c| c != '|' && !c.is_whitespace()) {+ continue;+ }+ names.extend(literals);+ }+ names+ }++ /// The drift guard. `SUPPORTED_QUERY_TYPES` + `REJECTED_QUERY_TYPES` must+ /// be exactly the dispatch table — no more, no less.+ ///+ /// Without this, adding a `parse_query` arm leaves every published list+ /// silently short (the pipeline-aggregation half of issue #211) and+ /// deleting one leaves them advertising a query that 400s.+ #[test]+ fn dispatch_table_matches_capability_manifest() {+ use std::collections::BTreeSet;++ let dispatched: BTreeSet<String> = dispatch_table_names().into_iter().collect();+ assert!(+ dispatched.len() > 40,+ "scraper found only {} arms — the dispatch table shape changed and the \+ scan is silently under-reading it",+ dispatched.len()+ );++ let supported: BTreeSet<String> = SUPPORTED_QUERY_TYPES+ .iter()+ .map(|s| s.to_string())+ .collect();+ let rejected: BTreeSet<String> =+ REJECTED_QUERY_TYPES.iter().map(|s| s.to_string()).collect();+ assert_eq!(+ supported.len(),+ SUPPORTED_QUERY_TYPES.len(),+ "SUPPORTED_QUERY_TYPES contains duplicates"+ );+ assert!(+ supported.is_disjoint(&rejected),+ "a query type cannot be both supported and rejected: {:?}",+ supported.intersection(&rejected).collect::<Vec<_>>()+ );++ let manifest: BTreeSet<String> = supported.union(&rejected).cloned().collect();+ let missing: Vec<_> = dispatched.difference(&manifest).collect();+ let extra: Vec<_> = manifest.difference(&dispatched).collect();+ assert!(+ missing.is_empty() && extra.is_empty(),+ "capability manifest has drifted from parse_query's dispatch table.\n \+ dispatched but not in the manifest: {missing:?}\n \+ in the manifest but not dispatched: {extra:?}\n \+ Fix SUPPORTED_QUERY_TYPES / REJECTED_QUERY_TYPES in this file; the \+ docs are checked against them by xerj-engine/tests/docs_capability_lists.rs."+ );+ }++ /// Behavioural half: the manifest's two halves must actually behave the+ /// way they are labelled. A supported type must not answer+ /// `unknown query type`, and a rejected type must refuse.+ #[test]+ fn manifest_labels_match_observed_behaviour() {+ // `{ "<type>": {} }` — the minimal body that reaches the dispatch arm.+ // Most arms then reject it for missing parameters; what matters here is+ // only whether the *type* was recognised.+ fn bare(name: &str) -> Value {+ let mut obj = serde_json::Map::new();+ obj.insert(name.to_string(), json!({}));+ Value::Object(obj)+ }++ for name in SUPPORTED_QUERY_TYPES {+ let err = parse_query(&bare(name)).err();+ if let Some(QueryError::Parse(ParseError::UnknownQueryType(t))) = err {+ panic!(+ "`{name}` is listed as supported but parse_query rejects it as unknown: {t}"+ );+ }+ }+ for name in REJECTED_QUERY_TYPES {+ let err = parse_query(&bare(name))+ .err()+ .unwrap_or_else(|| panic!("`{name}` is listed as rejected but parsed cleanly"));+ assert!(+ err.to_string().contains("not supported"),+ "`{name}` must refuse with an explanatory message, got: {err}"+ );+ }+ }}diff --git a/landing/llms-full.txt b/landing/llms-full.txtindex 4325807e8..7f3f25e6c 100644--- a/landing/llms-full.txt+++ b/landing/llms-full.txt@@ -434,24 +434,75 @@ Supported mapping field types (ES type string → internal):6. SEARCH DSL — supported query types=====================================================================-Full-text / term-level:- match, match_all, match_none, match_phrase, match_phrase_prefix, multi_match,- term, terms, range, prefix, wildcard, exists, ids, fuzzy, regexp, query_string,- simple_query_string, constant_score, boosting, dis_max.--Vector / semantic / hybrid:- knn (HNSW-served unfiltered / exact filtered; also top-level knn form),- semantic (over semantic_text), hybrid (rrf|linear).--Compound / geo:- bool (must / should / must_not / filter), function_score, geo_distance.+Both lists below are complete and machine-checked: they are generated from+`SUPPORTED_QUERY_TYPES` (xerj-query/src/parser.rs) and `SUPPORTED_AGG_TYPES`+(xerj-engine/src/aggs.rs), each pinned to its dispatch table by a unit test,+and this file is compared against them by+engine/crates/xerj-engine/tests/docs_capability_lists.rs. A type cannot ship+without appearing here.++Acceptance is not a fidelity claim: a listed type parses, plans and executes,+which is not a promise that every parameter matches Elasticsearch. The ES-YAML+conformance suite is the measured answer; per-type gaps live in ROADMAP.md.++<!-- generated:query-types -->+Full-text `match`, `match_phrase`, `match_phrase_prefix`,+ `match_bool_prefix`, `multi_match`, `combined_fields`,+ `query_string`, `simple_query_string`, `intervals`,+ `more_like_this`+Term-level `term`, `terms`, `terms_set`, `range`, `prefix`, `wildcard`,+ `regexp`, `fuzzy`, `exists`, `ids`, `script`+Universal `match_all`, `match_none`+Compound/score `bool`, `boosting`, `constant_score`, `dis_max`,+ `function_score`, `script_score`, `distance_feature`,+ `rank_feature`, `pinned`+Vector/semantic `knn`, `semantic`, `hybrid`+Geo `geo_distance`, `geo_bounding_box`, `geo_polygon`, `geo_shape`+Span `span_term`, `span_near`, `span_or`, `span_not`, `span_first`,+ `span_containing`, `span_within`+Structure `nested`+Other `percolate`, `type`, `wrapper`+<!-- /generated:query-types -->++Notes on the vector family: knn is HNSW-served for unfiltered queries on+full-precision fields and exact-scanned for filtered / nested / SQ8 / small+shapes (also available as the top-level `knn` request form); semantic queries+run over semantic_text fields; hybrid fuses BM25 and vector scores (rrf|linear).++Recognised and DELIBERATELY REJECTED with a 400 — XERJ never materialises a+parent/child join, so running these would return silently wrong hits:++<!-- generated:rejected-query-types -->+`has_child`, `has_parent`+<!-- /generated:rejected-query-types -->++Any other query type answers `unknown query type`.Search body options: from, size, sort, _source (include/exclude), highlight, aggs,track_total_hits, and (via dedicated endpoints) scroll and point-in-time.-Aggregations:- terms, stats, avg, sum, min, max, value_count, cardinality, range, histogram,- date_histogram, percentiles, filter, missing, composite.+Aggregations (complete; all exact — cardinality is a true distinct count, not an+HLL estimate, and terms doc_count is precise):++<!-- generated:agg-types -->+Metric `avg`, `sum`, `min`, `max`, `stats`, `extended_stats`, `value_count`,+ `cardinality`, `percentiles`, `percentile_ranks`,+ `median_absolute_deviation`, `matrix_stats`, `string_stats`,+ `boxplot`, `top_metrics`, `top_hits`, `scripted_metric`+Bucket `terms`, `multi_terms`, `rare_terms`, `significant_terms`,+ `significant_text`, `range`, `date_range`, `ip_range`, `ip_prefix`,+ `histogram`, `variable_width_histogram`, `date_histogram`,+ `auto_date_histogram`, `filter`, `filters`, `missing`, `composite`,+ `adjacency_matrix`, `time_series`, `global`+Sampling `sampler`, `random_sampler`, `diversified_sampler`+Scope `nested`, `reverse_nested`+Geo `geo_bounds`, `geo_centroid`, `geo_distance`, `geohash_grid`,+ `geotile_grid`+Pipeline `avg_bucket`, `sum_bucket`, `min_bucket`, `max_bucket`,+ `stats_bucket`, `extended_stats_bucket`, `percentiles_bucket`,+ `derivative`, `cumulative_sum`, `serial_diff`, `moving_avg`,+ `moving_fn`, `bucket_script`, `bucket_selector`, `bucket_sort`+<!-- /generated:agg-types -->=====================================================================7. ENDPOINT CATALOGUE (Elasticsearch-compatible surface, :9200)