Andrei Augostovich Eberhardt   was an Admiral in the Imperial Russian Navy of Swedish ancestry. Eberhardt was born in Patras, Greece, where his father was the Russian consul.  Eberhardt graduated from the Marine Cadet Corps in 1878. From 1882 to 1884, he served in the Pacific Fleet as a signals officer. In 1886, he became a flag officer and adjutant to Admiral Ivan Shestakov  and in 1891 he became a flag officer to Admiral Tyrtov commanding the Russian Pacific Squadron. In 1896 Eberhardt was moved to the Black Sea Fleet, where he was gunnery officer on the battleships Ekaterina II and Chesma. In 1898 he moved to the Far East, where he commanded the Admiral Nakhimov and took part in suppressing the Boxer Rebellion. During the Russo-Japanese War, Eberhardt was chief naval aide to Yevgeni Ivanovich Alekseyev, the viceroy of Manchuria. In 1905, he was captain of the battleship  Imperator Aleksandr II and in 1906 he was made captain of the Panteleimon. He was promoted to Rear Admiral in 1907 and Vice Admiral in 1909. Eberhardt was Russia's Chief of the Russian Naval General Staff from 1908 and Commander-in-Chief of the Black Sea Fleet from 1911. During World War I, his top achievement was setting up a naval blockade of the Zonguldak coal fields, choking the coal supply of the German-Turkish fleet. He also commanded the Russian battleship squadron during the Battle of Cape Sarych. However he  was cautious to start further offensive actions against Turkish positions in the Bosporus and was replaced by Aleksandr Kolchak in 1916. Eberhardt retired from service in 1917 and was arrested by the Cheka in 1918 but released. He died in 1919 and is buried in the Novodeviche Cemetery in Petrograd.
Question: How many years did Eberhardt serve as a flag officer before acting as a gunnery officer?
Answer: 10