- C#
- Dart
- Go
- Java
- JavaScript
- Kotlin
- PHP
- Python
- Ruby
- Scala
- Swift
Latest version: Install version 7 of the C#/.NET API clients by adding the The C#/.NET API clients are open source and generated from OpenAPI specifications.
Algolia.Search package from NuGet.
For example:Command line
dotnet add package Algolia.Search --version "7.*"
Building ASP.NET apps?
Check the additional information about dependency injection.
Latest version: Install version 1 the Dart API clients by adding the The Dart API clients are open source and generated from OpenAPI specifications.
algoliasearch package as a dependency to your project.Command line
dart pub add algoliasearch:'^1.0'
Latest version: Install version 4 of the Go API clients by adding the The Go API clients are open source and generated from OpenAPI specifications.
algoliasearch-client-go package as a dependency to your module.Command line
go get github.com/algolia/algoliasearch-client-go/v4
Latest version: Install version 4 of the Java API clients by adding the following dependencies to your project.
For Maven, add the following dependencies to your For Gradle, add the following dependencies to your Replace
pom.xml file:pom.xml
<dependency>
<groupId>com.algolia</groupId>
<artifactId>algoliasearch</artifactId>
<version>VERSION</version>
</dependency>
build.gradle file:build.gradle
dependencies {
implementation 'com.algolia:algoliasearch:VERSION'
}
VERSION with the version of the API clients you want to install.
You can find the available releases on Maven Central.If you don’t use Maven or Gradle,
you can download the JAR files.The Java API clients are open source and generated from OpenAPI specifications.Latest version: To install version 5 of the JavaScript API clients, add the The The JavaScript API clients are open source and generated from OpenAPI specifications.
algoliasearch package as a dependency to your project.npm install algoliasearch@5
algoliasearch package includes API clients for the Search API,
the Personalization API, the Analytics API,
and the A/B testing API.
If you only need to access methods from a specific API, you can install API clients separately:# Search API
npm install @algolia/client-search
# Recommend API
npm install @algolia/recommend
# Analytics API
npm install @algolia/client-analytics
# A/B testing API
npm install @algolia/client-abtesting
# Ingestion API
npm install @algolia/ingestion
# Insights API
npm install @algolia/client-insights
# Monitoring
npm install @algolia/monitoring
# Personalization API
npm install @algolia/client-personalization
# Query Suggestions API
npm install @algolia/client-query-suggestions
# Usage API
npm install @algolia/client-usage
Latest version: To install version 3 of the Kotlin API clients, add the following
dependencies to your The Kotlin API clients are open source and generated from OpenAPI specifications.
build.gradle file:build.gradle
repositories {
mavenCentral()
}
dependencies {
implementation 'com.algolia:algoliasearch-client-kotlin:ALGOLIA_VERSION'
// You need to specify a Ktor engine suitable for your platform
runtimeOnly 'io.ktor:ktor-client-java:KTOR_VERSION'
}
-
Replace
ALGOLIA_VERSIONwith the version of the Kotlin API client you want to install. You can find the released versions on Maven Central. -
Replace
KTOR_VERSIONwith the version of the Ktor client you want to use. To learn more about the available engines, see Client engines.
build.gradle
repositories {
mavenCentral()
}
dependencies {
implementation platform("com.algolia:algoliasearch-client-kotlin-bom:ALGOLIA_VERSION")
// define dependencies without versions
implementation 'com.algolia:algoliasearch-client-kotlin'
runtimeOnly 'io.ktor:ktor-client-java'
}
Latest version: To install version 4 of the PHP API clients,
install the The PHP API clients are open source and generated from OpenAPI specifications.
algoliasearch-client-php package with with composer.Command line
composer require algolia/algoliasearch-client-php "^4.0"
Building Laravel apps?
Check the Laravel integration built on top of the PHP API client.
Building Symfony apps?
Check the Symfony integration built on top of the PHP API client.
Latest version: To install version 4 of the Python API clients, install the The Python API clients are open source and generated from OpenAPI specifications.
algoliasearch package.
The Python API clients support Python 3.8 or later.Command line
pip install "algoliasearch>=4,<5"
Building Django apps?
Check the Django integration built on top of the Python API client.
Latest version: To install version 3 of the Ruby API clients,
add the The Ruby API clients are open source and generated from OpenAPI specifications.
algolia gem as a dependency to your project.
The Ruby API clients support Ruby 2.2 or later.Command line
bundle add algolia --version='~>3.0'
# or: gem install algolia -v '~>3.0'
Building Ruby on Rails apps?
Check the Ruby on Rails integration built on top of the Ruby API client.
Latest version: To install version 2 of the Scala API clients,
add the following dependencies to your Replace
build.sbt file:build.sbt
libraryDependencies += "com.algolia" %% "algoliasearch-scala" % "VERSION"
VERSION with the version of the API clients you want to install.
You can find the available releases on Maven Central:The Scala API clients are open source and generated from OpenAPI specifications.Latest version: To install version 9 of the Swift API clients,
add the With CocoaPods, add the following to your With Carthage, add the following to your The Swift API clients are open source and generated from OpenAPI specifications.
algoliasearch-client-swift package as a dependency to your project.With the Swift Package Manager,
add the following dependencies to your Package.swift file:Swift
let package = Package(
// ...
dependencies: [
.package(url: "https://github.com/algolia/algoliasearch-client-swift.git", from: "9.0.0")
],
targets: [
.target(
// ...
dependencies: [
.product(name: "Search", package: "algoliasearch-client-swift")
]
)
]
)
Podfile:Podfile
pod("AlgoliaSearchClient", "~> 9.0.0")
Cartfile:Cartfile
github "algolia/algoliasearch-client-swift" ~> 9.0.0
Test your installation
To test your installation, try running a short program that adds a record to a test index, searches your index, and prints the results.Create account
If you haven’t already, create an Algolia account.
Copy code
Copy the following code into a new project or file.
Replace
ALGOLIA_APPLICATION_ID and ALGOLIA_API_KEY with values from your account.
Make sure to use an API key with addObject and search permissions.using Algolia.Search.Clients;
using Algolia.Search.Models.Search;
var appID = "ALGOLIA_APPLICATION_ID";
// API key with `addObject` and `search` ACL
var apiKey = "ALGOLIA_API_KEY";
var indexName = "test-index";
var client = new SearchClient(appID, apiKey);
// Create a new record
var record = new Dictionary<string, string>
{
{ "objectID", "object-1" },
{ "name", "test record" },
};
// Add record to an index
var saveResp = await client.SaveObjectAsync(indexName, record);
// Wait until indexing is done
await client.WaitForTaskAsync(indexName, saveResp.TaskID);
// Search for 'test'
var searchResp = await client.SearchAsync<Object>(
new SearchMethodParams
{
Requests = new List<SearchQuery>
{
new SearchQuery(new SearchForHits { IndexName = indexName, Query = "test" })
}
}
);
Console.WriteLine(searchResp.ToJson());
In production, use environment variables for your credentials.