Add or replace a record

If a record with the specified object ID exists, the existing record is replaced. Otherwise, a new record is added to the index.

To update some attributes of an existing record, use the partial operation instead. To add, update, or replace multiple records, use the batch operation.

Usage

Required ACL: addObject
1
2
3
4
5
6
7
8
9
10
using Algolia.Search.Clients;
using Algolia.Search.Models.Search;

var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"));

var response = await client.AddOrUpdateObjectAsync(
  "ALGOLIA_INDEX_NAME",
  "uniqueID",
  new Dictionary<string, string> { { "key", "value" } }
);
Did you find this page helpful?
C# API clients v7