Dental fillings (white or silver restorations) are indicated when a cavity has been detected. 

Pain is not necessarily an indicator of needing a filling.  In fact, if pain develops from a tooth, this indicates that the bacteria that caused the cavity have now infected the inside of the tooth.  Root canal therapy may be indicated or in some cases, the tooth is hopeless (unrestorable) indicating removal of the tooth.  Preventative treatment is always the best treatment.  Treatment of an area before it progresses also ensures the longevity of that tooth and prevents major pain and infection.