Telegraf metrics expires

Is there any expire fields for telegraf metrics that storage on influx db or elastic search base on input.
For example i want t just store my cpu usage just one week and memory for two weeks how can i implement it ?

You will want to set up one or more retention policies.