Scripted field in Kibana


I have a mySQL query :

SELECT field1, field2, COUNT(field3) AS myfield FROM some_table

How will i create a scripted field as above in kibana?

Thank you

I'm sorry , but I dont understand your requirement ...should that query not be

SELECT field1, field2, COUNT(field3) AS myfield 
FROM some_table 
GROUP BY field1,field2

In which case count is a calculated metric and would not make sense as a scripted field (which gets generated "on each document")

In any visualization the default metric IS count , but you can change that to sum , unique count etc.

Yes. Group by will be there.
Basically i'm creating a scripted field on which kibana will show line chart.
And yes kibana by default counts the field count but i'm not able to create such a field like mySQL can.

Mysql cant create the field either.. it calculates the result as part of an aggregation ... which is exactly what kibana (or rather elasticsearch) does.

When Kibana does an aggregation (for a visualization) , it calculates the count for you and graphs it.

If you jsut want to Dispay it like a sql result , then look at the Data table visualization , which will show your "group by" results in tabular format.