LOS ANGELES — Mayor Pete Buttigieg of South Bend, Indiana, got a comeuppance at Thursday's Democratic presidential primary debate here.

It was delivered by two rivals — Sens. Elizabeth Warren, D-Mass., and Amy Klobuchar, D-Minn. — who have watched as Buttigieg, a 37-year-old Harvard graduate and Afghanistan war veteran, rocketed to the top tier in Iowa caucus polls on the strength of charisma, monster fundraising and the ideological flexibility available to a candidate with no record at the national level.

Klobuchar, in particular, appeared to be tired of hearing from Buttigieg about just how great he is and the meaninglessness of the accomplishments of people who have won election to higher office, worked in public service for longer and built the party whose nomination he seeks.

The bad news for Buttigieg is that some of his vulnerabilities were exposed. The good news: he got roughed up because he's doing so well in the first two states, time is running short to shake up the dynamics of those races, and he may be able to draw some valuable lessons from the episode.

"This is a fight for Iowa and New Hampshire right now, and people are positioning in that respect," California Gov. Gavin Newsom said in an interview after the debate. "Buttigieg is out-performing and, as a consequence, he’s at the eye of that storm."

That's where Buttigieg found himself 80 minutes into Thursday night's debate at Loyola Marymount University here, when he scrapped, in succession, with the two senators. Together, they challenged Buttigieg's ability to draw an effective contrast with Trump, bring in enough voters to win a general election, and get things done in Washington. And by dint of their attacks, they pushed him to show he could handle heat.

It should have come as no surprise to Buttigieg that Warren took a swing at him over his fundraising practices, which include a recent event with high-dollar donors in a wine cave. Earlier in the debate, Warren had used the impeachment of President Donald Trump to emphasize the anti-corruption plank of her platform, and she has been hammering Buttigieg for weeks about giving special access to top contributors.

Download the NBC News app for breaking news and politics

"Billionaires in wine caves should not pick the next president of the United States," she said.

He was ready to counter her contention that he can't effectively make the case against Trump, and turned it back on her.

"You know, according to Forbes magazine, I am literally the only person on this stage who is not a millionaire or a billionaire," said Buttigieg, who noted that Warren raised money at major donor events before she ran for president. "This is the problem with issuing purity tests you cannot yourself pass."

Klobuchar eventually jumped in to stop a long exchange of barbs between Warren and Buttigieg. And that may be why he didn't appear to be quite so prepared a few minutes later when it was Klobuchar who took him to task over his dismissiveness of her, Warren, former Vice President Joe Biden and Sen. Bernie Sanders, I-Vt.

"Mayor, you basically mocked the hundred years of experience on the stage," she said, referring to a remark Buttigieg had made at a previous debate and listing her accomplishments and those of several of the other candidates on stage. "I just think you should respect our experience when you look at how you evaluate someone who can get things done."

Buttigieg shot back that his time in the U.S. Navy Reserve shouldn't be overlooked.

"That is my experience, and it may not be the same as yours, but it counts, senator," he said. "It counts."

Where many candidates might back away at the mention of the uniform — Buttigieg was the only one on stage who served in the military — Klobuchar plowed ahead.

"I certainly respect your military experience," she said. "That's not what this is about. This is about choosing a president.... And the point is, we should have someone heading up this ticket that has actually won and been able to show they can gather the support that you talk about — moderate Republicans and independents as well as a fired-up Democratic base and not just done it once."

None of the other candidates jumped in to stop what many of their supporters had been hoping to see for some time: someone calmly trying to knock Buttigieg down a peg.

He protested that he had won re-election as mayor as a "gay dude in Mike Pence's Indiana."

Klobuchar wasn't having any of that, either.

"If you had won in Indiana that would be one thing," she said before referring to his failed run for state treasurer. "You tried and you lost by 20 points. I'm sorry, that's just a fact."

For now, though, Buttigieg is well-positioned to win the prize Klobuchar and Warren seek: the Iowa caucuses. He's polling first in the Real Clear Politics average of surveys with 22 percent to Sanders' 20 percent, Biden's 18.8 percent, Warren's 16 percent and Klobuchar's 6.3 percent. And Buttigieg is currently in second place behind Sanders in New Hampshire, according to RCP.

It's not at all clear that a debate — particularly one sandwiched between the impeachment of a president and Christmas — is likely to alter the basic contours of the campaigns in two states where candidates have spent many months on the ground meeting voters personally.

But the message Buttigieg is hearing from Warren and Klobuchar is politically consequential. He's polling in single digits nationally, and there are major segments of the Democratic primary electorate that have not taken well to him. If he manages to make enemies out of women who think he's been given too much without earning it — or simply that he doesn't honor their accomplishments — that could create a much higher hurdle for himself to winning the nomination.

Beyond that subtext, Klobuchar said there's another signal being sent to voters about the candidates when they mix it up on the debate stage like they did Thursday.

"It is very important that you have a candidate, and I think everyone — I’m not going to judge everyone’s performances today — yeah, that you have someone who can show grace under pressure," she told NBC News after the debate.