ScheduledTask

更新时间:
复制 MD 格式

A ScheduledTask object describes a scheduled reindexing task for an OpenSearch application. It captures the task's scheduling configuration, current execution state, task type, and data filter conditions.

Example

{
    "id": "cfd5ebe9-bcdd-11ea-a58d-98039b07e4ec",
    "progress": 0,
    "status": 3,
    "lastRanTimestamp": null,
    "type": "wipe",
    "running": false,
    "paused": false,
    "finished": false,
    "idle": true,
    "created": 1593747144,
    "updated": 1593747144,
    "cron": "0 0 * * 1,2,3,4,5,6,7",
    "enabled": true,
    "appId": null,
    "appGroupId": "100303899",
    "ownerId": "84",
    "lastScheduledTimestamp": null,
    "forkedAppId": "",
    "appGroup": {
        "id": "100303899"
    },
    "owner": {
        "id": "84"
    },
    "filter": {
        "field": "title",
        "days": 30,
        "unit": "s"
    }
}

Fields

Identity and ownership

FieldTypeDescription
idStringThe ID of the scheduled reindexing task.
appIdStringThe ID of the version.
appGroupIdStringThe ID of the application.
appGroup.idStringThe ID of the application.
ownerIdStringThe ID of the owner.
owner.idStringThe ID of the owner.
forkedAppIdStringThe ID of the source version based on which reindexing is performed.

Scheduling

FieldTypeDescription
cronStringThe cron expression that defines the task schedule. For example, 0 0 * * 1,2,3,4,5,6,7 runs the task at midnight every day of the week. For the full cron syntax, see Cron field in ScheduledTask.
enabledBooleanSpecifies whether the scheduled task is enabled.
lastScheduledTimestampInteger/nullThe timestamp when the task was last scheduled.
lastRanTimestampInteger/nullThe timestamp when the scheduled reindexing task was last run.

Task type

FieldTypeDescription
typeStringThe type of operation the task performs. Valid values: wipe (a data deletion task), fork (a data import and reindexing task), reindex (a reindexing task), clear (a data clearing task).

Execution state

FieldTypeDescription
progressIntegerThe progress of the scheduled reindexing task.
statusIntegerThe current state of the task. Valid values: 0 (running), 1 (paused), 2 (complete), 3 (idle).
runningBooleanSpecifies whether the task is currently running. Corresponds to status value 0.
pausedBooleanSpecifies whether the task is paused. Corresponds to status value 1.
finishedBooleanSpecifies whether the task has completed. Corresponds to status value 2.
idleBooleanSpecifies whether the task is idle and waiting for the next scheduled run. Corresponds to status value 3.

Data filter

The filter object specifies which data the task deletes based on field expiration.

FieldTypeDescription
filterObjectThe conditions used to identify and delete expired data.
filter.fieldStringThe name of the index field evaluated against the expiration settings.
filter.daysIntegerThe expiration threshold in days. Data older than this value is deleted. Valid values: 7–180.
filter.unitStringThe unit of the value stored in filter.field. Valid values: s (seconds), ms (milliseconds).