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
1746: v0.28 tasks r=maryamsulemani97 a=dichotommy
Changes related to the tasks API in v0.28. For a description of these changes, see the [associated issue](#1706).
Co-authored-by: Tommy Melvin <[email protected]>
Co-authored-by: Tommy <[email protected]>
Copy file name to clipboardExpand all lines: learn/advanced/asynchronous_operations.md
+32-35Lines changed: 32 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,6 @@ For example, updating the `filterableAttributes` index setting will require as m
10
10
11
11
Currently, these are Meilisearch's asynchronous operations:
12
12
13
-
- Updating index settings
14
-
- Adding documents to an index
15
-
- Updating documents in an index
16
13
- Creating an index
17
14
- Updating an index
18
15
- Deleting an index
@@ -24,40 +21,40 @@ Currently, these are Meilisearch's asynchronous operations:
24
21
25
22
## Understanding tasks
26
23
27
-
Most of Meilisearch's asynchronous operations belong to a category called "tasks". After you have requested an asynchronous operation, you can use the [task API](/reference/api/tasks.md) to find the detailed status of your request. To do so, you will need your task's `uid`.
24
+
All of Meilisearch's asynchronous operations belong to a category called "tasks". After you have requested an asynchronous operation, you can use the [task API](/reference/api/tasks.md) to find the detailed status of your request. To do so, you will need the task's unique identifier.
28
25
29
-
### Response
26
+
### Task API response
30
27
31
28
The response from the [task API](/reference/api/tasks.md) will always include the following fields in the stated order:
|`uid`| integer | The unique sequential identifier of the task |
36
-
|`indexUid`| string | The unique index identifier |
37
-
|`status`| string | The status of the task. Possible values are `enqueued`, `processing`, `succeeded`, `failed`|
38
-
|`type`| string | The type of task. Possible values are `indexCreation`, `indexUpdate`, `indexDeletion`, `documentAddition`, `documentPartial`, `documentDeletion`, `settingsUpdate`, `clearAll`|
39
-
|`details`| object | Detailed information on the task payload |
40
-
|`error`| object | Error details and context. Only present when a task has the `failed` status |
41
-
|`duration`| string | The total elapsed time the task spent in the `processing` state, in ISO 8601 format |
42
-
|`enqueuedAt`| string | The date and time when the task was first `enqueued`, in RFC 3339 format |
43
-
|`startedAt`| string | The date and time when the task began `processing`, in RFC 3339 format |
44
-
|`finishedAt`| string | The date and time when the task finished processing, whether `failed` or `succeeded`, in RFC 3339 format. |
|`uid`| integer | The unique sequential identifier of the task |
33
+
|`indexUid`| string | The unique index identifier |
34
+
|`status`| string | The status of the task. Possible values are `enqueued`, `processing`, `succeeded`, `failed`|
35
+
|`type`| string | The type of task. Possible values are `indexCreation`, `indexUpdate`, `indexDeletion`, `documentAdditionOrUpdate`, `documentDeletion`, `settingsUpdate`|
36
+
|`details`| object | Detailed information on the task payload |
37
+
|`error`| object | Error details and context. Only present when a task has the `failed` status |
38
+
|`duration`| string | The total elapsed time the task spent in the `processing` state, in ISO 8601 format |
39
+
|`enqueuedAt`| string | The date and time when the task was first `enqueued`, in RFC 3339 format |
40
+
|`startedAt`| string | The date and time when the task began `processing`, in RFC 3339 format |
41
+
|`finishedAt`| string | The date and time when the task finished processing, whether `failed` or `succeeded`, in RFC 3339 format. |
45
42
46
43
If a task fails due to an error, all error fields will be appended to the task response in an `error` object.
47
44
48
45
### Summarized task objects
49
46
50
-
All asynchronous operations return a summarized version of the [`task` object](#response). It contains the following fields in the stated order:
47
+
All asynchronous operations return a summarized version of [the full `task` object](#task-api-response). It contains the following fields in the stated order:
|`status`| string | Status of the task. Value is `enqueued`|
54
+
|`type`| string | Type of task |
55
+
|`enqueuedAt`| string | Represents the date and time in the RFC 3339 format when the task has been `enqueued`|
59
56
60
-
You can use this `uid` to get more details on [the status of the task](/reference/api/tasks.md#get-task).
57
+
You can use this `taskUid` to get more details on [the status of the task](/reference/api/tasks.md#get-one-task).
61
58
62
59
### Task `status`
63
60
@@ -70,16 +67,16 @@ Task responses always contain a field indicating the request's current `status`.
70
67
71
68
### Examples
72
69
73
-
Suppose you add a new document to your instance using the [add documents endpoint](/reference/api/documents.md#add-or-replace-documents) and receive a `uid` in response.
70
+
Suppose you add a new document to your instance using the [add documents endpoint](/reference/api/documents.md#add-or-replace-documents) and receive a `taskUid` in response.
74
71
75
-
When you query the task endpoint using this `uid`, you see that it has been enqueued:
72
+
When you query the [get task endpoint](/reference/api/tasks.md#get-one-task) using this value, you see that it has been enqueued:
76
73
77
74
```json
78
75
{
79
76
"uid": 1,
80
77
"indexUid": "movies",
81
78
"status": "enqueued",
82
-
"type": "documentAddition",
79
+
"type": "documentAdditionOrUpdate",
83
80
"details": {
84
81
"receivedDocuments": 67493,
85
82
"indexedDocuments": null
@@ -98,7 +95,7 @@ Later, you check the request's status one more time. It was successfully process
98
95
"uid": 1,
99
96
"indexUid": "movies",
100
97
"status": "succeeded",
101
-
"type": "documentAddition",
98
+
"type": "documentAdditionOrUpdate",
102
99
"details": {
103
100
"receivedDocuments": 67493,
104
101
"indexedDocuments": 67493
@@ -117,7 +114,7 @@ Had the task failed, the response would have included an `error` object:
117
114
"uid": 1,
118
115
"indexUid": "movies",
119
116
"status": "failed",
120
-
"type": "documentAddition",
117
+
"type": "documentAdditionOrUpdate",
121
118
"details": {
122
119
"receivedDocuments": 67493,
123
120
"indexedDocuments": 0
@@ -137,10 +134,10 @@ Had the task failed, the response would have included an `error` object:
137
134
138
135
## Task workflow
139
136
140
-
1. When you make a task request, Meilisearch puts it in the task queue, sets the task's `status` to `enqueued` and returns a [`task` object](/learn/advanced/asynchronous_operations.md#response)
137
+
1. When you make an [asynchronous request](#which-operations-are-async), Meilisearch puts it in the task queue, sets the task's `status` to `enqueued` and returns a [summarized `task` object](/learn/advanced/asynchronous_operations.md#summarized-task-objects)
141
138
2. When your task reaches the front of the queue, Meilisearch begins working on it and changes the request `status` to `processing`
142
139
3. Once the task has completed processing, Meilisearch marks it as `succeeded`, if it was successful, or `failed`, if there was an error.
143
-
4. Tasks marked as `succeeded` or `failed` are not deleted and will remain visible in [the task list](/reference/api/tasks.md#get-all-tasks)
140
+
4. Tasks marked as `succeeded` or `failed` are not deleted and will remain visible in [the task list](/reference/api/tasks.md#get-tasks)
144
141
145
142
### Dumps
146
143
@@ -156,8 +153,8 @@ Meilisearch's asynchronous tasks are atomic. This means that all operations conc
156
153
157
154
What happens to an asynchronous operation when Meilisearch is terminated changes depending on the request's `status`:
158
155
159
-
-`enqueued`: the task will remain enqueued and will be processed as usual once is restarted
160
-
-`processing`: there will be no consequences, since no part of the task has been committed to the database. After restarting, will treat the task as `enqueued`
156
+
-`enqueued`: the task will remain enqueued and will be processed as usual once Meilisearch has been restarted
157
+
-`processing`: there will be no consequences, since no part of the task has been committed to the database. After restarting, the task will be treated as `enqueued`
161
158
-`succeeded`: there will be no data loss since the request was successfully completed
162
159
-`failed`: the task failed and nothing has been altered in the database
This command returns a `uid`. You can use this to [track the status of the operation](/reference/api/tasks.md#get-task). Once the status is `succeeded`, you're good to go.
141
+
This command returns a `taskUid`. You can use this to [track the status of the operation](/reference/api/tasks.md#get-one-task). Once the status is `succeeded`, you're good to go.
142
142
143
143
Now that all fields are displayed, proceed to the next step.
Copy file name to clipboardExpand all lines: learn/getting_started/quick_start.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -188,17 +188,17 @@ The previous command added documents from `movies.json` to a new index called `m
188
188
189
189
```json
190
190
{
191
-
"uid": 0,
191
+
"taskUid": 0,
192
192
"indexUid": "movies",
193
193
"status": "enqueued",
194
-
"type": "documentAddition",
194
+
"type": "documentAdditionOrUpdate",
195
195
"enqueuedAt": "2021-08-11T09:25:53.000000Z"
196
196
}
197
197
```
198
198
199
199
Most database operations in Meilisearch are [asynchronous](/learn/advanced/asynchronous_operations.md). This means that rather than being processed instantly, **API requests are added to a queue and processed one at a time**.
200
200
201
-
Use the returned `uid` to [check the status](/reference/api/tasks.md) of your documents:
201
+
Use the returned `taskUid` to [check the status](/reference/api/tasks.md) of your documents:
0 commit comments