Indexing data that is not flat