Core
API v2.x
2

loadFixtures #

Load fixtures into the storage layer.

Notes:

  • The fixtures can contain any number of index and collection configurations.
  • Each collection contains an array of data to load, just like the bulk:import API.
  • If an index or collection does not exist, the load will fail.
  • Fixtures are loaded sequentially, one index/collection pair at a time. If a failure occurs, Kuzzle immediately interrupts the sequence, without rollbacking the previously loaded fixtures.

Query Syntax #

HTTP #

URL: http://kuzzle:7512/admin/_loadFixtures[?refresh=wait_for]
Method: POST
Body:
{
  "index-name": {
    "collection-name": [
      {"create": { "_id": "uniq-id-123456" }},
      {"field": "value", "field2": "value", "field...", "value"}
    ]
  }
}

Other protocols #

{
  "controller": "admin",
  "action": "loadFixtures",
  "body": {
    "index-name": {
      "collection-name": [
        {"create": { "_id": "uniq-id-123456" }},
        {"field": "value", "field2": "value", "field...", "value"}
      ]
    }
  }
}

Arguments #

Optional: #

  • refresh: default value is wait_for and Kuzzle will not respond until the fixtures are loaded and indexed

Set the refresh value to false in you want to load the fixtures faster between steps of functional tests for example.


Response #

Returns a confirmation that the command is being executed.

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