@@ -203,6 +203,49 @@ IndexEntity index = collection.ensurePersistentIndex(Arrays.asList("a", "b.c"));
203203// the index has been created with the handle `index.getId()`
204204```
205205
206+ ## ArangoCollection.ensureTtlIndex
207+
208+ ` ArangoCollection.ensureTtlIndex(Iterable<String> fields, TtlIndexOptions options) : IndexEntity `
209+
210+ Creates a ttl index for the collection if it does not already exist.
211+
212+ ** Arguments**
213+
214+ - ** fields** : ` Iterable<String> `
215+
216+ A list of attribute paths
217+
218+ - ** options** : ` PersistentIndexOptions `
219+
220+ - ** name** : ` String `
221+
222+ Specify a custom name during index creation (optional). When running AQL queries you might then refer
223+ to these name as your preferred index for lookups (e.g. Index Hints).
224+
225+ - ** expireAfter** : ` Integer `
226+
227+ The time (in seconds) after a document's creation after which the documents count as "expired".
228+
229+ - ** inBackground** : ` Boolean `
230+
231+ Indexes created with the 'inBackground' option, will not hold an exclusive collection
232+ lock for the entire index creation period (rocksdb only).
233+
234+ ** Examples**
235+
236+ ``` Java
237+ ArangoDB arango = new ArangoDB .Builder (). build();
238+ ArangoDatabase db = arango. db(" myDB" );
239+ ArangoCollection collection = db. collection(" some-collection" );
240+
241+ final TtlIndexOptions options = new TtlIndexOptions ();
242+ options. name(" myTtlIndex" );
243+ options. expireAfter(3600 );
244+
245+ IndexEntity index = collection. ensureTtlIndex(Arrays . asList(" a" , " b.c" ), options);
246+ // the index has been created with the handle `index.getId()`
247+ ```
248+
206249## ArangoCollection.getIndex
207250
208251` ArangoCollection.getIndex(String id) : IndexEntity `
0 commit comments