let 'index' method do both bulk index and single index, depending on the
structure of its input.