The present invention relates to a novel indazole or pyrrolopyridine derivative represented by the formula (1) below that has an agonistic action or a partial agonistic action against serotonin 4 receptor and a pharmaceutical composition comprising the same. Formula (1) [wherein each substituent is as defined in claim 1]