GoLang

GoLang

Algolia Search API client for Golang, v3

Sign up

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

Get started

  • Install
    1
    go get github.com/algolia/algoliasearch-client-go/v3@v3.Y.Z
  • Index
    1
    type Contact struct {
    2
      ObjectID  string `json:"objectID"`
    3
      Firstname string `json:"firstname"`
    4
      Lastname  string `json:"lastname"`
    5
    }
    6
    7
    contacts := []Contact{
    8
      {ObjectID: "myID1", Firstname: "Jimmie", Lastname: "Barninger"},
    9
      {ObjectID: "myID2", Firstname: "Ray", Lastname: "Charles"},
    10
    }
    11
    12
    res, err := index.SaveObjects(contacts)
  • Search
    1
    params := []interface{}{
    2
      opt.AttributesToRetrieve("firstname", "lastname"),
    3
      opt.HitsPerPage(50),
    4
    }
    5
    6
    res, err := index.Search("jimmie paint", params...)
Get started for free
Explore developer docs