How use count in post Aggregation

how to use count in postAggregation.Is there any way to acheive it .if so please provide the solution for that.

i tried like this .but iam getting exception .Is there any syntax error.please let me know.

“aggregations”: [

{

“type”: “stringLast”,

“name”: “lastest_instrument_id”,

“fieldName”: “instrument_id”

}],

“postAggregations”: [

{

“type”: “javascript”,

“name”: “totalcount”,

“fieldNames”: [“lastest_instrument_id”],

“function”: “function(lastest_instrument_id) { return lastest_instrument_id.length}”}],

“intervals”: [

“2020-01-06/2020-01-22”

]

Hi Rupa,
What is the exception you are getting when you are running your query containing post-aggregations?

Javascript is disabled by default.