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.1 KB
Raw Blame
setup:
    - do:
        indices.create:
            index: test
            body:
                mappings:
                    properties:
                        mydate:
                            type: date
                            format: "uuuu-MM-dd'T'HH:mm:ss.SSSSSSSSSZZZZZ"

    - do:
        index:
            index: test
            id: "1"
            body: { "mydate": "2021-08-12T01:00:00.000000000+02:00" }

    - do:
        indices.refresh: {}

---
"respect offsets in range bounds":
    - requires:
        cluster_features: ["gte_v7.16.0"]
        reason: "Fixed in 7.16"
    - do:
        search:
            rest_total_hits_as_int: true
            body: {
                      "query": {
                        "match_all": {}
                      },
                      "aggregations": {
                        "myagg": {
                          "date_range": {
                            "field": "mydate",
                            "ranges": [
                              {
                                "from": "2021-08-12T00:00:00.000000000+02:00",
                                "to": "2021-08-12T02:00:00.000000000+02:00"
                              }
                            ]
                          }
                        }
                      }
                    }
    - match: { hits.total: 1 }
    - length: { aggregations.myagg.buckets: 1 }
    - match: { aggregations.myagg.buckets.0.from_as_string: "2021-08-11T22:00:00.000000000Z" }
    - match: { aggregations.myagg.buckets.0.from: 1628719200000 }
    - match: { aggregations.myagg.buckets.0.to_as_string: "2021-08-12T00:00:00.000000000Z" }
    - match: { aggregations.myagg.buckets.0.to: 1628726400000 }
    - match: { aggregations.myagg.buckets.0.doc_count: 1 }

---
"offsets and timezones play nicely together":
    - requires:
        cluster_features: ["gte_v7.16.0"]
        reason: "Fixed in 7.16"
    - do:
        search:
            rest_total_hits_as_int: true
            body: {
                      "query": {
                        "match_all": {}
                      },
                      "aggregations": {
                        "myagg": {
                          "date_range": {
                            "time_zone": "America/New_York",
                            "field": "mydate",
                            "ranges": [
                              {
                                "from": "2021-08-12T00:00:00.000000000+02:00",
                                "to": "2021-08-12T02:00:00.000000000+02:00"
                              }
                            ]
                          }
                        }
                      }
                    }
    - match: { hits.total: 1 }
    - length: { aggregations.myagg.buckets: 1 }
    - match: { aggregations.myagg.buckets.0.from_as_string: "2021-08-11T18:00:00.000000000-04:00" }
    - match: { aggregations.myagg.buckets.0.from: 1628719200000 }
    - match: { aggregations.myagg.buckets.0.to_as_string: "2021-08-11T20:00:00.000000000-04:00" }
    - match: { aggregations.myagg.buckets.0.to: 1628726400000 }
    - match: { aggregations.myagg.buckets.0.doc_count: 1 }