I have a document in the index 'submissions' which looks something like this,
{
"took" : 18,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [
{
"_index" : "submissions",
"_type" : "_doc",
"_id" : "90_169",
"_score" : 1.0,
"_source" : {
"id" : "90_169",
"locked" : false,
"account_id" : 5,
"campaign_id" : 90,
"contact_id" : 1179,
"submission_id" : 169,
"answers" : [
{
"question_id" : 8451,
"answer_bool" : true
},
{
"question_id" : 8452,
"answer_bool" : false
},
{
"question_id" : 8453,
"answer_bool" : true
},
{
"question_id" : 8454,
"answer_bool" : false
}
]
}
}
]
}
}
This is just one document.
I want to aggregate over all the questions to get a final bucket aggregations which shows number of true and false for each question_id.
Any insights on how to achieve this ?
question_id:8454, will it be liketrue_count: 0,false_count: 2. ?