Hi,
I have aggregated StatusOpen field using sum operator, grouped by text_sentiment and subject_line fields.
It's giving correct results in kibana.
I tried it in vega using below spec :
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"width": 400,
data: {
url: {
%context%: true
index: index_dash_perf
body: {
size:500000
_source: ["text_sentiment", "StatusOpen", "StatusSent", "StatusCode", "subject_line", "duplicates"]
}
}
format: {property: "hits.hits"}
},
"transform": [
{"filter": "datum._source.text_sentiment != null"},
{"filter": "datum._source.duplicates != 0"},
{
"aggregate": [
{"op": "sum", "field": "_source.StatusOpen","as": "aud_count"}
],
"groupby": ["_source.subject_line","_source.text_sentiment"]
}
],
"encoding": {
"x": {"field": "_source.subject_line", "type": "nominal", "title": null},
"y": {"field": "aud_count", "type": "quantitative", "title": null},
"color": {
"field": "_source.text_sentiment",
"type": "nominal",
"title": "Sentiment",
"scale":{"scheme": "lighttealblue"}
}
},
"layer": [
{
"mark": "bar"
}, {
"mark": {
"type": "text",
"align": "left",
"dx": -6,
"dy": -5
},
"encoding": {
"text": {"field": "aud_count", "type": "quantitative"}
}
}]
}
Output :
for count operator its giving correct results, sum operator is just giving 0.