ESEARCH is "extended search".
Some users have thousands of old unread messages, and my code needs to keep track of each one.
ESEARCH returns the list of messages in a much more compact form that the default, baseline, SEARCH command, reducing traffic and improving performance.
This is an optional IMAP extension, and there is a way for an IMAP server to advertise its support.
FWIW, I also implemented support for the optional MOVE command. This is a more efficient / reliable way to move messages between folders. Baseline IMAP only has COPY, so a message has to be copied, then marked as deleted in the source folder, and finally deleted.
MOVE is supported by Gmail, Fastmail, and possibly others.