Updating the index after data expires (TTL)

Time-To-Live (TTL) set on a CQL field also applies to the indexed values. The DSE Search engine searches the index for expired documents and then deletes them from the index in batches of a configurable size, as defined by the ttl_index_rebuild_options in the dse.yaml file. The default interval is 300 seconds (5 minutes).

Setting data expiration in CQL

  1. Using CQL INSERT or UPDATE, set the TTL property.

    For example, insert a row with a life of 60 seconds into the health_data demo:

    INSERT INTO demo.health_data (id, age, gender)
    VALUES (9999,88,'female') USING TTL 60;
  2. To force the index to update with the new data:

    COMMIT SEARCH INDEX ON demo.health_data ;
  3. In this configuration example, after 60 seconds, the row is removed from the CQL table and the search index.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com