set different TTL on same index

I need to set different TTL for each document. TTL value set by caller application.

mongoTemplate.indexOps(Entity.class)
.ensureIndex(
new Index()
.named(“expiredOn”).expire(request.getExpiresAt()));
mongoTemplate.save(entityObj,“collectionName”);

first time it is working fine but getting duplicate index error while inserting second doument