That is correct the flag officer and his associated staff. The writers, without a Navy background, get
flagship confused with
capital ship all the time. I just let it slide, since it is fiction. A flagship means the ship is carrying the Admiral of a group of ships travelling together. In actual military navies, the Admiral is a flag officer and the ship carrying the Admiral is the flagship. To confuse the issue even more, some navies have ceremonial flagships, with no admiral aboard. For the United States, the ceremonial flagship is the sailing ship USS Constitution, commissioned in the late 1700s and still afloat today.
Also, in TNG episode Redemption II, Picard is given permission by Admiral Shanthi to assemble a fleet to stop Romulan Incursions on the Klingon / Romulan border, Picard is filling the position as an actual flag officer. The Admiral should have given Picard the temporary rank of at least Commodore (USN would call it a Rear Admiral LH) to let the fleet know who is in charge of the operation, in order to have a clear chain-of-command. Another occurrence where it would be the flagship of the group, as defined by most navies.