While searching in kibana, can i use substring on a field?


(Rajt) #1

I have a field called client_label.

And i want to group the values by first 4 characters of the results.

Eg: client_label values are "jdbc-8.0", "jdbc-8.1","MCXX-9.0", "Logs-2.0", "Logs-2.1" and so on.....

So, i want a aggregate result as follows for the query : substring(client_label, 1,4) *
client_label | count
jdbc | 2
MCXX | 1
Logs | 2

Do we have any such function?

Thanks,
Raj


(kulkarni) #2

I think the answer is, it depends. In any place you would be using Painless, for example, in Kibana's scripted fields, you can use Regex to do substring matches on a field-value.

See here for an example: Substring in painless

hope it helps
Rashmi


(system) #3

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