View API Reference

Indexing

Methods

API Method Description PHP Ruby JS Python iOS Android C# Java Go Scala name
Add objects

Add new objects (records) to an index.

addObjects add_objects addObjects add_objects addObjects addObjectsAsync AddObjects addObjects AddObjects index into
Update objects

Replace an existing object with an updated set of attributes.

saveObjects save_objects saveObjects save_objects saveObjects saveObjectsAsync SaveObjects saveObjects UpdateObjects index into
Partial update objects

Update one or more attributes of an existing object.

partialUpdateObjects partial_update_objects partialUpdateObjects partial_update_objects partialUpdateObjects partialUpdateObjectsAsync PartialUpdateObjects PartialUpdateObjects PartialUpdateObjects partialUpdate
Delete objects

Remove objects from an index using their object ids.

deleteObjects delete_objects deleteObjects delete_objects deleteObjects deleteObjectsAsync DeleteObjects deleteObjects DeleteObjects delete from
Delete by query

Remove all objects matching a query.

deleteBy delete_by deleteBy delete_by deleteBy deleteByAsync DeleteBy deleteByQuery DeleteByQuery deleteByQuery
Get objects

Get one or more objects using their object ids.

getObjects get_objects getObjects get_objects getObjects getObjectsAsync getObjects getObjects GetObjects get from "index"
Custom batch

Perform several indexing operations in one API call.

batch batch batch batch batch batchAsync Batch batch Batch batch
Wait for operations

Wait for a task to complete before executing the next line of code, to synchronize index updates.

waitTask wait_task waitTask wait_task waitTask waitTaskAsync WaitTask waitTask WaitTask waitFor task

Creating indexes

You don’t need to explicitly create an index, as it will be automatically created the first time you add an object.

Objects are schema-less so you don’t need any pre-configuration to start indexing.

If you wish to configure your index, the settings section provides details about advanced settings.

Add, Update and Partial Update differences

Add Objects

The Add Objects method does not require an objectID.

  • If you do supply an objectID:
    • If the objectID does not exist in the index, the record will be created
    • If the objectID already exists, the record will be replaced
  • If you do not supply an objectID:
    • Algolia will automatically assign an objectID, which will be returned in the response

Update Objects

The Update Objects method requires an objectID.

  • If the objectID exists, the record will be replaced
  • If the objectID does not exist, the record is created
  • If no objectID is supplied, the method returns an error

Note: Update Object is also known as Save Object. In this context, the terms are used interchangeably.

Partial Update Ojects

The Partial Update Objects method requires an objectID.

  • If the objectID exists, the attributes will be replaced
  • If the objectID does not exist, the record is created
  • If no objectID is specified, the method returns an error

Note: Partial Update does not replace the whole object, it only adds, removes, or updates the attributes mentioned; the remaining attributes are left untouched. This is different from Add Object and Update Object, both of which replace the whole object.

For all three

  • The method for all three can be singular or plural.
    • If singular (e.g. AddObject), the method accepts only one object as a parameter
    • If plural (e.g. AddObjects), the method can accept one or many objects

Note: See the indvidual methods for more information on syntax and usage.

Terminology

Object / Record

We use these 2 words interchangeably. Sometimes witin the same sentence. So don’t place any significance on their usage:

  • Indexes contain objects or records
  • JSON contains objects or records

Attribute

All objects and records contain attributes. Sometimes we refer to them as fields, or elements. Within the search and indexing contexts, we often speak of settings and parameters. Again, these terms are mostly interchangeable.

Some attributes are simple key/value pairs. But others can be more complex, making it look more like a collection or an object.