ArangoDB v3.13 is under development and not released yet. This documentation is not final and potentially incomplete.
Working with TTL (time-to-live) indexes
Create a TTL index
POST
/_db/{database-name}/_api/index
Creates a time-to-live (TTL) index for the collection
collection-name
if it
does not already exist. The call expects an object containing the index
details.HTTP Headers
Request Body application/json object
expireAfter* number
The time interval (in seconds) from the point in time stored in the
fields
attribute after which the documents count as expired. Can be set to0
to let documents expire as soon as the server time passes the point in time stored in the document attribute, or to a higher number to delay the expiration.
Responses
Examples
Creating a TTL index
curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/index?collection=sessions
{
"type": "ttl",
"expireAfter": 3600,
"fields": [
"createdAt"
]
}