Given a finite bijective non-degenerate set-theoretic solution $(X,r)$ of the Yang--Baxter equation we characterize when its structure monoid $M(X,r)$ is Malcev nilpotent. Applying this characterization to solutions coming from racks, we rediscover some results obtained recently by Lebed and Mortier, and by Lebed and Vendramin on the description of finite abelian racks and quandles. We also investigate bijective non-degenerate multipermutation (not necessarily finite) solutions $(X,r)$ and show, for example, that this property is equivalent to the solution associated to the structure monoid $M(X,r)$ (respectively structure group $G(X,r)$) being a multipermuation solution and that $G=G(X,r)$ is solvable of derived length not exceeding the multipermutation level of $(X,r)$ enlarged by one, generalizing results of Gateva-Ivanova and Cameron obtained in the involutive case. Moreover, we also prove that if $X$ is finite and $G=G(X,r)$ is nilpotent, then the torsion part of the group $G$ is finite, it coincides with the commutator subgroup $[G,G]_+$ of the additive structure of the skew left brace $G$ and $G/[G,G]_+$ is a trivial left brace.