loadMappings

Available since 1.7.0

Apply mappings to the storage layer.

Notes:

  • The mapping can contain any number of index and collection configurations.
  • Field definitions follow the Elasticsearch mapping format.
  • If an index or collection does not exist, it will be created automatically.
  • Mappings are loaded sequentially, one index/collection pair at a time. If a failure occurs, Kuzzle immediately interrupts the sequence.

Query Syntax

HTTP

Copied to clipboard!
URL: http://kuzzle:7512/admin/_loadMappings[?refresh=wait_for]
Method: POST
Body:
Copied to clipboard!
{
  "index-name": {
    "collection-name": {
      "properties": {
        "field1": {},
        "field2": {},
        "field...": {}
      }
    }
  }
}

Other protocols

Copied to clipboard!
{
  "controller": "admin",
  "action": "loadMappings",
  "body": {
    "index-name": {
      "collection-name": {
        "properties": {
          "field1": {},
          "field2": {},
          "field...": {}
        }
      }
    }
  }
}

Arguments

Optional:

  • refresh: if set to wait_for, Kuzzle will respond only once the mappings are loaded

Response

Returns a confirmation that the command is being executed.

Copied to clipboard!
{
  "requestId": "d16d5e8c-464a-4589-938f-fd84f46080b9",
  "status": 200,
  "error": null,
  "controller": "admin",
  "action": "loadMappings",
  "collection": null,
  "index": null,
  "result": { "acknowledge": true }
}