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.

2.0 KB
Raw Blame
setup:
  - do:
      indices.create:
          index: test
          body:
            settings:
              number_of_shards: 1
            mappings:
              properties:
                tags:
                  type: text
                number:
                  type: integer

  - do:
      bulk:
        index: test
        refresh: true
        body:
          - '{"index": {}}'
          - '{"tags": "kibana", "number": 1}'
          - '{"index": {}}'
          - '{"tags": "kibana", "number": 2}'
          - '{"index": {}}'
          - '{"tags": "kibana", "number": 3}'
          - '{"index": {}}'
          - '{"tags": "javascript", "number": 4}'

---
small shard_size:
  - do:
      search:
        body:
          query:
            query_string:
              query: 'tags:kibana OR tags:javascript'
          aggs:
            sample:
              sampler:
                shard_size: 1
              aggs:
                min_number:
                  min:
                    field: number
                max_number:
                  max:
                    field: number


  - match: { hits.total.value: 4 }
  - match: { aggregations.sample.doc_count: 1 }
  # The document with 4 has the highest score so we pick that one.
  - match: { aggregations.sample.min_number.value: 4.0 }
  - match: { aggregations.sample.max_number.value: 4.0 }

---
default shard size:
  - do:
      search:
        body:
          query:
            query_string:
              query: 'tags:kibana OR tags:javascript'
          aggs:
            sample:
              sampler: {}
              aggs:
                min_number:
                  min:
                    field: number
                max_number:
                  max:
                    field: number

  - match: { hits.total.value: 4 }
  # The default shard size is much larger than the four test documents we are working with
  - match: { aggregations.sample.doc_count: 4 }
  - match: { aggregations.sample.min_number.value: 1.0 }
  - match: { aggregations.sample.max_number.value: 4.0 }