小解 is a polite, slightly old-fashioned euphemism — common in medical contexts and older literature. The complementary
大解 (dàjiě) means to defecate. In everyday speech, you would say
上厕所 (shàng cèsuǒ, 'go to the toilet') or
嘘嘘 (xūxū) when speaking with children.