It is important to understand that when dealing with peace or police officers, some laws will apply that normally do not when dealing with other civilians. Accordingly, what some may see as minor harms on someone that does not warrant an arrest actually will be charged as battery on a peace or police officer. According to California Penal Code sections 243(b) and 243(c), the willful and unlawful force against an officer is a crime.
These sections of the penal code apply to the peace and police officers, firefighters, paramedics/EMTs, emergency services doctors and nurses, and service processors. The prosecution must prove a series of elements beyond a reasonable doubt in order for the accused to be convicted. The accused must have willfully and unlawfully (knowing it was unlawful) come into contact with an officer and the contact must have been harmful. While the victim of such battery, the officer must have been conducting their professional duties. Furthermore, the accused must have known (through reasonable assumptions) that the person they were harmfully in contact with was an officer performing their duties.
Such contact with an officer can include actions like hitting, throwing objects, and other major (or seemingly minor) physical assaults. If the prosecution can prove that the accused did commit battery on an officer, they face a wobbler crime depending on the circumstances. If the battery resulted in a medically-treated injury, they face a felony charge of up to 3 years in jail. However, other forms of battery will result in a misdemeanor charge of up to 1 year in jail. Both charges, however, face steep fines of thousands of dollars.