delete_

Deletes a document.

The optional parameter refresh can be used with the value wait_for in order to wait for the document to be indexed (and to be immediately available in search).

Signature

Copied to clipboard!
std::string delete_(
    const std::string& index,
    const std::string& collection,
    const std::string& id);

std::string delete_(
    const std::string& index,
    const std::string& collection,
    const std::string& id,
    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
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

The ID of the deleted document.

Exceptions

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

Usage

Copied to clipboard!
try {
  std::string id = kuzzle->document->delete_(
    "nyc-open-data",
    "yellow-taxi",
    "some-id");

  std::cout << "Document " << id << " successfully deleted" << std::endl;
} catch (kuzzleio::KuzzleException& e) {
  std::cerr << e.what() << std::endl;
}