Select index based on Dropdownlist value

I’m currently working on a project using an autocomplete and instant search with some widgets. I also have two different indexes, but I need to change the index name based on a dropdown list selection value, and refresh both (autocomplete, instantsearch) as soon as I fire the onchange method, is it possible to do this?

I attach the code sandbox to be more clear.