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:
For reference: I described two other approaches of changing the index pattern with visualizations attached here: Rename the index-pattern for sample visualizations They don't require importing/exporting but won't catch the TSVB cases, so I think your scheme is better in your case.