comint-history-isearch is a variable defined in `comint.el'.
Its value is

Non-nil to Isearch in input history only, not in comint buffer output.
If t, usual Isearch keys like `C-r' and `C-M-r' in comint mode search
in the input history.
If `dwim', Isearch keys search in the input history only when initial
point position is at the comint command line. When starting Isearch
from other parts of the comint buffer, they search in the comint buffer.
If nil, Isearch operates on the whole comint buffer.

You can customize this variable.

This variable was introduced, or its default value was changed, in version 23.2 of Emacs.