How to write kql query in kibana to include only 9 characters of a field?

I am using kibana 8.1 so I want to filter the data in discover section. Tha index has a field whic is in number format and it has different kinds of numbers which range from 4 characters up to 12 or 13 characters. So I want to show me only the data which are 9 or above 9 characters in that specific field. The field name is for example phone_number.

Hi @Arifullah ,

if the field is numeric I think you might leverage Kibana filters for this use case:

If your field is keyword based, you might leverage runtime fields to create a new field with only values which have a length of 9, and return null otherwise.

Hi @Marco_Liberati
there is no field by the name of byte in my index. The field which I want to filter is phone_number and it's type is long

Hi @Arifullah ,

you can configure the filter with your field name, but the same logic should apply.

Thank you @Marco_Liberati your answer solved my problem.

@Marco_Liberati I have also another question if you can help me I shal be very thankfull.
There is also field by the name date but the data of that field is not in a proper date format its only a number. So I want a filter to include only the data of max date field I mean how to create a filter which finds the maximum value of the date field and filter the index based upon that value.

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