Roberto Bautista Agut knocked top seed Daniil Medvedev out of the Miami Open at the quarter-final stage.