Count string field in Kibana

I want to count the string field if it matches regex.

Ex: "mappings": { "test": { "properties": { "id1": { "type": "string" }, "payload": { "type": "string" }, "id2": { "type": "string" }, "timestamp": { "format": "strict_date_optional_time||epoch_millis", "type": "date" } } } }

Count only if payload matches [a-zA-Z]*

I want to create a table with the field, so where exactly should I add a query or a script?

normally this is done by "splitting rows" on a filter, and then using the count metric.

Is that sufficient for your use case?