String Occurrences within a String

the way Elasticsearch works doesn't make it suited for this kind of calculation. You could use a scripted field to count the number of substring occurrences, but it's not a recommended method as it will put more strain on your cluster.
Here's an example of a scripted field that somebody used to find substrings: