Skip to content

Commit 09aaed4

Browse files
authored
Tasks: Document that status is not semvered (#34270)
The `status` part of the tasks API reflects the internal status of a running task. In general, we do not make backwards breaking changes to the `status` but because it is internal we reserve the right to do so. I suspect we will very rarely excercise that right but it is important that we have it so we're not boxed into any particular implementation for a request. In some sense this is policy making by documentation change. In another it is clarification of the way we've always thought of this field. I also reflect the documentation change into the Javadoc in a few places. There I acknowledge Kibana's "special relationship" with Elasticsearch. Kibana parses `_reindex`'s `status` field and, because we're friends with those folks, we should talk to them before we make backwards breaking changes to it. We *want* to be friends with everyone but there is only so much time in the day and we don't *want* to make backwards breaking fields to `status` at all anyway. So we hope that breaking changes documentation should be enough for other folks. Relates to #34245.
1 parent 2dd058d commit 09aaed4

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

docs/reference/cluster/tasks.asciidoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,19 @@ number of requests and the destination indices. Many requests will only have an
132132
empty description because more detailed information about the request is not
133133
easily available or particularly helpful in identifying the request.
134134

135+
[IMPORTANT]
136+
==============================
137+
138+
`_tasks` requests with `detailed` may also return a `status`. This is a report
139+
of the internal status of the task. As such its format varies from task to task.
140+
While we try to keep the `status` for a particular task consistent from version
141+
to version this isn't always possible because we sometimes change the
142+
implementation. In that case we might remove fields from the `status` for a
143+
particular request so any parsing you do of the status might break in minor
144+
releases.
145+
146+
==============================
147+
135148
The task API can also be used to wait for completion of a particular task. The
136149
following call will block for 10 seconds or until the task with id
137150
`oTUltX4IQMOUUVeiohTt8A:12345` is completed.

server/src/main/java/org/elasticsearch/index/reindex/BulkByScrollTask.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,14 @@ public Status buildStatus() {
319319
}
320320
}
321321

322+
/**
323+
* Status of the reindex, update by query, or delete by query. While in
324+
* general we allow {@linkplain Task.Status} implementations to make
325+
* backwards incompatible changes to their {@link Task.Status#toXContent}
326+
* implementations, this one has become defacto standardized because Kibana
327+
* parses it. As such, we should be very careful about removing things from
328+
* this.
329+
*/
322330
public static class Status implements Task.Status, SuccessfullyProcessed {
323331
public static final String NAME = "bulk-by-scroll";
324332

server/src/main/java/org/elasticsearch/tasks/Task.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,20 @@ public Status getStatus() {
157157
return null;
158158
}
159159

160+
/**
161+
* Report of the internal status of a task. These can vary wildly from task
162+
* to task because each task is implemented differently but we should try
163+
* to keep each task consistent from version to version where possible.
164+
* That means each implementation of {@linkplain Task.Status#toXContent}
165+
* should avoid making backwards incompatible changes to the rendered
166+
* result. But if we change the way a request is implemented it might not
167+
* be possible to preserve backwards compatibility. In that case, we
168+
* <b>can</b> change this on version upgrade but we should be careful
169+
* because some statuses (reindex) have become defacto standardized because
170+
* they are used by systems like Kibana.
171+
*/
160172
public interface Status extends ToXContentObject, NamedWriteable {}
161173

162-
163174
/**
164175
* Returns stored task header associated with the task
165176
*/

0 commit comments

Comments
 (0)