Cover all of your mandatory expenses for the full six months. Set that aside and then invest the rest in Index funds.
Some may scoff at having that amount as an emergency fund and may recommend having a line of credit or something like that but I think that is too risky. The emergency fund should be cash and liquid. You are not trying to make money off of it so find the best vehicle to park it in that is liquid and immediately available any minuscule interest you may get from it is inconsequential.