Hi everyone,
I'm trying to create a visualization of a cardinality aggregation on two fields but haven't found a proper way to do it yet. I'm fairly new to the Elastic stack so bear with me
I have this query which provides me with what I need:
GET myindex-2019.07/_search
{
"size": 0,
"aggs": {
"my_count": {
"cardinality": {
"script": {
"source": "[doc['field1'], doc['field2']]"
}
}
}
}
}
This gives me the following result:
{
"took" : 1236,
"timed_out" : false,
"_shards" : {
"total" : 3,
"successful" : 3,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 3081982,
"max_score" : 0.0,
"hits" : [ ]
},
"aggregations" : {
"my_count" : {
"value" : 158
}
}
}
Next I need to create a visualization for the "my_count" value:
The only idea I've had so far is a metric-visualization with JSON Input, but for obvious reasons this doesn't work. It makes no sense to set the field value to "field1 when what I'm after is a combination of two fields.
Looks like this:
Maybe I'm on the proverbial wild goose chase here?
Any help is appreciated.
-J