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: spans
body:
mappings:
properties:
text:
type: text
- do:
bulk:
refresh: true
body:
# doc 1: "brown" sits between "quick" and "fox" — the little span is
# enclosed by the big span_near.
- '{ "index": { "_index": "spans", "_id": "1" } }'
- '{ "text": "the quick brown fox jumps" }'
# doc 2: "brown" is AFTER "fox", so it is not enclosed by quick..fox.
- '{ "index": { "_index": "spans", "_id": "2" } }'
- '{ "text": "the quick fox is brown" }'
---
"span_within: little span enclosed by big span matches only doc 1":
- do:
search:
rest_total_hits_as_int: true
index: spans
body:
query:
span_within:
little:
span_term: { text: "brown" }
big:
span_near:
clauses:
- span_term: { text: "quick" }
- span_term: { text: "fox" }
slop: 3
in_order: true
- match: { hits.total: 1 }
- match: { hits.hits.0._id: "1" }
---
"span_containing: big span contains little span matches only doc 1":
- do:
search:
rest_total_hits_as_int: true
index: spans
body:
query:
span_containing:
little:
span_term: { text: "brown" }
big:
span_near:
clauses:
- span_term: { text: "quick" }
- span_term: { text: "fox" }
slop: 3
in_order: true
- match: { hits.total: 1 }
- match: { hits.hits.0._id: "1" }
---
"span_containing requires both little and big (400)":
- do:
catch: bad_request
search:
index: spans
body:
query:
span_containing:
big:
span_term: { text: "fox" }