Variable: comint-history-isearch

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.