On the connection between spin glasses and gauge field theories