Can I aggregate using only part of a field?

One of the fields in my index is a version number, e.g. "3.0.7", stored as a keyword. I'd like to do aggregations using only part of the version. For example, I'd like a count of the number of documents for each major version (1.x, 2.x, etc).

I could create separate fields:

major_version: 3
minor_version: 3.0
patch_version: 3.0.7

But I'm wondering if there's another way to do this.