Can the specialization map be flat

Let $X$ be a projective variety over an algebraically closed field of characteristic zero. Let $\eta$ be a generic point of $X$ and $x$ be a closed point. By http://stacks.math.columbia.edu/tag/054F there exists a discrete valuation ring $R$ and a morphism $\mbox{Spec}(R) \to X$ such that the fraction field of $R$ maps to $\eta$ and the residue field maps to $x$. My question is: Can we make sure that such a morphism $\mbox{Spec}(R) \to X$ is flat?

• No, the morphism will almost never be flat. The induced map of rings $\mathcal{O}_{X,x} \to R$ is usually not flat. Consider what happens when you tensor to $R$ the following short exact sequence of $\mathcal{O}_{X,x}$-modules, $$0 \to \mathfrak{m}/\mathfrak{m}^2 \to \mathcal{O}_{X,x}/\mathfrak{m}^2 \to \mathcal{O}_{X,x}/\mathfrak{m} \to 0.$$ If $\mathfrak{m}/\mathfrak{m}^2$ has dimension $2$ or higher, the tensored sequence is not a short exact sequence. – Jason Starr Jul 26 '17 at 20:30

I am just writing my comment as an answer. Since you refer to $X$ as a variety, I assume that $X$ is an integral scheme. I will also assume that $x$ does not equal $\eta$, i.e., I will assume that $X$ is not a singleton. In that case, there exists a flat morphism $\text{Spec}(R)\to X$ from the spectrum of a DVR to $X$ having image $\{\eta,x\}$ if and only if $x$ is a codimension $1$ point at which $X$ is regular.
In the forward direction, if $x$ is a codimension $1$ point at which $X$ is regular, then the local ring $\mathcal{O}_{X,x}$ is already a DVR. For every point $x$ of $X$, the natural morphism $\text{Spec}(\mathcal{O}_{X,x})\to X$ is flat. Therefore, when $x$ is a codimension $1$ point at which $X$ is regular, the natural morphism $\text{Spec}(\mathcal{O}_{X,x}) \to X$ is a flat morphism from the spectrum of a DVR having image $\{\eta,x\}$.
In the reverse direction, if $x$ has codimension $\geq 2$ in $X$ or if $x$ has codimension $1$ yet $X$ is not regular at $x$, then $\mathfrak{m}/\mathfrak{m}^2$ has dimension $d\geq 2$ as a vector space over $\kappa(x) = \mathcal{O}_{X,x}/\mathfrak{m}$. Now consider the short exact sequence of $\mathcal{O}_{x,x}$-modules, $$0 \to \mathfrak{m}/\mathfrak{m}^2 \to \mathcal{O}_{X,x}/\mathfrak{m}^2 \to \mathcal{O}_{X,x}/\mathfrak{m} \to 0.$$ For a local ring homomorphism, $\mathcal{O}_{X,x}\to R$, the base change complex is $$\mathfrak{m}/\mathfrak{m}^2\otimes_{\kappa(x)} (R/\mathfrak{m}R) \to R/\mathfrak{m}^2R \xrightarrow{q} R/\mathfrak{m}R.$$ The kernel of the surjection $q$ is $\mathfrak{m}R/\mathfrak{m}^2R$. Thus, the complex is exact if and only if the following surjective homomorphism is an isomorphism, $$p:\mathfrak{m}/\mathfrak{m}^2 \otimes_{\kappa(x)} (R/\mathfrak{m}R) \to \mathfrak{m}R/\mathfrak{m}^2R.$$ Since $R$ is a DVR, $\mathfrak{m}R$ equals $\pi^eR$ where $\pi$ is a uniformizing element and where $e\geq 1$ is an integer. Thus, the module $\mathfrak{m}R/\mathfrak{m}^2R$ is generated by a single element $\overline{\pi}^e$ as a $R/\mathfrak{m}R$-module. On the other hand, since $\mathfrak{m}/\mathfrak{m}^2$ is a free $\kappa(x)$-module of rank $d$, also the base change $R/\mathfrak{m}R$-module, $\mathfrak{m}/\mathfrak{m}^2\otimes_{\kappa(x)} (R/\mathfrak{m}R)$, is free of rank $d\geq 2$. Thus, $p$ is not an isomorphism of $R/\mathfrak{m}R$-modules.