First baseman Brett Pill traveled back to San Francisco and will undergo arthroscopic surgery on Thursday to repair a torn meniscus in his right knee, Giants manager Bruce Bochy said.

Pill, 28, tried to play through irritation in his knee but it swelled up on him Tuesday night and the decision was made to have surgery. He’s expected to miss three weeks, at least – taking him out of consideration to be on the Giants’ opening-day roster.

“I was about to take a look at him in left field,” said Bochy, who carried Pill on last year’s opening-day roster. “He’ll get this taken care of and that way he won’t have to deal with it all year.”

Pill was one of several candidates for the club’s two unsettled bench spots. The Cal State Fullerton alum acknowledged earlier this spring that he needed to show the ability to drive the ball off the bench, and that would be more important to winning a job than positional flexibility.