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:
double_field:
type: double
long_field:
type: long
integer_field:
type: integer
multi_value_field:
type: integer
weight:
type: integer
- do:
bulk:
refresh: true
index: test
body:
- '{ "index": {} }'
- '{ "double_field": 1.0, "long_field": 6, "integer_field": 10, "multi_value_field": [1, 2, 3], "weight": 2 }'
- '{ "index": {} }'
- '{ "double_field": 3.0, "long_field": 2, "multi_value_field": [0, 1, 4], "weight": 4 }'
- '{ "index": {} }'
- '{ "double_field": 1.0, "long_field": 1 }'
- '{ "index": {} }'
- '{ "double_field": 5.0, "long_field": 3, "integer_field": 4, "weight": 3 }'
---
"Basic test":
- skip:
features: close_to
- do:
search:
body:
aggs:
weighted_long_avg:
weighted_avg:
value:
field: long_field
weight:
field: weight
weighted_double_avg:
weighted_avg:
value:
field: double_field
weight:
field: weight
weighted_integer_avg:
weighted_avg:
value:
field: integer_field
weight:
field: weight
- match: { hits.total.value: 4 }
- length: { hits.hits: 4 }
- close_to: { aggregations.weighted_long_avg.value: { value: 3.222222, error: 0.000001 } }
- close_to: { aggregations.weighted_double_avg.value: { value: 3.222222, error: 0.000001 } }
- close_to: { aggregations.weighted_integer_avg.value: { value: 6.400000, error: 0.000001 } }
---
"Value with explicit missing configuration":
- skip:
features: close_to
- do:
search:
body:
aggs:
weighted_integer_avg:
weighted_avg:
value:
field: integer_field
missing: 2
weight:
field: weight
- match: { hits.total.value: 4 }
- length: { hits.hits: 4 }
- close_to: { aggregations.weighted_integer_avg.value: { value: 4.444444, error: 0.000001 } }
---
"Weight with explicit missing configuration":
- skip:
features: close_to
- do:
search:
body:
aggs:
weighted_long_avg:
weighted_avg:
value:
field: long_field
weight:
field: weight
missing: 4
- match: { hits.total.value: 4 }
- length: { hits.hits: 4 }
- close_to: { aggregations.weighted_long_avg.value: { value: 2.538461, error: 0.000001 } }
---
"Missing value results in skipping document":
- skip:
features: close_to
- do:
search:
body:
aggs:
weighted_integer_avg:
weighted_avg:
value:
field: integer_field
weight:
field: weight
missing: 1
- match: { hits.total.value: 4 }
- length: { hits.hits: 4 }
- close_to: { aggregations.weighted_integer_avg.value: { value: 6.400000, error: 0.000001 } }
---
"Missing weight results in skipping document":
- skip:
features: close_to
- do:
search:
body:
aggs:
weighted_long_avg:
weighted_avg:
value:
field: long_field
weight:
field: weight
- match: { hits.total.value: 4 }
- length: { hits.hits: 4 }
- close_to: { aggregations.weighted_long_avg.value: { value: 3.222222, error: 0.000001 } }
---
"Sum of weights equal to zero results in null weighted average":
- do:
search:
body:
aggs:
weighted_integer_avg:
weighted_avg:
value:
field: integer_field
weight:
field: unknown
missing: 0
- match: { hits.total.value: 4 }
- length: { hits.hits: 4 }
- match: { aggregations.weighted_integer_avg.value: null }
---
"Multi value field":
- skip:
features: close_to
- do:
search:
body:
aggs:
weighted_multi_value_avg:
weighted_avg:
value:
field: multi_value_field
weight:
field: weight
- match: { hits.total.value: 4 }
- length: { hits.hits: 4 }
- close_to: { aggregations.weighted_multi_value_avg.value: { value: 1.777777, error: 0.000001 } }
---
"Multi weight field not allowed":
- requires:
cluster_features: ["gte_v8.12.0"]
reason: "Changed status code in 8.12"
test_runner_features: close_to
- do:
catch: bad_request
search:
body:
aggs:
weighted_multi_weight_avg:
weighted_avg:
value:
field: integer_field
weight:
field: multi_value_field