SDK
SDK Golang v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

MDelete #

Deletes multiple documents.

Throws a partial error (error code 206) if one or more document deletions fail.

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

Arguments #

Copied to clipboard!
MDelete(
    index string,
    collection string,
    ids []string,
    options types.QueryOptions) ([]string, error)

Argument Type Description
index
string
Index name
collection
string
Collection name
ids
[]string
The ids of the documents to delete
options
types.QueryOptions
A struct containing 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
string

("")
If set to wait_for, waits for the change to be reflected for search (up to 1s)

Return #

Returns an array of strings containing the ids of the deleted documents.

Usage #

Copied to clipboard!
ids := []string{"some-id", "some-other-id"}
kuzzle.Document.Create(
  "nyc-open-data",
  "yellow-taxi",
  "some-id",
  json.RawMessage(`{}`),
  nil)
kuzzle.Document.Create(
  "nyc-open-data",
  "yellow-taxi",
  "some-other-id",
  json.RawMessage(`{}`),
  nil)
deleted, err := kuzzle.Document.MDelete("nyc-open-data", "yellow-taxi", ids, nil)
if err != nil {
  log.Fatal(err)
} else {
  fmt.Printf("Successfully deleted %d documents", len(deleted))
}