MakeContractionAnsatz

MakeContractionAnsatz[expr]
makes an Ansatz with all possible contractions of expr.
MakeContractionAnsatz[expr, frees]
makes an Ansatz with all possible contractions of expr that have frees as free indices.
MakeContractionAnsatz[expr, frees, sym]
makes an Ansatz with all possible contractions of expr with the symmetry sym imposed on the free indices frees.