04 · REFERENCE

Native REST API

Port 8080. Use it for anything new. The native surface has the explain plan, the turbo-ingest path, and the log-shaped endpoints the ES compat layer can't express cleanly.

METHOD
PATH
DESCRIPTION
GET
/v1/health
Liveness + readiness. Returns {status, uptime_s, version}.
GET
/v1/metrics
Prometheus text format. Scrape-friendly. See Metrics.
PUT
/v1/indices/:name
Create an index with a field mapping body.
GET
/v1/indices/:name
Return schema, segment list, doc count.
DELETE
/v1/indices/:name
Drop the index.
POST
/v1/indices/:name/docs
Single-doc indexing. JSON body.
POST
/v1/indices/:name/turbo-ingest
NDJSON bulk path. Parallel tokenization behind the scenes.
POST
Unified query endpoint — full-text, term, range, KNN, hybrid.
POST
/v1/indices/:name/_explain
Return the optimizer tree with per-node cost and row counts.
POST
/v1/indices/:name/logs
Log-optimized ingest path. Auto-detects Apache/Nginx/ISO timestamps.
POST
/v1/indices/:name/syslog
Syslog RFC-5424 ingest.
POST
/v1/indices/:name/otlp
OpenTelemetry OTLP ingest. No collector sidecar.
GET
/v1/indices/:name/_mapping
Field catalog. Drives the dashboards' schema-aware UIs.

Request body shape — /v1/indices/:name/search

{
  "query": {
    "bool": {
      "must":   [ { "match": { "message": "login failed" } } ],
      "filter": [
        { "term":  { "service": "auth" } },
        { "range": { "@timestamp": { "gte": "now-1h" } } }
      ]
    }
  },
  "aggs": {
    "by_host": { "terms": { "field": "host", "size": 10 } }
  },
  "size": 100,
  "sort": [ { "@timestamp": "desc" } ]
}

Per-field score breakdown — "explain": true

Add "explain": true to a search body to see how much of each hit's _score came from each field. For every field the query scores on, the engine runs the query again with only that field's clauses, limited to the returned hits. Each number is the engine's own score for that field.

// should: [ match title "bone density" (boost 2), match body "vitamin" ]
"_score": 3.6435528,
"_score_breakdown": {
  "fields": [ { "field": "title", "score": 3.1769588 }, { "field": "body", "score": 0.4665940 } ],
  "combine": "sum",
  "unattributed": 0.0
}

combine: "sum" means the query adds its field scores (bool, match, most_fields), so _score = the sum of fields + unattributed. combine: "other" means the scores combine another way: the max (best_fields, dis_max), a product (function_score), or one clause over all fields (a field-less query). In that case the per-field numbers do not add up to _score. Each scored field adds one search, up to 64 fields. The ES-compatible explain on _search and _explain are unchanged.

Source · engine/crates/xerj-api/src/native.rs · engine/crates/xerj-api/src/field_explain.rs · engine/crates/xerj-api/src/router.rs