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.

1.6 KB
Raw Blame

Mappings, templates & aliases

Use case doc: config / operations

Schema introspection + index templates + aliases — ES-identical.

✅ get mapping

curl -s "http://localhost:9200/articles/_mapping"
{
  "articles": {
    "mappings": {
      "properties": {
        "body": {
          "type": "text"
        },
        "tag": {
          "type": "keyword"
        },
        "title": {
          "type": "text"
        },
        "views": {
          "type": "integer"
        }
      }
    }
  }
}

HTTP 200

✅ put index template

curl -s -XPUT "http://localhost:9200/_index_template/logs_tpl" \
  -H 'content-type: application/json' \
  -d '{"index_patterns":["logs-*"],"template":{"mappings":{"properties":{"@timestamp":{"type":"date"},"level":{"type":"keyword"},"msg":{"type":"text"}}}}}'
{
  "acknowledged": true
}

HTTP 200

✅ add alias

curl -s -XPOST "http://localhost:9200/_aliases" \
  -H 'content-type: application/json' \
  -d '{"actions":[{"add":{"index":"articles","alias":"articles_live"}}]}'
{
  "acknowledged": true
}

HTTP 200

✅ search via alias

curl -s -XPOST "http://localhost:9200/articles_live/_search" \
  -H 'content-type: application/json' \
  -d '{"size":0,"query":{"match_all":{}}}'
{
  "_shards": {
    "failed": 0,
    "skipped": 0,
    "successful": 1,
    "total": 1
  },
  "hits": {
    "hits": [],
    "max_score": null,
    "total": {
      "relation": "eq",
      "value": 5
    }
  },
  "timed_out": false,
  "took": 0
}

HTTP 200