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:
- skip:
features: ["headers", "allowed_warnings"]
- do:
indices.create:
index: test
body:
mappings:
dynamic: false
properties:
binary:
type: binary
doc_values: true
boolean:
type: boolean
date:
type: date
geo_point:
type: geo_point
ip:
type: ip
keyword:
type: keyword
byte:
type: byte
double:
type: double
float:
type: float
half_float:
type: half_float
integer:
type: integer
long:
type: long
short:
type: short
object:
type: object
properties:
inner1:
type: keyword
inner2:
type: keyword
text:
type: text
text_stored_not_indexed:
type: text
store: true
index: false
- do:
headers:
Content-Type: application/json
index:
index: "test"
id: "1"
body:
binary: "YWJjZGUxMjM0"
boolean: true
date: "2017-01-01"
geo_point: [0.0, 20.0]
ip: "192.168.0.1"
keyword: "foo"
byte: 1
double: 1.0
float: 1.0
half_float: 1.0
integer: 1
long: 1
short: 1
object:
inner1: "foo"
inner2: "bar"
text: "foo bar"
text_stored_not_indexed: "foo bar"
- do:
headers:
Content-Type: application/json
index:
index: "test"
id: "2"
body:
binary: "YWJjZGUxMjM0"
boolean: false
date: "2017-01-01"
geo_point: [0.0, 20.0]
ip: "192.168.0.1"
keyword: "foo"
byte: 1
double: 1.0
float: 1.0
half_float: 1.0
integer: 1
long: 1
short: 1
object:
inner1: "foo"
text: "foo bar"
text_stored_not_indexed: "foo bar"
- do:
headers:
Content-Type: application/json
index:
index: "test"
id: "3"
routing: "route_me"
body:
binary: "YWJjZGUxMjM0"
boolean: true
date: "2017-01-01"
geo_point: [0.0, 20.0]
ip: "192.168.0.1"
keyword: "foo"
byte: 1
double: 1.0
float: 1.0
half_float: 1.0
integer: 1
long: 1
short: 1
object:
inner2: "bar"
text: "foo bar"
text_stored_not_indexed: "foo bar"
- do:
index:
index: "test"
id: "4"
body: {}
- do:
indices.create:
index: test-no-dv
body:
mappings:
dynamic: false
properties:
binary:
type: binary
doc_values: false
store: true
boolean:
type: boolean
doc_values: false
date:
type: date
doc_values: false
geo_point:
type: geo_point
doc_values: false
ip:
type: ip
doc_values: false
keyword:
type: keyword
doc_values: false
byte:
type: byte
doc_values: false
double:
type: double
doc_values: false
float:
type: float
doc_values: false
half_float:
type: half_float
doc_values: false
integer:
type: integer
doc_values: false
long:
type: long
doc_values: false
short:
type: short
doc_values: false
object:
type: object
properties:
inner1:
type: keyword
doc_values: false
inner2:
type: keyword
doc_values: false
text:
type: text
keyword_stored_norms_not_indexed:
type: keyword
doc_values: false
index: false
store: true
norms: true
- do:
headers:
Content-Type: application/json
index:
index: "test-no-dv"
id: "1"
body:
binary: "YWJjZGUxMjM0"
boolean: true
date: "2017-01-01"
geo_point: [0.0, 20.0]
ip: "192.168.0.1"
keyword: "foo"
byte: 1
double: 1.0
float: 1.0
half_float: 1.0
integer: 1
long: 1
short: 1
object:
inner1: "foo"
inner2: "bar"
text: "foo bar"
keyword_stored_norms_not_indexed: "foo bar"
- do:
headers:
Content-Type: application/json
index:
index: "test-no-dv"
id: "2"
body:
binary: "YWJjZGUxMjM0"
boolean: false
date: "2017-01-01"
geo_point: [0.0, 20.0]
ip: "192.168.0.1"
keyword: "foo"
byte: 1
double: 1.0
float: 1.0
half_float: 1.0
integer: 1
long: 1
short: 1
object:
inner1: "foo"
text: "foo bar"
keyword_stored_norms_not_indexed: "foo bar"
- do:
headers:
Content-Type: application/json
index:
index: "test-no-dv"
id: "3"
routing: "route_me"
body:
binary: "YWJjZGUxMjM0"
boolean: true
date: "2017-01-01"
geo_point: [0.0, 20.0]
ip: "192.168.0.1"
keyword: "foo"
byte: 1
double: 1.0
float: 1.0
half_float: 1.0
integer: 1
long: 1
short: 1
object:
inner2: "bar"
text: "foo bar"
keyword_stored_norms_not_indexed: "foo bar"
- do:
index:
index: "test-no-dv"
id: "4"
body: {}
- do:
indices.create:
index: test-unmapped
body:
mappings:
dynamic: false
properties:
unrelated:
type: keyword
- do:
index:
index: "test-unmapped"
id: "1"
body:
unrelated: "foo"
- do:
indices.create:
index: test-empty
body:
mappings:
dynamic: false
properties:
binary:
type: binary
date:
type: date
geo_point:
type: geo_point
ip:
type: ip
keyword:
type: keyword
byte:
type: byte
double:
type: double
float:
type: float
half_float:
type: half_float
integer:
type: integer
long:
type: long
short:
type: short
object:
type: object
properties:
inner1:
type: keyword
inner2:
type: keyword
text:
type: text
- do:
indices.refresh:
index: [test, test-unmapped, test-empty, test-no-dv]
---
"Test exists query on mapped binary field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: binary
- match: {hits.total: 3}
---
"Test exists query on mapped boolean field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: boolean
- match: {hits.total: 3}
---
"Test exists query on mapped date field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: date
- match: {hits.total: 3}
---
"Test exists query on mapped geo_point field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: geo_point
- match: {hits.total: 3}
---
"Test exists query on mapped ip field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: ip
- match: {hits.total: 3}
---
"Test exists query on mapped keyword field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: keyword
- match: {hits.total: 3}
---
"Test exists query on mapped byte field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: byte
- match: {hits.total: 3}
---
"Test exists query on mapped double field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: double
- match: {hits.total: 3}
---
"Test exists query on mapped float field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: float
- match: {hits.total: 3}
---
"Test exists query on mapped half_float field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: half_float
- match: {hits.total: 3}
---
"Test exists query on mapped integer field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: integer
- match: {hits.total: 3}
---
"Test exists query on mapped long field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: long
- match: {hits.total: 3}
---
"Test exists query on mapped short field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: short
- match: {hits.total: 3}
---
"Test exists query on mapped object field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: object
- match: {hits.total: 3}
---
"Test exists query on mapped object inner field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: object.inner1
- match: {hits.total: 2}
---
"Test exists query on mapped text field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: text
- match: {hits.total: 3}
---
"Test exists query on _id field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: _id
- match: {hits.total: 4}
---
"Test exists query on _index field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: _index
- match: {hits.total: 4}
---
"Test exists query on _routing field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: _routing
- match: {hits.total: 1}
---
"Test exists query on _seq_no field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: _seq_no
- match: {hits.total: 4}
---
"Test exists query on _source field":
- do:
catch: /query_shard_exception/
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: _source
---
"Test exists query on _version field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: _version
- match: {hits.total: 4}
---
"Test exists query on unmapped binary field":
- do:
search:
rest_total_hits_as_int: true
index: test-unmapped
body:
query:
exists:
field: binary
- match: {hits.total: 0}
---
"Test exists query on unmapped boolean field":
- do:
search:
rest_total_hits_as_int: true
index: test-unmapped
body:
query:
exists:
field: boolean
- match: {hits.total: 0}
---
"Test exists query on unmapped date field":
- do:
search:
rest_total_hits_as_int: true
index: test-unmapped
body:
query:
exists:
field: date
- match: {hits.total: 0}
---
"Test exists query on unmapped geo_point field":
- do:
search:
rest_total_hits_as_int: true
index: test-unmapped
body:
query:
exists:
field: geo_point
- match: {hits.total: 0}
---
"Test exists query on unmapped ip field":
- do:
search:
rest_total_hits_as_int: true
index: test-unmapped
body:
query:
exists:
field: ip
- match: {hits.total: 0}
---
"Test exists query on unmapped keyword field":
- do:
search:
rest_total_hits_as_int: true
index: test-unmapped
body:
query:
exists:
field: keyword
- match: {hits.total: 0}
---
"Test exists query on unmapped byte field":
- do:
search:
rest_total_hits_as_int: true
index: test-unmapped
body:
query:
exists:
field: byte
- match: {hits.total: 0}
---
"Test exists query on unmapped double field":
- do:
search:
rest_total_hits_as_int: true
index: test-unmapped
body:
query:
exists:
field: double
- match: {hits.total: 0}
---
"Test exists query on unmapped float field":
- do:
search:
rest_total_hits_as_int: true
index: test-unmapped
body:
query:
exists:
field: float
- match: {hits.total: 0}
---
"Test exists query on unmapped half_float field":
- do:
search:
rest_total_hits_as_int: true
index: test-unmapped
body:
query:
exists:
field: half_float
- match: {hits.total: 0}
---
"Test exists query on unmapped integer field":
- do:
search:
rest_total_hits_as_int: true
index: test-unmapped
body:
query:
exists:
field: integer
- match: {hits.total: 0}
---
"Test exists query on unmapped long field":
- do:
search:
rest_total_hits_as_int: true
index: test-unmapped
body:
query:
exists:
field: long
- match: {hits.total: 0}
---
"Test exists query on unmapped short field":
- do:
search:
rest_total_hits_as_int: true
index: test-unmapped
body:
query:
exists:
field: short
- match: {hits.total: 0}
---
"Test exists query on unmapped object field":
- do:
search:
rest_total_hits_as_int: true
index: test-unmapped
body:
query:
exists:
field: object
- match: {hits.total: 0}
---
"Test exists query on unmapped object inner field":
- do:
search:
rest_total_hits_as_int: true
index: test-unmapped
body:
query:
exists:
field: object.inner1
- match: {hits.total: 0}
---
"Test exists query on unmapped text field":
- do:
search:
rest_total_hits_as_int: true
index: test-unmapped
body:
query:
exists:
field: text
- match: {hits.total: 0}
---
"Test exists query on binary field in empty index":
- do:
search:
rest_total_hits_as_int: true
index: test-empty
body:
query:
exists:
field: binary
- match: {hits.total: 0}
---
"Test exists query on boolean field in empty index":
- do:
search:
rest_total_hits_as_int: true
index: test-empty
body:
query:
exists:
field: boolean
- match: {hits.total: 0}
---
"Test exists query on date field in empty index":
- do:
search:
rest_total_hits_as_int: true
index: test-empty
body:
query:
exists:
field: date
- match: {hits.total: 0}
---
"Test exists query on geo_point field in empty index":
- do:
search:
rest_total_hits_as_int: true
index: test-empty
body:
query:
exists:
field: geo_point
- match: {hits.total: 0}
---
"Test exists query on ip field in empty index":
- do:
search:
rest_total_hits_as_int: true
index: test-empty
body:
query:
exists:
field: ip
- match: {hits.total: 0}
---
"Test exists query on keyword field in empty index":
- do:
search:
rest_total_hits_as_int: true
index: test-empty
body:
query:
exists:
field: keyword
- match: {hits.total: 0}
---
"Test exists query on byte field in empty index":
- do:
search:
rest_total_hits_as_int: true
index: test-empty
body:
query:
exists:
field: byte
- match: {hits.total: 0}
---
"Test exists query on double field in empty index":
- do:
search:
rest_total_hits_as_int: true
index: test-empty
body:
query:
exists:
field: double
- match: {hits.total: 0}
---
"Test exists query on float field in empty index":
- do:
search:
rest_total_hits_as_int: true
index: test-empty
body:
query:
exists:
field: float
- match: {hits.total: 0}
---
"Test exists query on half_float field in empty index":
- do:
search:
rest_total_hits_as_int: true
index: test-empty
body:
query:
exists:
field: half_float
- match: {hits.total: 0}
---
"Test exists query on integer field in empty index":
- do:
search:
rest_total_hits_as_int: true
index: test-empty
body:
query:
exists:
field: integer
- match: {hits.total: 0}
---
"Test exists query on long field in empty index":
- do:
search:
rest_total_hits_as_int: true
index: test-empty
body:
query:
exists:
field: long
- match: {hits.total: 0}
---
"Test exists query on short field in empty index":
- do:
search:
rest_total_hits_as_int: true
index: test-empty
body:
query:
exists:
field: short
- match: {hits.total: 0}
---
"Test exists query on object field in empty index":
- do:
search:
rest_total_hits_as_int: true
index: test-empty
body:
query:
exists:
field: object
- match: {hits.total: 0}
---
"Test exists query on object inner field in empty index":
- do:
search:
rest_total_hits_as_int: true
index: test-empty
body:
query:
exists:
field: object.inner1
- match: {hits.total: 0}
---
"Test exists query on text field in empty index":
- do:
search:
rest_total_hits_as_int: true
index: test-empty
body:
query:
exists:
field: text
- match: {hits.total: 0}
---
"Test exists query on mapped binary field with no doc values":
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: binary
- match: {hits.total: 3}
---
"Test exists query on mapped boolean field with no doc values":
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: boolean
- match: {hits.total: 3}
---
"Test exists query on mapped date field with no doc values":
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: date
- match: {hits.total: 3}
---
"Test exists query on mapped geo_point field with no doc values":
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: geo_point
- match: {hits.total: 3}
---
"Test exists query on mapped ip field with no doc values":
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: ip
- match: {hits.total: 3}
---
"Test exists query on mapped keyword field with no doc values":
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: keyword
- match: {hits.total: 3}
---
"Test exists query on mapped byte field with no doc values":
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: byte
- match: {hits.total: 3}
---
"Test exists query on mapped double field with no doc values":
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: double
- match: {hits.total: 3}
---
"Test exists query on mapped float field with no doc values":
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: float
- match: {hits.total: 3}
---
"Test exists query on mapped half_float field with no doc values":
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: half_float
- match: {hits.total: 3}
---
"Test exists query on mapped integer field with no doc values":
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: integer
- match: {hits.total: 3}
---
"Test exists query on mapped long field with no doc values":
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: long
- match: {hits.total: 3}
---
"Test exists query on mapped short field with no doc values":
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: short
- match: {hits.total: 3}
---
"Test exists query on mapped object field with no doc values":
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: object
- match: {hits.total: 3}
---
"Test exists query on mapped object inner field with no doc values":
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: object.inner1
- match: {hits.total: 2}
---
"Test exists query on mapped text field with no doc values":
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: text
- match: {hits.total: 3}
---
"Test exists query on text field with empty values":
- skip:
known_issues:
- cluster_feature: "gte_v8.4.0"
fixed_by: "gte_v8.5.1"
reason: "Regression introduced in 8.4.0, fixed in 8.5.1"
- do:
index:
index: "empty_text"
id: "999"
body:
text: ""
- do:
indices.refresh:
index: [empty_text]
- do:
search:
rest_total_hits_as_int: true
index: empty_text
body:
query:
exists:
field: text
- match: {hits.total: 1}
---
"Test exists query on text field with no dv, that is stored but not indexed":
- requires:
capabilities:
- method: POST
path: /_search
capabilities: [ field_exists_query_for_text_fields_no_index_or_dv ]
test_runner_features: capabilities
reason: "Before the fix, this query would throw an ISE because the field is not indexed and has no doc values."
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: text_stored_not_indexed
# this should not throw, but rather return 0 hits, as the field is not indexed nor it has doc values
- match: {hits.total: 0}
---
"Test exists query on keyword field with no dv, that is stored, with norms, but not indexed":
- requires:
capabilities:
- method: POST
path: /_search
capabilities: [ field_exists_query_for_text_fields_no_index_or_dv ]
test_runner_features: capabilities
reason: "Before the fix, this query would throw an ISE because the field is not indexed and has no doc values."
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: keyword_stored_norms_not_indexed
# this should not throw, but rather return 0 hits, as the field is not indexed nor it has doc values
- match: {hits.total: 0}