Ok, I know that "the enterprise is the flagship of the federation" is accepted as canon by most Trekkies, but I'm not sure exactly what this is based on.
Where exactly in the franchise is it established? I can think of several instances of her ACTING as flagship of fleets or battle groups, along with numerous references to her being considered the most powerful/advanced in her various incarnations, but nothing that states definitively that she holds some special well defined and permanent position within the fleet.
This question for me is compounded by my understanding of a flagship as being commanded by a flag officer, which captain is not. The only permanent (matt decker being a temporary state of affairs) commander of the enterprise with flag rank was kirk as admiral in the early movies.
The Enterprise D is referred to frequently on TNG (and the other series which reference the D) as the flagship of Starfleet/the Federation. Pike calls the Enterprise the flagship in Trek XI.
You are essentially correct with your definition of the term flagship in the military context. Although there is also a civilian context which basically means "capital ship" which for some reason Starfleet uses.