This quickstart demonstrates various usages of the the Algolia Go API Client.
- An Algolia account. If you don't have one already, create an account for free.
- A Go >= 1.11 local environment, or Docker.
Using VSCode
By using VScode and having the Visual Studio Code Remote - Containers extension installed, you can run any of the quickstarts by using the command Remote-Containers: Open Folder in Container command.
Each of the quickstart contains a .devcontainer.json, along with a Dockerfile.
- Create an Algolia Application and an Algolia Index
- Copy the file .env.example and rename it to
.env
- Set the environment variables
ALGOLIA_APP_ID
,ALGOLIA_API_KEY
andALGOLIA_INDEX_NAME
in the.env
file. You can obtain those from the Algolia Dashboard. TheALGOLIA_API_KEY
should be the "Admin API Key" (necessary for indexing).
The module has two dependencies:
- Algolia GO API client
- GoDotEnv - for using environment variables
Install these dependencies using the go build command.
go build
Once setup, you can run each of the script in this folder using the Go command line.
Example: to execute the simple.go
script:
go run simple.go
File | Description |
---|---|
simple.go | Index a single object and run a search query |
indexing.go | Showcase of the main indexing methods |
generate_key.go | Generate a rate limted search API key |