Sort the index pattern list

While trying to reproduce #2186 I noticed the index lists were not sorted, this fixes that. It turned out joe had already fixed #2186, but hey, this is useful too :-)