Were there any investigators or detectives in Medieval times?

Were there any investigators or detectives in Medieval times?