Let's say I have an electric field $\vec{E} = (0, 0, E_z)$, where $E_z$ in constant. Then the electric potential is $\phi = - \vec{E} \cdot \vec{r}$, where $\vec{r} = (x, y, z)$.
Calculating $\vec{E} = - \nabla {\phi}$ in cartesian coordinates is ok, we get the $\vec{E}$ we started with.
But I have a problem with transforming this whole thing into spherical coordinates. Then the electric field is $\vec{E} = (E_z \cos{\theta}, -E_z\sin{\theta}, E_z)$ and $\nabla \phi = (\frac{\partial \phi}{\partial r}, \frac{1}{r} \frac{\partial \phi}{\partial \theta}, \frac{1}{r \sin{\theta}} \frac{\partial \phi}{\partial \varphi})$.
I am not really sure whether $\vec{r}$ should change to $(r \sin{\theta}\cos{\theta}, r \sin{\theta}\sin{\varphi}, r\cos{\theta})$ or $(r, r\theta, r\sin{(\theta)}\varphi)$ or something else. Either way, I can't get the original $\vec{E}$ from $\vec{E} = - \nabla {\phi}$. The result is wrong.
What am I doing wrong? I assume it's the $\vec{r}$ transformation but I am not sure.