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
setup:
- do:
indices.create:
index: test
body:
settings:
number_of_shards: 1
mappings:
properties:
num:
type: integer
- do:
bulk:
index: test
refresh: true
body: |
{ "index": {"_id": "1"}}
{ "num": [1, 2] }
{ "index": {"_id": "2"}}
{ "num": [2, 3] }
{ "index": {"_id": "3"}}
{ "num": [3, 4] }
---
"Filters intersections":
- do:
search:
index: test
body:
size: 0
aggs:
conns:
adjacency_matrix:
filters:
1:
term:
num: 1
2:
term:
num: 2
4:
term:
num: 4
- match: { hits.total.value: 3 }
- length: { aggregations.conns.buckets: 4 }
- match: { aggregations.conns.buckets.0.doc_count: 1 }
- match: { aggregations.conns.buckets.0.key: "1" }
- match: { aggregations.conns.buckets.1.doc_count: 1 }
- match: { aggregations.conns.buckets.1.key: "1&2" }
- match: { aggregations.conns.buckets.2.doc_count: 2 }
- match: { aggregations.conns.buckets.2.key: "2" }
- match: { aggregations.conns.buckets.3.doc_count: 1 }
- match: { aggregations.conns.buckets.3.key: "4" }
---
"Terms lookup":
- requires:
cluster_features: ["gte_v7.9.0"]
reason: fixed in 7.9.0
- do:
indices.create:
index: lookup
body:
settings:
number_of_shards: 1
mappings:
properties:
num:
type: long
- do:
bulk:
index: lookup
refresh: true
body: |
{ "index": {"_id": 1} }
{ "num": [1] }
{ "index": {"_id": 2} }
{ "num": [2] }
{ "index": {"_id": 4} }
{ "num": [4] }
- do:
search:
index: test
preference: hit-same-shard-copy
body:
size: 0
aggs:
conns:
adjacency_matrix:
filters:
1:
terms:
num:
index: lookup
id: "1"
path: num
2:
terms:
num:
index: lookup
id: "2"
path: num
4:
terms:
num:
index: lookup
id: "4"
path: num
- match: { hits.total.value: 3 }
- length: { aggregations.conns.buckets: 4 }
- match: { aggregations.conns.buckets.0.doc_count: 1 }
- match: { aggregations.conns.buckets.0.key: "1" }
- match: { aggregations.conns.buckets.1.doc_count: 1 }
- match: { aggregations.conns.buckets.1.key: "1&2" }
- match: { aggregations.conns.buckets.2.doc_count: 2 }
- match: { aggregations.conns.buckets.2.key: "2" }
- match: { aggregations.conns.buckets.3.doc_count: 1 }
- match: { aggregations.conns.buckets.3.key: "4" }
- do:
indices.stats: { index: test, metric: request_cache}
- gte: { _shards.total: 1 }
- match: { indices.test.total.request_cache.hit_count: 0 }
- match: { indices.test.total.request_cache.miss_count: 1 }
# The second request should hit the cache
- do:
search:
index: test
preference: hit-same-shard-copy
body:
size: 0
aggs:
conns:
adjacency_matrix:
filters:
1:
terms:
num:
index: lookup
id: "1"
path: num
2:
terms:
num:
index: lookup
id: "2"
path: num
4:
terms:
num:
index: lookup
id: "4"
path: num
- do:
indices.stats: { index: test, metric: request_cache}
- gte: { _shards.total: 1 }
- match: { indices.test.total.request_cache.hit_count: 1 }
- match: { indices.test.total.request_cache.miss_count: 1 }