Count number of occurrence of specific keyword from specific field in all docs

Hello ES Team,

I am looking for query in aggregation to find total number of occurrence of specific keyword from specific field in all doc.
Example:
doc1 - {logEntry: 'allow_edit_gos=true, allow_gos_edit=false'}
doc2 - {logEntry: 'allow_edit_gos=x, allow_gos_edit=x'}

how do i find "allow" keyword count to 4 in above 2 documents ?

Right now i am using below query which return 2 because it finds number doc which has "allow" keyword in it, but i am looking for total keyword occurrence counts instead of total doc count.
esb.requestBodySearch().aggs(esb.matchPhrasePrefixQuery('logEntry', 'allow'))

Thanks.

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