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.

6.2 KB
Raw Blame
---
"Array of objects":



  - do:
      bulk:
        refresh: true
        body:
          - index:
              _index: test_index
              _id:    test_id
          - f1: v1
            f2: 42
          - index:
              _index: test_index
              _id:    test_id2
          - f1: v2
            f2: 47

  - do:
      count:
        index: test_index

  - match: {count: 2}

---
"Empty _id":



  - do:
      bulk:
        refresh: true
        body:
          - index:
              _index: test
              _id: ''
          - f: 1
          - index:
              _index: test
              _id: id
          - f: 2
          - index:
              _index: test
          - f: 3
  - match: { errors: true }
  - match: { items.0.index.status: 400 }
  - match: { items.0.index.error.type: illegal_argument_exception }
  - match: { items.0.index.error.reason: if _id is specified it must not be empty }
  - match: { items.1.index.result: created }
  - match: { items.2.index.result: created }

  - do:
      count:
        index: test

  - match: { count: 2 }

---
"Empty _id with op_type create":
  - requires:
      cluster_features: ["gte_v7.5.0"]
      reason: "auto id + op type create only supported since 7.5"

  - do:
      bulk:
        refresh: true
        body:
          - index:
              _index: test
              _id: ''
          - f: 1
          - index:
              _index: test
              _id: id
          - f: 2
          - index:
              _index: test
          - f: 3
          - create:
              _index: test
          - f: 4
          - index:
              _index: test
              op_type: create
          - f: 5
  - match: { errors: true }
  - match: { items.0.index.status: 400 }
  - match: { items.0.index.error.type: illegal_argument_exception }
  - match: { items.0.index.error.reason: if _id is specified it must not be empty }
  - match: { items.1.index.result: created }
  - match: { items.2.index.result: created }
  - match: { items.3.create.result: created }
  - match: { items.4.create.result: created }

  - do:
      count:
        index: test

  - match: { count: 4 }


---
"empty action":

  - skip:
      features: headers

  - do:
      catch: /Malformed action\/metadata line \[3\], expected FIELD_NAME but found \[END_OBJECT\]/
      headers:
        Content-Type: application/json
      bulk:
        body: |
           {"index": {"_index": "test_index", "_id": "test_id"}}
           {"f1": "v1", "f2": 42}
           {}

---
"When setting require_alias flag per request":
  - requires:
      cluster_features: ["gte_v7.10.0"]
      reason: "require_alias flag was added in version 7.10"

  - do:
      indices.create:
        index: backing_index
        body:
          mappings: {}
          aliases:
            test_require_alias: {}
  - do:
      bulk:
        refresh: true
        body:
          - index:
              _index: new_index_not_created
              require_alias: true
          - f: 1
          - index:
              _index: new_index_created
          - f: 2
          - index:
              _index: test_require_alias
              require_alias: true
          - f: 3
          - create:
              _index: test_require_alias
          - f: 4
  - match: { errors: true }
  - match: { items.0.index.status: 404 }
  - match: { items.0.index.error.type: index_not_found_exception }
  - match: { items.0.index.error.reason: "no such index [new_index_not_created] and [require_alias] request flag is [true] and [new_index_not_created] is not an alias" }
  - match: { items.1.index.result: created }
  - match: { items.2.index.result: created }
  - match: { items.3.create.result: created }

  - do:
      catch: missing
      indices.get:
        index: new_index_not_created
---
"When setting require_alias flag":
  - requires:
      cluster_features: ["gte_v7.10.0"]
      reason: "require_alias flag was added in version 7.10"

  - do:
      indices.create:
        index: backing_index
        body:
          mappings: {}
          aliases:
            test_require_alias: {}
  - do:
      bulk:
        refresh: true
        require_alias: true
        body:
          - index:
              _index: new_index_not_created
          - f: 1
          - index:
              _index: new_index_created
              require_alias: false
          - f: 2
          - index:
              _index: test_require_alias
          - f: 3
  - match: { errors: true }
  - match: { items.0.index.status: 404 }
  - match: { items.0.index.error.type: index_not_found_exception }
  - match: { items.0.index.error.reason: "no such index [new_index_not_created] and [require_alias] request flag is [true] and [new_index_not_created] is not an alias" }
  - match: { items.1.index.result: created }
  - match: { items.2.index.result: created }

  - do:
      catch: missing
      indices.get:
        index: new_index_not_created
---
"Return item-level error when no write index defined for an alias":

  - do:
      indices.create:
        index: test_index1
  - do:
      indices.create:
        index: test_index2

  - do:
      indices.put_alias:
        index: test_index1
        name: test_index
  - do:
      indices.put_alias:
        index: test_index2
        name: test_index

  - do:
      bulk:
        body:
          - '{"index": {"_index": "test_index"}}'
          - '{"field": "test"}'

  - match: { errors: true }
  - match: { items.0.index.status: 400 }
  - match: { items.0.index.error.type: illegal_argument_exception }
  - match: { items.0.index.error.reason: "no write index is defined for alias [test_index]. The write index may be explicitly disabled using is_write_index=false or the alias points to multiple indices without one being designated as a write index" }

---
"Took is not orders of magnitude off":
  - requires:
      cluster_features: ["gte_v8.15.1"]
      reason: "Bug reporting wrong took time introduced in 8.15.0, fixed in 8.15.1"
  - do:
      bulk:
        body:
          - index:
              _index: took_test
          - f: 1
          - index:
              _index: took_test
          - f: 2
          - index:
              _index: took_test
          - f: 3
  - match: { errors: false }
  - gte: { took: 0 }
  - lte: { took: 60000 } # Making sure we have a reasonable upper bound and that we're not for example returning nanoseconds