Skip to content

[bug]: Cannot wait for objects to finish indexing after save_objects() #574

@lappemic

Description

@lappemic

Description

When using save_objects() to add items to an index, I can't find a way to wait for the indexing to complete. I tried:

  • Using .wait()
  • Using wait_for_task()

But the neither of them worked.

Example code

from algoliasearch.search.client import SearchClientSync

algolia_client = SearchClientSync(ALGOLIA_APP_ID, ALGOLIA_ADMIN_KEY)

# Upload items to Algolia index
save_resp = algolia_client.save_objects(ALGOLIA_INDEX_NAME, new_items) # also tried .wait() here

# Tried this approach but getting error that wait_for_task() does not exist
algolia_client.wait_for_task(
    index_name=ALGOLIA_INDEX_NAME,
    task_id=save_resp.task_id
)```

## Expected behavior
- After calling `wait()` or `wait_for_task()`, the program should await until the indexing is finished
- There should be a clear way to wait for indexing to complete

## Questions
1. What is the correct way to wait for objects to be fully indexed?
2. Is there any documentation about this? The ones i found were not helpful but rather a bit confusing.

### Client

Crawler

### Version

4.6.5

### Relevant log output

_No response_

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions