Term Aggregation: Count Duplicates


#1

Hello,

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?

KR
cebor


(Aaron Caldwell) #2

Hello Cebor,

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

Thanks,
Aaron


#3

Here it is.


#4

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
    }
  }
}

(Aaron Caldwell) #5

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?


#6

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


#7

"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.