Changing the index pattern that a visualisation is based on

Editing the ndjson file is certainly an option. Each visualization has a "references" section - if you already have the index pattern saved object in your Kibana instance, you can simply fill in your id there:

"references":[{"id":"90943e30-9a47-11e8-b64d-95841ca0b247","name":"kibanaSavedObjectMeta.searchSourceJSON.index","type":"index-pattern"}]

replace by

"references":[{"id":"the-id-of-your-local-index-pattern","name":"kibanaSavedObjectMeta.searchSourceJSON.index","type":"index-pattern"}]

I also explained some approaches here which work from within the Kibana UI: Rename the index-pattern for sample visualizations - #2 by flash1293

Lens visualizations allow you to change the index pattern simply by editing them and changing it in the dropdown.