Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Latest commit

 

History

History
65 lines (48 loc) · 2.55 KB

index.md

File metadata and controls

65 lines (48 loc) · 2.55 KB
code type title description
true
page
replace
Replace a document

replace

Replaces the content of an existing document.

Signature

std::string replace(
    const std::string& index,
    const std::string& collection,
    const std::string& id,
    const std::string& document);

std::string replace(
    const std::string& index,
    const std::string& collection,
    const std::string& id,
    const std::string& document,
    const kuzzleio::query_options& options);

Arguments

Argument Type Description
index
const std::string&
Index name
collection
const std::string&
Collection name
id
const std::string&
Document ID
document
const std::string&
JSON string representing the document
options
kuzzleio::query_options*
Query options

options

Additional query options

Option Type
(default)
Description
queuable
bool

(true)
If true, queues the request during downtime, until connected to Kuzzle again
refresh
const std::string&
("")
If set to wait_for, waits for the change to be reflected for search (up to 1s)

Return

A JSON string representing an object containing the document creation result.

Property Type Description
_id
string
ID of the newly created document
_version
number
Version of the document in the persistent data storage
_source
object
JSON string representing the replaced document
result
string
Set to replaced in case of success

Exceptions

Throws a kuzzleio::KuzzleException if there is an error. See how to handle errors.

Usage

<<< ./snippets/replace.cpp