Sort the index pattern list

While trying to reproduce #2186 I noticed the index lists were not sorted, this fixes that.