In good and bad economic times, people need to buy pet food, and that’s one reason Chewy Inc.’s stock may be worth a new look.

Needham analyst Anna Andreeva upgraded Chewy shares CHWY, +1.34% to buy from hold Monday, writing that the stock looks like a way to play defense in the current market.

“The pet space is defensive (historically outperforms during recessions) and demand is inelastic (cost increases are passed through to consumers, especially in the staple-like Consumables category),” she wrote in a note to clients.

Chewy’s stock was up 0.2% in afternoon trading Monday.

Chewy has other factors working in its favor as well, in Andreeva’s view. After having missed consensus expectations on earnings before interest, taxes, depreciation, and amortization (Ebitda) for four straight quarters, Chewy snapped the streak with a beat in the first quarter, and Andreeva thinks the company has been able to maintain that new momentum.

Not only are pet items “inelastic,” but she also sees signs of improving supply-chain trends, as well as success with Chewy’s own initiatives, such as automated fulfillment centers, meant to enhance profitability.

See more: Chewy posts surprise profit

While Chewy could hold up in the current economic climate, fellow e-commerce company Etsy Inc. ETSY, -3.38% may be in a weaker position due to its focus on more discretionary items. Andreeva downgraded the stock to hold from buy in a Monday note.

The stock slumped about 4.2% in afternoon trading.

Meanwhile, the SPDR Consumer Discretionary Select Sector exchange-traded fund XLY, -0.82% has tumbled 28.8% year to date, while the S&P 500 index SPX, -0.16% has lost 18.2%.

Andreeva acknowledged that Etsy was still in the early days of getting recently acquired customers to make more repeat purchases on the platform, and noted that success with these efforts could pay off for years.

“At the same time, in the near term, given a primarily discretionary nature of the underlying demand and today’s pressures on the consumer both in the U.S. and globally, we think core Etsy GMS [gross merchandise sales] could stay under pressure, while the new subs are also seeing negative demand trends, with profitability as a drag to consolidated results,” she wrote.