Skip to content

armgit / xerj

Public Imported from GitHub
0

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.

3.9 KB
Raw Blame
---
setup:
  - requires:
      cluster_features: ["mapper.keyword.store_high_cardinality_in_binary_doc_values"]
      reason: "testing binary doc values search"

  - do:
      indices.create:
        index:  test
        body:
          mappings:
            dynamic: false
            properties:
              keyword:
                type: keyword
                index: false
                doc_values:
                  cardinality: high

  - do:
      index:
        index: test
        id: "1"
        body:
          keyword: "key1"

  - do:
      index:
        index: test
        id: "2"
        body:
          keyword: "key2"
  - do:
      indices.refresh: {}

---
"Test match query on keyword field where only binary doc values are enabled":

  - do:
      search:
        index: test
        body: { query: { match: { keyword: { query: "key1" } } } }
  - length:   { hits.hits: 1  }

---
"Test terms query on keyword field where only binary doc values are enabled":

  - do:
      search:
        index: test
        body: { query: { terms: { keyword: [ "key1", "key2" ] } } }
  - length:   { hits.hits: 2  }

---
"Test range query on keyword field where only binary doc values are enabled":

  - do:
      search:
        index: test
        body: { query: { range: { keyword: { gte: "key1" } } } }
  - length:   { hits.hits: 2  }

---
"Test fuzzy query on keyword field where only binary doc values are enabled":

  - do:
      search:
        index: test
        body: { query: { fuzzy: { keyword: { value: "kay1", fuzziness: 1 } } } }
  - length:   { hits.hits: 1  }

---
"Test prefix query on keyword field where only binary doc values are enabled":

  - do:
      search:
        index: test
        body: { query: { prefix: { keyword: { value: "key" } } } }
  - length:   { hits.hits: 2  }

---
"Test case insensitive term query on keyword field where only binary doc values are enabled":

  - do:
      search:
        index: test
        body: { query: { term: { keyword: { value: "KeY1", case_insensitive: true } } } }
  - length:   { hits.hits: 1  }

---
"Test wildcard query on keyword field where only binary doc values are enabled":

  - do:
      search:
        index: test
        body: { query: { wildcard: { keyword: { value: "k*1" } } } }
  - length:   { hits.hits: 1  }

---
"Test wildcard contains query on keyword field where only binary doc values are enabled":

  - do:
      search:
        index: test
        body: { query: { wildcard: { keyword: { value: "*ey*" } } } }
  - length:   { hits.hits: 2  }

---
"Test wildcard contains query matches single doc":

  - do:
      search:
        index: test
        body: { query: { wildcard: { keyword: { value: "*ey1*" } } } }
  - length:   { hits.hits: 1  }
  - match: { hits.hits.0._id: "1" }

---
"Test wildcard contains query no match":

  - do:
      search:
        index: test
        body: { query: { wildcard: { keyword: { value: "*xyz*" } } } }
  - length:   { hits.hits: 0  }

---
"Test case insensitive wildcard query on keyword field where only binary doc values are enabled":

  - do:
      search:
        index: test
        body: { query: { wildcard: { keyword: { value: "K*1", case_insensitive: true } } } }
  - length:   { hits.hits: 1  }

---
"Test case insensitive wildcard contains query":

  - do:
      search:
        index: test
        body: { query: { wildcard: { keyword: { value: "*EY*", case_insensitive: true } } } }
  - length:   { hits.hits: 2  }

---
"Test regexp query on keyword field where only binary doc values are enabled":

  - do:
      search:
        index: test
        body: { query: { regexp: { keyword: { value: "k.*1" } } } }
  - length:   { hits.hits: 1  }

---
"Test sort on keyword field where only binary doc values are enabled":

  - do:
      search:
        index: test
        body: { sort: [ { keyword: { "order": "desc" } } ] }
  - length:   { hits.hits: 2  }
  - match: { hits.hits.0.sort.0: key2 }
  - match: { hits.hits.1.sort.0: key1 }