Here’s the classic spelling rule that all native English speakers learn in the first years of school. If you’re unsure whether to spell a word with an ie or an ei, use ie unless the two letters are preceded by c.
Therefore, we have hierarchy and ceiling.
As with all rules in English, however, there are exceptions. Three that immediately come to mind are weird, weight, and their