Change key to IndexKey and using to IndexType in CreateIndex