Count Occurrence Of Value


I'm trying to figure out how to get the total number of occurrences of a certain value in an index.
I've tried using Value Count Aggregation, but that doesn't seem to work.

"_source" : {
          "category" : [
            "Men's Clothing"
          "currency" : "EUR",
          "customer_first_name" : "Eddie",
          "customer_full_name" : "Eddie Underwood"

Let's say I wanted to see how many times the value "Eddie" occurs, how would I do that?

It depends on how you are counting. Does the above document count twice or do you only want to count on the first name field?

I want to count the occurrence of that value for a specific field in all my documents, so in this case how many "Eddie" in "customer_first_name".

I've found out that I can get a count value by doing

"query": {
	"term": {
		"customer_first_name.keyword": { 
			"value": "Eddie" 
1 Like

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