Sep 20, 2024
Search API client
The Search API client is part of the algoliasearch
package.
You can add this package to your pom.xml
file for Maven:
Copy
1
2
3
4
5
<dependency>
<groupId>com.algolia</groupId>
<artifactId>algoliasearch</artifactId>
<version>4.7.0</version>
</dependency>
or to your build.gradle
file for Gradle:
Copy
1
implementation 'com.algolia:algoliasearch:4.7.0'
To use the Search client, add these imports to your files:
Copy
1
2
import com.algolia.api.SearchClient;
import com.algolia.model.search.*;
To create an instance of the client:
Copy
1
SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");
List of methods
Each method makes one request to the Search API. The Search API client also includes helper methods that wrap one or more of these methods. For more information, see Helper methods.
Search
client.searchSingleIndex | Search an index |
client.search | Search multiple indices |
client.searchForFacetValues | Search for facet values |
client.browse | Browse for records |
Records
client.saveObject | Add or replace a record |
client.getObject | Retrieve a record |
client.addOrUpdateObject | Add or replace a record |
client.deleteObject | Delete a record |
client.deleteBy | Delete records matching a query |
client.clearObjects | Delete all records from an index |
client.partialUpdateObject | Add or update attributes |
client.batch | Batch indexing operations on one index |
client.multipleBatch | Batch indexing operations on multiple indices |
client.getObjects | Retrieve records |
Indices
client.deleteIndex | Delete an index |
client.getSettings | Retrieve index settings |
client.setSettings | Update index settings |
client.getTask | Check task status |
client.operationIndex | Copy or move an index |
client.listIndices | List indices |
Synonyms
client.getSynonym | Retrieve a synonym |
client.saveSynonym | Create or replace a synonym |
client.deleteSynonym | Delete a synonym |
client.saveSynonyms | Create or replace synonyms |
client.clearSynonyms | Delete all synonyms |
client.searchSynonyms | Search for synonyms |
API keys
client.listApiKeys | List API keys |
client.addApiKey | Create an API key |
client.getApiKey | Retrieve API key permissions |
client.updateApiKey | Update an API key |
client.deleteApiKey | Delete an API key |
client.restoreApiKey | Restore an API key |
Rules
client.getRule | Retrieve a rule |
client.saveRule | Create or replace a rule |
client.deleteRule | Delete a rule |
client.saveRules | Create or update rules |
client.clearRules | Delete all rules |
client.searchRules | Search for rules |
Dictionaries
client.batchDictionaryEntries | Add or delete dictionary entries |
client.searchDictionaryEntries | Search dictionary entries |
client.getDictionarySettings | Retrieve dictionary settings |
client.setDictionarySettings | Update dictionary settings |
client.getDictionaryLanguages | List available languages |
Clusters
client.listUserIds | List user IDs |
client.assignUserId | Assign or move a user ID |
client.batchAssignUserIds | Assign multiple userIDs |
client.getTopUserIds | Get top user IDs |
client.getUserId | Retrieve user ID |
client.removeUserId | Delete user ID |
client.listClusters | List clusters |
client.searchUserIds | Search for user IDs |
client.hasPendingMappings | Get migration and user mapping status |
Vaults
client.getSources | List allowed sources |
client.replaceSources | Replace allowed sources |
client.appendSource | Add a source |
client.deleteSource | Delete a source |
Advanced
client.getLogs | Retrieve log entries |
client.getAppTask | Check application task status |
Did you find this page helpful?