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.2 KB
Raw Blame
---
setup:
  - do:
      indices.create:
        index: test_sliced_scroll
        body:
          settings:
            number_of_shards: 5
            number_of_routing_shards: 5

  - do:
      index:
        index:  test_sliced_scroll
        id:     "1"
        body:   { foo: 1 }

  - do:
      index:
        index:  test_sliced_scroll
        id:     "2"
        body:   { foo: 2 }

  - do:
      index:
        index:  test_sliced_scroll
        id:     "3"
        body:   { foo: 3 }

  - do:
      index:
        index:  test_sliced_scroll
        id:     "4"
        body:   { foo: 4 }

  - do:
      indices.refresh: {}

---
"Sliced scroll":
  - do:
      search:
        rest_total_hits_as_int: true
        index: test_sliced_scroll
        scroll: 1m
        sort: foo
        body:
          slice:
            id: "0"
            max: 2
          query:
            match_all: {}

  - set: {_scroll_id: scroll_id}
  - match: { _shards.successful: 5 }
  - match: {hits.total:      3    }
  - length: {hits.hits:      3    }
  - match: {hits.hits.0._id: "2" }
  - match: {hits.hits.1._id: "3" }
  - match: {hits.hits.2._id: "4" }

  - do:
      scroll:
        rest_total_hits_as_int: true
        scroll_id: $scroll_id
        scroll: 1m

  - match: {hits.total:      3    }
  - length: {hits.hits:      0    }

  - do:
      clear_scroll:
        scroll_id: $scroll_id

  - do:
      search:
        rest_total_hits_as_int: true
        index: test_sliced_scroll
        scroll: 1m
        sort: foo
        body:
          slice:
            id: "1"
            max: 2
          query:
            match_all: {}

  - set: {_scroll_id: scroll_id}
  - match: {hits.total:      1    }
  - length: {hits.hits:      1    }
  - match: {hits.hits.0._id: "1" }

  - do:
      scroll:
        rest_total_hits_as_int: true
        scroll_id: $scroll_id
        scroll: 1m

  - match: {hits.total:      1    }
  - length: {hits.hits:      0    }

  - do:
        clear_scroll:
          scroll_id: $scroll_id

---
"Sliced scroll with invalid arguments":

  - do:
        catch: bad_request
        search:
          rest_total_hits_as_int: true
          index: test_sliced_scroll
          size: 1
          scroll: 1m
          body:
            slice:
              id: "0"
              max: 1025
            query:
              match_all: {}

  - do:
        indices.put_settings:
          index: test_sliced_scroll
          body:
            index.max_slices_per_scroll: 1025

  - do:
        search:
          rest_total_hits_as_int: true
          index: test_sliced_scroll
          size: 1
          scroll: 1m
          body:
            slice:
              id: "0"
              max: 1025
            query:
              match_all: {}

  - set: {_scroll_id: scroll_id}

  - do:
        clear_scroll:
          scroll_id: $scroll_id

---
"Sliced scroll with doc values":

  - do:
      search:
        index: test_sliced_scroll
        sort: foo
        scroll: 1m
        body:
          slice:
            field: foo
            id: "0"
            max: 2
          query:
            match_all: {}

  - set: {_scroll_id: scroll_id}
  - match: { _shards.successful: 5 }
  - match: { hits.total.value: 3 }
  - length: { hits.hits: 3 }

  - do:
      clear_scroll:
        scroll_id: $scroll_id