After your initial upload, keep your up to date with incremental updates.
Track additions, changes, and deletions in your data source,
then apply them to the corresponding in Algolia.
Incremental updates rely on the objectID attribute to match your source data to the right record.
Derive each record’s objectID from the source item’s unique identifier and keep it stable.
Changing the objectID can create a second record instead of updating the existing one.For more information, see Unique record identifiers.
Use a connector
to schedule updates from a supported source, such as a database or a hosted JSON or CSV file.To send updates from your own code, use the API methods in the following sections.
If you want Algolia to transform records before indexing them,
use Push to Algolia instead of calling the Search API directly.
When you add data to your source,
use the saveObjects method to send the corresponding records to Algolia.To run the code examples on this page, install the latest API client.
To replace an existing record, use saveObjects with its objectID and the complete updated record.
Algolia replaces the entire record, removing any existing attributes you omit.Use full record updates when your system can send the complete record,
even if you don’t know which attributes changed.
Partial updates let you change specific attributes without sending the complete record.
This is useful when different systems manage different attributes of the same record.Use the partialUpdateObjects method and pass each record’s objectID with the attributes to update.
Other attributes in the record remain unchanged.If an attribute you update contains a JSON object, include every value you want to keep in that object.
Algolia replaces the object rather than merging its contents.The following example sets createIfNotExists to true,
so Algolia creates a record if the specified objectID doesn’t exist.
To delete records that match an attribute value,
use the deleteBy method.
Specify the condition in the request’s filters parameter.
For example, brand:brandName deletes all records whose brand attribute is brandName.To filter on the brand string attribute,
add it to your index’s attributesForFaceting.
var response = await client.DeleteByAsync( "INDEX_NAME", new DeleteByParams { Filters = "brand:brandName" });