SDK
SDK Golang v3.x
2

Truncate #

Removes all documents from a collection while keeping the associated mapping.
It is faster than deleting all documents from a collection.

Arguments #

Truncate(index string, collection string, options types.QueryOptions) error
ArgumentsTypeDescription
index
string
Index name
collection
string
Collection name
options
types.QueryOptions
Query options

options #

Additional query options

PropertyTypeDescriptionDefault
queuable
bool
Make this request queuable or nottrue

Return #

Return an error is something was wrong.

Usage #

err := kuzzle.Collection.Truncate("nyc-open-data", "yellow-taxi", nil)
if err != nil {
  log.Fatal(err)
} else {
  fmt.Println("Success")
}