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.

DeleteByQuery #

Deletes documents matching the provided search query.

Kuzzle uses the ElasticSearch Query DSL syntax.

Arguments #

Copied to clipboard!
DeleteByQuery(
  index string,
  collection string,
  query json.RawMessage,
  options types.QueryOptions) ([]string, error)

Argument Type Description
index
string
Index name
collection
string
Collection name
query
string
Query to match
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 the list of the deleted document ids.

Usage #

Copied to clipboard!
ids, err := kuzzle.Document.DeleteByQuery(
  "nyc-open-data",
  "yellow-taxi",
  json.RawMessage(`{"query": {"term": {"capacity": 7}}}`),
  nil)
if err != nil {
  log.Fatal(err)
} else {
  fmt.Printf("Successfully deleted %d documents", len(ids))
}