Before generating your index, it's wise to prepare a page and give lots of thought as to how you'd like it to appear. InDesign will format the copy for you but it will be very basic, so it's worth creating some style sheets first using dummy text. Once this is done, click Generate Index.
There are lots of options in the Generate Index dialog box, but we're only interested in the basics. We're creating a 'nested' index, which will give us the hierarchy we want, so make sure this option is selected.