Term Aggregation: Count Duplicates


my TA pushes following doc to my elasticsearch:

I want to visualize the count of all doc.test_cases[''].verdict terms.

The visualisation omits duplicate verdicts. Got the following result:
passed: 1 skipped: 1 failed: 1

My expected result is:
passed: 2 skipped: 1 failed: 1

What can i do here, is my doc pushed to elasticsearch incorrect?


Hello Cebor,

Could you post a screenshot of the visualization you've produced along with your field selections on the side?


Here it is.

Is it possible, that the problem is in the mapping? "verdict" is defined as follows:

"verdict": {
   "type": "text",
    "fields": {
     "keyword": {
        "type": "keyword",
        "ignore_above": 256

Nothing's jumping out at me. I thought maybe you were doing a unique count on the terms agg but that's not the case. Just to be sure, can you run GET <your index name>/_search from the dev tools and make sure both documents are in the results?

Is there a Sum of Qty rather than count of items under the metrics Field?

"GET <your index name>/_search" shows me all the data correctly, i think the problem is with the array, should be declared as nested.

See: https://www.elastic.co/guide/en/elasticsearch/reference/current/nested.html

But nested datatypes are not visualizable, so my solution for now is to push each testcase as single entry to my index.

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