Core
API v2.x
2

update #

Updates a collection configuration.

Available since 2.1.0

You can update the collection mappings and settings.

While updating the collection settings, the collection will be closed until the new configuration has been applied.

The search index is automatically refreshed, so you can perform a document:search on new properties right after.


Query Syntax #

HTTP #

URL: http://kuzzle:7512/<index>/<collection>
Method: POST
Body:
{
  "mappings": {
    "dynamic": "[true|false|strict]", // boolean are also accepted
    "_meta": {
      "field": "value"
    },
    "properties": {
      "field1": {
        "type": "integer"
      },
      "field2": {
        "type": "keyword"
      },
      "field3": {
        "type":   "date",
        "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
      }
    }
  },
  "reindexCollection": true|false,
  "settings": {
    "analysis" : {
      "analyzer":{
        "content":{
          "type":"custom",
          "tokenizer":"whitespace"
        }
      }
    }
  }
}

Other protocols #

{
  "index": "<index>",
  "collection": "<collection>",
  "controller": "collection",
  "action": "update",
  "body": {
    "mappings": {
      "dynamic": "[true|false|strict]", // boolean are also accepted
      "_meta": {
        "field": "value"
      },
      "properties": {
        "field1": {
          "type": "integer"
        },
        "field2": {
          "type": "keyword"
        },
        "field3": {
          "type":   "date",
          "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
        }
      }
    },
    "reindexCollection": true|false,
    "settings": {
      "analysis" : {
        "analyzer":{
          "content":{
            "type":"custom",
            "tokenizer":"whitespace"
          }
        }
      }
    }
  }
}

Arguments #

  • collection: collection name
  • index: index name

Body properties #

  • settings: Elasticsearch index settings
  • mappings: collection mappings
  • reindexCollection: boolean, if true, the collection will be reindexed after the update
Available since 2.33.0

Response #

{
  "status": 200,
  "error": null,
  "index": "<index>",
  "collection": "<collection>",
  "action": "update",
  "controller": "collection",
  "requestId": "<unique request identifier>",
  "result": null
}

Possible errors #