# Programmatically rename (re-title) Kibana index patterns

**URL:** <https://discuss.elastic.co/t/programmatically-rename-re-title-kibana-index-patterns/277398>\
**Category:** Kibana\
**Created:** [June 30, 2021, 2:50am UTC](https://discuss.elastic.co/t/programmatically-rename-re-title-kibana-index-patterns/277398 "2021-06-30T02:50:14Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [July 1, 2021, 7:48am UTC](https://discuss.elastic.co/t/programmatically-rename-re-title-kibana-index-patterns/277398/3 "2021-07-01T07:48:32Z")

</div>

Your approach seems good to me - however make sure to keep the original export file so you can roll back when things go wrong 🙂

A bit of context:  
The index pattern saved object (the one with the `title` attribute) is used by some types of visualizations, but other visualizations (namely TSVB, Timelion and Vega) do not use them - that's why they store the pattern string in their own saved objects (`series_index_pattern` et al).

In 7.13 TSVB will be able to reference the index pattern saved object instead of storing the pattern string inline, simplifying this task a bit.

I think your approach catches Lens, aggregation based visualizations and TSVB. Vega and Timelion are more difficult to migrate this way because they put the pattern string into their respective non-JSON based "specs" which would have to be parsed separately for a robust replacement:

 ![Screenshot 2021-07-01 at 09.46.28](https://us1.discourse-cdn.com/elastic/original/3X/b/a/bad09d77cdee9f2bb6320a9a1811f623220b5400.png)  
 ![Screenshot 2021-07-01 at 09.46.50](https://us1.discourse-cdn.com/elastic/original/3X/7/9/79c15258c0c58900a2034fbc7f5077525a6b7929.png)

For reference: I described two other approaches of changing the index pattern with visualizations attached here: [Rename the index-pattern for sample visualizations](https://discuss.elastic.co/t/rename-the-index-pattern-for-sample-visualizations/266617) They don't require importing/exporting but won't catch the TSVB cases, so I think your scheme is better in your case.

---

_[View the full topic](https://discuss.elastic.co/t/programmatically-rename-re-title-kibana-index-patterns/277398)._
