go_small_white Created with Sketch.

Getting Started


Download AlgoliaSearch using

go get github.com/algolia/algoliasearch-client-go/algoliasearch


Migration note from v1.x to v2.x

In June 2016, we released the v2 of our Go client. If you were using version 1.x of the client, read the migration guide to version 2.x. Version 1.x are no longer under active development. They are still supported for bug fixes, but will not receive new features.

Init Index

To begin, you will need to initialize the client. In order to do this you will need your Application ID and API Key. You can find both on your Algolia account.

import "github.com/algolia/algoliasearch-client-go/algoliasearch"

client := algoliasearch.NewClient("YourApplicationID", "YourAPIKey")
index := client.InitIndex("your_index_name")

You need to replace your_index_name by the name of the index you want to use. If you want to target an existing index you can find the name from the dashboard. If the index does not exist you can choose any name and it will be created when you perform an add objects or a set settings operation.

If an api key is displayed in the previous snippet it is your ADMIN API Key. To maintain security, never use your ADMIN API Key on your frontend or share it with anyone. In your frontend, use the SEARCH ONLY API Key or any other key that has search only rights.