The LSZ formula for a scalar field $\phi$ with $n$ out-states and $r$ in-states is
$$ \langle p_1,\dots,p_n\vert S \vert q_1,\dots q_r = \left(\mathrm{i}Z^{-1/2}\right)^{n+r}\prod_i (-p_i^2 + m^2)\prod_j (-q_j^2 + m^2)\left\langle \prod_k \phi(p_k)\prod_l \phi(q_l)\right\rangle + \text{disconnected pieces}$$
where the expectation value $\langle \dots \rangle$ is the time-ordered vacuum expectation value and the "disconnected pieces" part represents the disconnected part of the S-matrix where the amplitude factors into the product of two smaller amplitudes.
The first term is often called the "connected part of the S-matrix" and the usual expansion into Feynman diagrams is an expansion of $\left\langle \prod_k \phi(p_k)\prod_l \phi(q_l)\right\rangle$. Note that "(dis)connected" up to this point does not inherently refer to diagrams, we're just calling the pieces of the S-matrix that come from products of S-matrix elements with fewer in/out states "disconnected" and the other term "connected". The diagrammatic expansion is explicitly an expansion of the correlation function (or "Green's function") in the connected part.
In general, the correlation function can be expanded as a sum of terms with different pole structures in $p^2_i$ and $q^2_j$, a multi-variable version of a Laurent series. It is easy to see that only terms with at least the poles $\prod_i \frac{1}{p_i^2 - m^2}\prod_j \frac{1}{q_j^2 - m^2}$ contribute to the connected part of the S-matrix, because anything with fewer poles gets just zeroed by one of the $(p_i^2 - m^2)$ or $(q_j^2 - m^2)$ that are in front of it in the LSZ formula. It turns out that no terms with more poles than this can occur, so only the term with the $\prod_i \frac{1}{p_i^2 - m^2}\prod_j \frac{1}{q_j^2 - m^2}$ pole structure contributes to the connected part of the S-matrix.
If you now do the expansion of the correlation function in terms of Feynman diagrams, you find that the diagrams that have this pole structure are precisely the ones that do not have a part where one connected component is just a line between an in- and an out-state. For processes with $n+r \leq 5$, this is equivalent to all fully connected diagrams, i.e. diagrams with just one connected component. For processes with more states, these can be diagrams that are composed of two or more connected components, each of which is a non-trivial diagram in its own right. There is no universal agreement over whether these diagrams count as part of the "disconnected pieces" term in the LSZ formula - if they do, then the formula as written is wrong, if they don't, then the usual claim that "only the fully connected diagrams contribute to the connected S-matrix" is wrong for general $n,r$.
But in any case, it doesn't matter: It is still true that in order to compute all total S matrix elements, you only need to compute all fully connected diagrams, since the partially connected diagrams are just the product of two or more smaller fully connected diagrams. So by starting at $n = 2, r = 2$ and iteratively incrementing $n$ and $r$, computing the fully connected diagrams at each step suffices to know all S matrix elements - you just have to remember the contributions from the smaller pieces at $n+r > 5$.