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][&silent]
Method: PUT
Body:
{
// Document content
}
Other protocols #
{
"index": "<index>",
"collection": "<collection>",
"controller": "document",
"action": "createOrReplace",
"_id": "<documentId>",
"body": {
// document content
}
}
Kourou #
kourou document:createOrReplace <index> <collection> <id> <body>
kourou document:createOrReplace <index> <collection> <body> -a silent=true
Arguments #
collection
: collection name_id
: 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 indexedsilent
: if set, then Kuzzle will not generate notificationsAvailable since 2.9.2
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)