Role of elastic and optical properties on silver nanoferrite and nanochromite for optical switch device applications