refactoring the index and the mapping models