Deleting Old Items in a Push Source
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 About the orderingId Parameter).
Use the Delete old items operation to remove all old items from a specific source.
DELETE https://api.cloud.coveo.com/push/v1/organizations/<MyOrganizationId>/sources/<MySourceId>/documents/olderthan?orderingId=<MyOrderingId>&queueDelay=<MyQueueDelay> HTTP/1.1 Accept: application/json Authorization: Bearer <MyAccessToken>
In the request path:
<MyOrganizationId>with the ID of the target Coveo organization (see Retrieve the Organization ID).
<MySourceId>with the ID of the target Push source.
In the query string:
orderingIdvalue you want to use. Any item that was pushed by an operation whose
orderingIdis lower (“older”) than this value will be deleted from the target Push source (see About the orderingId Parameter).
Unless you’re setting your own
orderingIdvalues when pushing items, you should typically set the
orderingIdof a Delete old items operation to the current number of milliseconds since the UNIX epoch, without any offset.
You’re letting the Push API set its own
orderingIdvalues when you push content updates to your source. This means that each content update operation you perform on that source has its
orderingIdautomatically 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
orderingIdvalue. As a result, the indexing pipeline will reject new pushed items for an hour after you perform the operation.
<MyQueueDelay>with the number of minutes you want the Push API to wait before enqueueing the Delete old items operation in the indexing pipeline.
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
queueDelayvalue 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).
Authorization HTTP header:
<MyAccessToken>with an access token that grants the Organization - View and Sources - View/Edit privileges in the target Coveo organization, if not already done.
Get the privileges of the access token to validate that the token has the required privileges.
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 doesn’t imply that the items were successfully deleted in the target Push source (see About 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).
Deleting all items older than a specified
DELETE https://api.cloud.coveo.com/push/v1/organizations/mycoveocloudv2organizationg8tp8wu3/sources/mycoveocloudv2organization-rp5rxzbdz753uhndklv2ztkfgy/documents/olderthan?orderingId=1509711177594&queueDelay=1 HTTP/1.1 Accept: application/json Authorization: Bearer **********-****-****-****-************
Successful response - 202 Accepted