createOrReplace #
Creates a new document in the persistent data storage, or replaces its content if it already exists.
Query Syntax #
HTTP #
URL: http://kuzzle:7512/<index>/<collection>/<documentId>[?refresh=wait_for]
Method: PUT
Body:
{
// Document content
}
Other protocols #
{
"index": "<index>",
"collection": "<collection>",
"controller": "document",
"action": "createOrReplace",
"_id": "<documentId>",
"body": {
// document content
}
}
Arguments #
collection
: collection namedocumentId
: unique identifier of the document to create or replaceindex
: index name
Optional: #
refresh
: if set towait_for
, Kuzzle will not respond until the created/replaced document is indexed
Body properties #
New document content.
Response #
Returns an object with the following properties:
_id
: created document unique identifier_source
: document content_version
: version of the created documentcreated
: a boolean telling if a new document has been created
{
"status": 200,
"error": null,
"index": "<index>",
"collection": "<collection>",
"controller": "document",
"action": "createOrReplace",
"requestId": "<unique request identifier>",
"result": {
"_id": "<documentId>",
"_source": {
// document content
},
"_version": 1,
"created": true
}
}
Edit this page on Github(opens new window)