DeleteByQuery #
Deletes documents matching the provided search query.
Kuzzle uses the ElasticSearch Query DSL syntax.
Arguments #
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 #
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))
}
Edit this page on Github(opens new window)