Method: Algolia::SearchClient#delete_objects

Defined in:
lib/algolia/api/search_client.rb

#delete_objects(index_name, object_ids, wait_for_tasks = false, request_options = {}) ⇒ BatchResponse

Helper: Deletes every records for the given objectIDs. The chunked_batch helper is used under the hood, which creates a batch requests with at most 1000 objectIDs in it.

Parameters:

  • index_name (String)

    : The index_name to delete object_ids from.

  • object_ids (Array)

    : The object_ids to delete.

  • wait_for_tasks (Boolean) (defaults to: false)

    : Whether or not we should wait until every batch tasks has been processed, this operation may slow the total execution time of this method but is more reliable.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (BatchResponse)


3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
# File 'lib/algolia/api/search_client.rb', line 3363

def delete_objects(index_name, object_ids, wait_for_tasks = false, request_options = {})
  chunked_batch(
    index_name,
    object_ids.map { |id| {"objectID" => id} },
    Search::Action::DELETE_OBJECT,
    wait_for_tasks,
    1000,
    request_options
  )
end