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
fix(stats): report real on-disk store.size_in_bytes in _stats
xerj-org72d4cd5e31d3
diff --git a/engine/crates/xerj-api/src/es_compat.rs b/engine/crates/xerj-api/src/es_compat.rsindex 6dea20aa4..222f732da 100644--- a/engine/crates/xerj-api/src/es_compat.rs+++ b/engine/crates/xerj-api/src/es_compat.rs@@ -10854,6 +10854,7 @@ pub async fn index_stats(if targets.len() > 1 || index == "_all" || index.contains('*') {// Aggregate across multiple indices.let mut all_doc_count = 0u64;+ let mut all_store_bytes = 0u64;let mut all_indices = serde_json::Map::new();for name in &targets {let stats = match state.engine.index_stats(name).await {@@ -10862,10 +10863,18 @@ pub async fn index_stats(};let doc_count = stats.doc_count;all_doc_count += doc_count;+ // Real on-disk footprint: recursive byte sum of the index's+ // data dir (WAL + segments + everything else it persists).+ let store_size_bytes = state+ .engine+ .get_index(name)+ .map(|idx| dir_size_bytes(idx.data_dir()))+ .unwrap_or(0);+ all_store_bytes += store_size_bytes;let dv = per_index_dense_vector_stats(&state, name);let primaries = json!({"docs": { "count": doc_count, "deleted": 0 },- "store": { "size_in_bytes": doc_count * 256 },+ "store": { "size_in_bytes": store_size_bytes },"dense_vector": dv,});all_indices.insert(name.clone(), json!({@@ -10899,7 +10908,7 @@ pub async fn index_stats(}let all_primaries = json!({"docs": { "count": all_doc_count, "deleted": 0 },- "store": { "size_in_bytes": all_doc_count * 256 },+ "store": { "size_in_bytes": all_store_bytes },"dense_vector": {"value_count": all_dv_value_count,"off_heap": {@@ -10925,8 +10934,13 @@ pub async fn index_stats(};let doc_count = stats.doc_count;- // Rough size estimate: 256 bytes per doc on average.- let store_size_bytes = doc_count * 256;+ // Real on-disk footprint: recursive byte sum of the index's data dir+ // (WAL + segments + everything else it persists).+ let store_size_bytes = state+ .engine+ .get_index(&index)+ .map(|idx| dir_size_bytes(idx.data_dir()))+ .unwrap_or(0);// Pull the live noop + request-cache counters from the index.let (noop_total, rc_hit, rc_miss, get_total, get_ms, get_exists, get_missing) = match state.engine.get_index(&index) {