Search API Client for Golang

Features

  • Gives API access to all Algolia functionality, settings, advanced features, and ML/AI products
  • Typed requests and responses
  • First-class support for user-defined structures
  • Background retry strategy to ensure uptime
  • Seamless batching via iterators to optimize number of network calls
  • Zero downtime reindexing feature
  • Injectable HTTP client

Version

  • Supports Go 1.11 and above

Related Integrations

  • Android, Javascript, Firebase 
  • InstantSearch for React, Vue, Angular, vanilla 
  • Autocomplete

Key links


Get started

INSTALL

1go get github.com/algolia/algoliasearch-client-go/v3@v3.Y.Z

INDEX

1type Contact struct {
2  ObjectID  string `json:"objectID"`
3  Firstname string `json:"firstname"`
4  Lastname  string `json:"lastname"`
5}
6
7contacts := []Contact{
8  {ObjectID: "myID1", Firstname: "Jimmie", Lastname: "Barninger"},
9  {ObjectID: "myID2", Firstname: "Ray", Lastname: "Charles"},
10}
11
12res, err := index.SaveObjects(contacts)

SEARCH

1params := []interface{}{
2  opt.AttributesToRetrieve("firstname", "lastname"),
3  opt.HitsPerPage(50),
4}
5
6res, err := index.Search("jimmie paint", params...)

Built with Algolia