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.

SearchSpecifications #

Searches collection specifications.

There is a limit to how many items can be returned by a single search query. That limit is by default set at 10000, and you can't get over it even with the from and size pagination options.

When processing a large number of items (i.e. more than 1000), it is advised to paginate the results using SearchResult.next rather than increasing the size parameter.

Arguments #

Copied to clipboard!
SearchSpecifications(
  query json.RawMessage,
  options types.QueryOptions) (*types.SearchResult, error)

Argument Type Description
query
json.RawMessage
Query to match
options
types.QueryOptions
A struct containing query options

options #

Options Type (default) Description
queuable
boolean
(true)
If true, queues the request during downtime, until connected to Kuzzle again
from
int

(0)
Offset of the first document to fetch
size
int

(10)
Maximum number of documents to retrieve per page
scroll
string

("")
When set, gets a forward-only cursor having its ttl set to the given value (ie 30s; cf elasticsearch time limits)

Query properties #

Optional: #

An empty body matches all documents in the queried collection.

Return #

Returns a types.SearchResult struct

Usage #

Copied to clipboard!
options := types.NewQueryOptions()
options.SetFrom(0)
options.SetSize(2)
response, err := kuzzle.Collection.SearchSpecifications(json.RawMessage(`{
  "query": {
    "match_all": {} 
  }
}`), options)
if err != nil {
  log.Fatal(err)
} else {
  fmt.Printf("Successfully retrieved %d specifications", response.Total)
}