You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
372: Redesign update API to task API r=alallema a=alallema
### Breaking Changes
All the actions on indexes are now asynchronous:
- `create_index()`, `update_index()`, `delete_index()` return a `task` response instead of an `Index`.
- `index.create` and `index.delete` from index return a `task`.
- `wait_for_pending_update()`
- is renamed into `wait_for_task`
- the current `index.wait_for_task()` method call `/tasks/:uid`
- `index.get_update_status` is renamed `index.get_task`
- `index.get_all_update_status` is renamed `index.get_tasks`
**Notes:** The only two methods that now return an `Index` are `client.index()` and `client.get_index()`
### Enhancements
- new method `client.wait_for_task()` call `/tasks/:uid`
- new method `client.get_tasks` that calls `/tasks`
- new method `client.get_task` that calls `/tasks/:uid`
### Misc
- `delete_if_exists` and `get_or_create_index` are commented since we don't know yet if we will remove them or not.
Co-authored-by: alallema <[email protected]>
Co-authored-by: Amélie <[email protected]>
With the `updateId`, you can check the status (`enqueued`, `processing`, `processed` or `failed`) of your documents addition using the [update endpoint](https://docs.meilisearch.com/reference/api/updates.html#get-an-update-status).
93
+
With the task `uid`, you can check the status (`enqueued`, `processing`, `succeeded` or `failed`) of your documents addition using the [task endpoint](https://docs.meilisearch.com/reference/api/tasks.html#get-one-task).
Dictionary containing a list of all enqueued, processing, succeeded or failed tasks.
314
+
315
+
Raises
316
+
------
317
+
MeiliSearchApiError
318
+
An error containing details about why MeiliSearch can't process your request. MeiliSearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
319
+
"""
320
+
returnget_tasks(self.config)
321
+
322
+
defget_task(self, uid: int) ->Dict[str, Any]:
323
+
"""Get one task.
324
+
325
+
Parameters
326
+
----------
327
+
uid:
328
+
Identifier of the task.
329
+
330
+
Returns
331
+
-------
332
+
task:
333
+
Dictionary containing information about the processed asynchronous task.
334
+
335
+
Raises
336
+
------
337
+
MeiliSearchApiError
338
+
An error containing details about why MeiliSearch can't process your request. MeiliSearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
339
+
"""
340
+
returnget_task(self.config, uid)
341
+
342
+
defwait_for_task(
343
+
self, uid: int,
344
+
timeout_in_ms: int=5000,
345
+
interval_in_ms: int=50,
346
+
) ->Dict[str, Any]:
347
+
"""Wait until MeiliSearch processes a task until it fails or succeeds.
348
+
349
+
Parameters
350
+
----------
351
+
uid:
352
+
Identifier of the task to wait for being processed.
353
+
timeout_in_ms (optional):
354
+
Time the method should wait before raising a MeiliSearchTimeoutError
355
+
interval_in_ms (optional):
356
+
Time interval the method should wait (sleep) between requests
357
+
358
+
Returns
359
+
-------
360
+
task:
361
+
Dictionary containing information about the processed asynchronous task.
362
+
363
+
Raises
364
+
------
365
+
MeiliSearchTimeoutError
366
+
An error containing details about why MeiliSearch can't process your request. MeiliSearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
0 commit comments