Deleting Old Items in a Push Source

You can perform a single Push API call to delete all of the items in a Push source that were last updated with a Push API operation whose orderingId value is lower than a specified value (see Understanding the orderingId Parameter).

Use the Delete old items operation to remove all old items from a specific source.

Request template

DELETE https://push.cloud.coveo.com/v1/organizations/<MyOrganizationId>/sources/<MySourceId>/documents/olderthan?orderingId=<MyOrderingId>&queueDelay=<MyQueueDelay> HTTP/1.1
 
Accept: application/json
Authorization: Bearer <MyAccessToken>

In the request path:

In the query string:

  • Replace <MyOrderingId> with the orderingId value you want to use. Any item that was pushed by an operation whose orderingId is lower (“older”) than this value will be deleted from the target Push source (see Understanding the orderingId Parameter).

    Unless you are setting your own orderingId values when pushing items, you should typically set the orderingId of a Delete old items operation to the current number of milliseconds since the UNIX epoch, without any offset.

    You are letting the Push API set its own orderingId values when you push content updates to your source. This means that each content update operation you perform on that source has its orderingId automatically set to the current number of milliseconds since the UNIX epoch, which is UTC-based.

    When performing a Delete old items operation on that source, you retrieve the current UNIX timestamp, but then mistakenly adjust it to Central European Standard Time (i.e., UTC+1) before setting it as the orderingId value. As a result, the indexing pipeline will reject new pushed items for an hour after you perform the operation.

  • Optionally, replace <MyQueueDelay> with the number of minutes you want the Push API to wait before enqueueing the Delete old items operation in the indexing pipeline.

    The default queueDelay value is 15 (minutes).

    This grace period is intended to give the indexing pipeline enough time to finish processing any previously enqueued operations that would affect the target Push source.

    Performing a Delete old items operation with a low queueDelay value may have unexpected results (i.e., some items you expect to be deleted could be added back into the target Push source after the operation is processed).

In the Authorization HTTP header:

A successful response (202 Accepted) has no content, but it indicates that the Delete old items operation was forwarded to the service. It will be enqueued to be processed by the indexing pipeline when the specified (or default) queueDelay has elapsed.

This does not imply that the items were successfully deleted in the target Push source (see Understanding the Push API Processing Delay).

Update the status of your Push source

If you set your Push source to an active status before, and you have no further operations to perform as part of this content update, you should consider setting it back to the IDLE status after this operation has successfully returned (see Updating the Status of a Push Source).

Sample Request

Deleting all items older than a specified orderingId value

DELETE https://push.cloud.coveo.com/v1/organizations/mycoveocloudv2organizationg8tp8wu3/sources/mycoveocloudv2organization-rp5rxzbdz753uhndklv2ztkfgy/documents/olderthan?orderingId=1509711177594&queueDelay=1 HTTP/1.1
 
Accept: application/json
Authorization: Bearer **********-****-****-****-************

Successful response - 202 Accepted

null