How do I count unique prefixes

Hello, Im new to Kibana and this forum and hope to find some assistance.

Im trying to create a unique counter of the first five digits of, ex: 47001834023049820397402
I can't for the life of me figure out how to do this.

In my data I have thousands of prefixes as, ex:

And I need to visualize how many of each prefix I have, ex:
57001: 12
47001: 9
24009: 35

If anyone have a good way of doing this Id appreciate the help, thanks!

Hi @Diwike,

The first thing that comes into my mind is to create a scripted field, let's say prefix that would use subsring function under the hood, so that you can apply any aggregations (incl. count) on this new field.


Thank you Aza,
that sounds amazing but I don't even know where to start implementing your suggestion. If you have a moment I would greatly appreciate if you break it down a bit for me.


Sure, it'd would look something like this:

Not Aza, but anyway :wink:


Wow that's amazing Oleg, thank you!

Ill try to replicate it from your guide.

Truly appreciate your support!


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.