searchmatch will not allow a field to be used in place of string. However, the match function of eval will, and match can be made to behave like searchmatch very easily!
| eval searchHits=if(match(_raw,"Type=Error"),1,0)
is the same as:
| eval searchHits=if(searchmatch("Type=Error"),1,0)
Further, match will support the regex pipe, so you can OR as well. Here's an example of both:
... | eval typeField = "Type=Error|Type=Warning"
| eval searchHits=if(match(_raw,typeField),1,0)
| stats count as EventCount sum(searchHits) AS searchHits by Type
... View more