curl --request POST \
--url https://algolia_application_id.algolia.net/1/dictionaries/plurals/batch \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-algolia-api-key: ALGOLIA_API_KEY' \
--header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID' \
--data '
{
"clearExistingDictionaryEntries": false,
"requests": [
{
"action": "addEntry",
"body": {
"objectID": "828afd405e1f4fe950b6b98c2c43c032",
"language": "af",
"word": "the",
"words": [
"cheval",
"cheveaux"
],
"decomposition": [
"kopf",
"schmerz",
"tablette"
],
"state": "enabled",
"type": "custom"
}
}
]
}
'// Initialize the client
var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"));
// Call the API
var response = await client.BatchDictionaryEntriesAsync(
Enum.Parse<DictionaryType>("Plurals"),
new BatchDictionaryEntriesParams
{
ClearExistingDictionaryEntries = true,
Requests = new List<BatchDictionaryEntriesRequest>
{
new BatchDictionaryEntriesRequest
{
Action = Enum.Parse<DictionaryAction>("AddEntry"),
Body = new DictionaryEntry
{
ObjectID = "1",
Language = Enum.Parse<SupportedLanguage>("En"),
Word = "fancy",
Words = new List<string> { "believe", "algolia" },
Decomposition = new List<string> { "trust", "algolia" },
State = Enum.Parse<DictionaryEntryState>("Enabled"),
},
},
},
}
);
// print the response
Console.WriteLine(response);// Initialize the client
final client =
SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY');
// Call the API
final response = await client.batchDictionaryEntries(
dictionaryName: DictionaryType.fromJson("plurals"),
batchDictionaryEntriesParams: BatchDictionaryEntriesParams(
clearExistingDictionaryEntries: true,
requests: [
BatchDictionaryEntriesRequest(
action: DictionaryAction.fromJson("addEntry"),
body: DictionaryEntry(
objectID: "1",
language: SupportedLanguage.fromJson("en"),
word: "fancy",
words: [
"believe",
"algolia",
],
decomposition: [
"trust",
"algolia",
],
state: DictionaryEntryState.fromJson("enabled"),
),
),
],
),
);
// print the response
print(response);// Initialize the client
client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")
if err != nil {
// The client can fail to initialize if you pass an invalid parameter.
panic(err)
}
// Call the API
response, err := client.BatchDictionaryEntries(client.NewApiBatchDictionaryEntriesRequest(
search.DictionaryType("plurals"),
search.NewEmptyBatchDictionaryEntriesParams().SetClearExistingDictionaryEntries(true).SetRequests(
[]search.BatchDictionaryEntriesRequest{
*search.NewEmptyBatchDictionaryEntriesRequest().SetAction(search.DictionaryAction("addEntry")).SetBody(
search.NewEmptyDictionaryEntry().SetObjectID("1").SetLanguage(search.SupportedLanguage("en")).SetWord("fancy").SetWords(
[]string{"believe", "algolia"}).SetDecomposition(
[]string{"trust", "algolia"}).SetState(search.DictionaryEntryState("enabled"))),
}),
))
if err != nil {
// handle the eventual error
panic(err)
}
// print the response
print(response)// Initialize the client
SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");
// Call the API
UpdatedAtResponse response = client.batchDictionaryEntries(
DictionaryType.PLURALS,
new BatchDictionaryEntriesParams()
.setClearExistingDictionaryEntries(true)
.setRequests(
Arrays.asList(
new BatchDictionaryEntriesRequest()
.setAction(DictionaryAction.ADD_ENTRY)
.setBody(
new DictionaryEntry()
.setObjectID("1")
.setLanguage(SupportedLanguage.EN)
.setWord("fancy")
.setWords(Arrays.asList("believe", "algolia"))
.setDecomposition(Arrays.asList("trust", "algolia"))
.setState(DictionaryEntryState.ENABLED)
)
)
)
);
// print the response
System.out.println(response);// Initialize the client
const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY');
// Call the API
const response = await client.batchDictionaryEntries({
dictionaryName: 'plurals',
batchDictionaryEntriesParams: {
clearExistingDictionaryEntries: true,
requests: [
{
action: 'addEntry',
body: {
objectID: '1',
language: 'en',
word: 'fancy',
words: ['believe', 'algolia'],
decomposition: ['trust', 'algolia'],
state: 'enabled',
},
},
],
},
});
// print the response
console.log(response);// Initialize the client
val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY")
// Call the API
var response =
client.batchDictionaryEntries(
dictionaryName = DictionaryType.entries.first { it.value == "plurals" },
batchDictionaryEntriesParams =
BatchDictionaryEntriesParams(
clearExistingDictionaryEntries = true,
requests =
listOf(
BatchDictionaryEntriesRequest(
action = DictionaryAction.entries.first { it.value == "addEntry" },
body =
DictionaryEntry(
objectID = "1",
language = SupportedLanguage.entries.first { it.value == "en" },
word = "fancy",
words = listOf("believe", "algolia"),
decomposition = listOf("trust", "algolia"),
state = DictionaryEntryState.entries.first { it.value == "enabled" },
),
)
),
),
)
// print the response
println(response)// Initialize the client
$client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY');
// Call the API
$response = $client->batchDictionaryEntries(
'plurals',
['clearExistingDictionaryEntries' => true,
'requests' => [
['action' => 'addEntry',
'body' => ['objectID' => '1',
'language' => 'en',
'word' => 'fancy',
'words' => [
'believe',
'algolia',
],
'decomposition' => [
'trust',
'algolia',
],
'state' => 'enabled',
],
],
],
],
);
// print the response
var_dump($response);# Initialize the client
# In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods.
client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")
# Call the API
response = client.batch_dictionary_entries(
dictionary_name="plurals",
batch_dictionary_entries_params={
"clearExistingDictionaryEntries": True,
"requests": [
{
"action": "addEntry",
"body": {
"objectID": "1",
"language": "en",
"word": "fancy",
"words": [
"believe",
"algolia",
],
"decomposition": [
"trust",
"algolia",
],
"state": "enabled",
},
},
],
},
)
# print the response
print(response)# Initialize the client
client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")
# Call the API
response = client.batch_dictionary_entries(
"plurals",
Algolia::Search::BatchDictionaryEntriesParams.new(
clear_existing_dictionary_entries: true,
requests: [
Algolia::Search::BatchDictionaryEntriesRequest.new(
action: "addEntry",
body: Algolia::Search::DictionaryEntry.new(
algolia_object_id: "1",
language: "en",
word: "fancy",
words: ["believe", "algolia"],
decomposition: ["trust", "algolia"],
state: "enabled"
)
)
]
)
)
# print the response
puts(response)// Initialize the client
val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY")
// Call the API
val response = Await.result(
client.batchDictionaryEntries(
dictionaryName = DictionaryType.withName("plurals"),
batchDictionaryEntriesParams = BatchDictionaryEntriesParams(
clearExistingDictionaryEntries = Some(true),
requests = Seq(
BatchDictionaryEntriesRequest(
action = DictionaryAction.withName("addEntry"),
body = DictionaryEntry(
objectID = "1",
language = Some(SupportedLanguage.withName("en")),
word = Some("fancy"),
words = Some(Seq("believe", "algolia")),
decomposition = Some(Seq("trust", "algolia")),
state = Some(DictionaryEntryState.withName("enabled"))
)
)
)
)
),
Duration(100, "sec")
)
// print the response
println(response)// Initialize the client
let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY")
// Call the API
let response = try await client.batchDictionaryEntries(
dictionaryName: DictionaryType.plurals,
batchDictionaryEntriesParams: BatchDictionaryEntriesParams(
clearExistingDictionaryEntries: true,
requests: [BatchDictionaryEntriesRequest(
action: DictionaryAction.addEntry,
body: DictionaryEntry(
objectID: "1",
language: SearchSupportedLanguage.en,
word: "fancy",
words: ["believe", "algolia"],
decomposition: ["trust", "algolia"],
state: DictionaryEntryState.enabled
)
)]
)
)
// print the response
print(response){
"taskID": 1514562690001,
"updatedAt": "2023-07-04T12:49:15Z"
}{
"message": "Invalid Application-Id or API-Key"
}{
"message": "Invalid Application-Id or API-Key"
}{
"message": "Invalid Application-Id or API-Key"
}{
"message": "Invalid Application-Id or API-Key"
}Add or delete dictionary entries
Adds or deletes multiple entries from your plurals, segmentation, or stop word dictionaries.
curl --request POST \
--url https://algolia_application_id.algolia.net/1/dictionaries/plurals/batch \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-algolia-api-key: ALGOLIA_API_KEY' \
--header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID' \
--data '
{
"clearExistingDictionaryEntries": false,
"requests": [
{
"action": "addEntry",
"body": {
"objectID": "828afd405e1f4fe950b6b98c2c43c032",
"language": "af",
"word": "the",
"words": [
"cheval",
"cheveaux"
],
"decomposition": [
"kopf",
"schmerz",
"tablette"
],
"state": "enabled",
"type": "custom"
}
}
]
}
'// Initialize the client
var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"));
// Call the API
var response = await client.BatchDictionaryEntriesAsync(
Enum.Parse<DictionaryType>("Plurals"),
new BatchDictionaryEntriesParams
{
ClearExistingDictionaryEntries = true,
Requests = new List<BatchDictionaryEntriesRequest>
{
new BatchDictionaryEntriesRequest
{
Action = Enum.Parse<DictionaryAction>("AddEntry"),
Body = new DictionaryEntry
{
ObjectID = "1",
Language = Enum.Parse<SupportedLanguage>("En"),
Word = "fancy",
Words = new List<string> { "believe", "algolia" },
Decomposition = new List<string> { "trust", "algolia" },
State = Enum.Parse<DictionaryEntryState>("Enabled"),
},
},
},
}
);
// print the response
Console.WriteLine(response);// Initialize the client
final client =
SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY');
// Call the API
final response = await client.batchDictionaryEntries(
dictionaryName: DictionaryType.fromJson("plurals"),
batchDictionaryEntriesParams: BatchDictionaryEntriesParams(
clearExistingDictionaryEntries: true,
requests: [
BatchDictionaryEntriesRequest(
action: DictionaryAction.fromJson("addEntry"),
body: DictionaryEntry(
objectID: "1",
language: SupportedLanguage.fromJson("en"),
word: "fancy",
words: [
"believe",
"algolia",
],
decomposition: [
"trust",
"algolia",
],
state: DictionaryEntryState.fromJson("enabled"),
),
),
],
),
);
// print the response
print(response);// Initialize the client
client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")
if err != nil {
// The client can fail to initialize if you pass an invalid parameter.
panic(err)
}
// Call the API
response, err := client.BatchDictionaryEntries(client.NewApiBatchDictionaryEntriesRequest(
search.DictionaryType("plurals"),
search.NewEmptyBatchDictionaryEntriesParams().SetClearExistingDictionaryEntries(true).SetRequests(
[]search.BatchDictionaryEntriesRequest{
*search.NewEmptyBatchDictionaryEntriesRequest().SetAction(search.DictionaryAction("addEntry")).SetBody(
search.NewEmptyDictionaryEntry().SetObjectID("1").SetLanguage(search.SupportedLanguage("en")).SetWord("fancy").SetWords(
[]string{"believe", "algolia"}).SetDecomposition(
[]string{"trust", "algolia"}).SetState(search.DictionaryEntryState("enabled"))),
}),
))
if err != nil {
// handle the eventual error
panic(err)
}
// print the response
print(response)// Initialize the client
SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");
// Call the API
UpdatedAtResponse response = client.batchDictionaryEntries(
DictionaryType.PLURALS,
new BatchDictionaryEntriesParams()
.setClearExistingDictionaryEntries(true)
.setRequests(
Arrays.asList(
new BatchDictionaryEntriesRequest()
.setAction(DictionaryAction.ADD_ENTRY)
.setBody(
new DictionaryEntry()
.setObjectID("1")
.setLanguage(SupportedLanguage.EN)
.setWord("fancy")
.setWords(Arrays.asList("believe", "algolia"))
.setDecomposition(Arrays.asList("trust", "algolia"))
.setState(DictionaryEntryState.ENABLED)
)
)
)
);
// print the response
System.out.println(response);// Initialize the client
const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY');
// Call the API
const response = await client.batchDictionaryEntries({
dictionaryName: 'plurals',
batchDictionaryEntriesParams: {
clearExistingDictionaryEntries: true,
requests: [
{
action: 'addEntry',
body: {
objectID: '1',
language: 'en',
word: 'fancy',
words: ['believe', 'algolia'],
decomposition: ['trust', 'algolia'],
state: 'enabled',
},
},
],
},
});
// print the response
console.log(response);// Initialize the client
val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY")
// Call the API
var response =
client.batchDictionaryEntries(
dictionaryName = DictionaryType.entries.first { it.value == "plurals" },
batchDictionaryEntriesParams =
BatchDictionaryEntriesParams(
clearExistingDictionaryEntries = true,
requests =
listOf(
BatchDictionaryEntriesRequest(
action = DictionaryAction.entries.first { it.value == "addEntry" },
body =
DictionaryEntry(
objectID = "1",
language = SupportedLanguage.entries.first { it.value == "en" },
word = "fancy",
words = listOf("believe", "algolia"),
decomposition = listOf("trust", "algolia"),
state = DictionaryEntryState.entries.first { it.value == "enabled" },
),
)
),
),
)
// print the response
println(response)// Initialize the client
$client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY');
// Call the API
$response = $client->batchDictionaryEntries(
'plurals',
['clearExistingDictionaryEntries' => true,
'requests' => [
['action' => 'addEntry',
'body' => ['objectID' => '1',
'language' => 'en',
'word' => 'fancy',
'words' => [
'believe',
'algolia',
],
'decomposition' => [
'trust',
'algolia',
],
'state' => 'enabled',
],
],
],
],
);
// print the response
var_dump($response);# Initialize the client
# In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods.
client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")
# Call the API
response = client.batch_dictionary_entries(
dictionary_name="plurals",
batch_dictionary_entries_params={
"clearExistingDictionaryEntries": True,
"requests": [
{
"action": "addEntry",
"body": {
"objectID": "1",
"language": "en",
"word": "fancy",
"words": [
"believe",
"algolia",
],
"decomposition": [
"trust",
"algolia",
],
"state": "enabled",
},
},
],
},
)
# print the response
print(response)# Initialize the client
client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")
# Call the API
response = client.batch_dictionary_entries(
"plurals",
Algolia::Search::BatchDictionaryEntriesParams.new(
clear_existing_dictionary_entries: true,
requests: [
Algolia::Search::BatchDictionaryEntriesRequest.new(
action: "addEntry",
body: Algolia::Search::DictionaryEntry.new(
algolia_object_id: "1",
language: "en",
word: "fancy",
words: ["believe", "algolia"],
decomposition: ["trust", "algolia"],
state: "enabled"
)
)
]
)
)
# print the response
puts(response)// Initialize the client
val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY")
// Call the API
val response = Await.result(
client.batchDictionaryEntries(
dictionaryName = DictionaryType.withName("plurals"),
batchDictionaryEntriesParams = BatchDictionaryEntriesParams(
clearExistingDictionaryEntries = Some(true),
requests = Seq(
BatchDictionaryEntriesRequest(
action = DictionaryAction.withName("addEntry"),
body = DictionaryEntry(
objectID = "1",
language = Some(SupportedLanguage.withName("en")),
word = Some("fancy"),
words = Some(Seq("believe", "algolia")),
decomposition = Some(Seq("trust", "algolia")),
state = Some(DictionaryEntryState.withName("enabled"))
)
)
)
)
),
Duration(100, "sec")
)
// print the response
println(response)// Initialize the client
let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY")
// Call the API
let response = try await client.batchDictionaryEntries(
dictionaryName: DictionaryType.plurals,
batchDictionaryEntriesParams: BatchDictionaryEntriesParams(
clearExistingDictionaryEntries: true,
requests: [BatchDictionaryEntriesRequest(
action: DictionaryAction.addEntry,
body: DictionaryEntry(
objectID: "1",
language: SearchSupportedLanguage.en,
word: "fancy",
words: ["believe", "algolia"],
decomposition: ["trust", "algolia"],
state: DictionaryEntryState.enabled
)
)]
)
)
// print the response
print(response){
"taskID": 1514562690001,
"updatedAt": "2023-07-04T12:49:15Z"
}{
"message": "Invalid Application-Id or API-Key"
}{
"message": "Invalid Application-Id or API-Key"
}{
"message": "Invalid Application-Id or API-Key"
}{
"message": "Invalid Application-Id or API-Key"
}editSettingsAuthorizations
Your Algolia application ID.
Your Algolia API key with the necessary permissions to make the request. Permissions are controlled through access control lists (ACL) and access restrictions. The required ACL to make a request is listed in each endpoint's reference.
Path Parameters
Dictionary type in which to search.
plurals, stopwords, compounds Body
Request body for updating dictionary entries.
Response
OK
Response, taskID, and update timestamp.
Unique identifier of a task.
A successful API response means that a task was added to a queue.
It might not run immediately.
You can check the task's progress with the task operation and this task ID.
1514562690001
Date and time when the object was updated, in RFC 3339 format.
"2023-07-04T12:49:15Z"
Was this page helpful?