2. Given the complex numbers $z_{1}, z_{2}$ satisfy
$$
\left|z_{1}-z_{2}\right|=\sqrt{3}, z_{1}^{2}+z_{1}+q=0, z_{2}^{2}+z_{2}+q=0 \text {. }
$$

then the real number $q=$ $\qquad$
2.1.

From $\left|z_{1}-z_{2}\right|=\sqrt{3}$, we know $z_{1} \neq z_{2}$.
By the definition of the roots of the equation, $z_{1}$ and $z_{2}$ are the two imaginary roots of the quadratic equation $x^{2}+x+q=0$, then we have
$$
\Delta=1-4 q<0 \text{. }
$$

Solving the equation, we get $z_{1,2}=\frac{-1 \pm \sqrt{4 q-1} \mathrm{i}}{2}$.
Thus, $\left|z_{1}-z_{2}\right|=\sqrt{4 q-1}=\sqrt{3}$.
Solving for $q$ yields $q=1$.