I have some articles, each article may have some reviewers and each reviewer may have different approve status like following:
{
ArticleId: 1,
Title: "1",
Reviewers: [
{
"Reviewer": "abc",
"Status": "Pending"
},
{
"Reviewer": "def",
"Status": "Approved"
}
]
}
{
ArticleId: 2,
Title: "2",
Reviewers: [
{
"Reviewer": "abc",
"Status": "Approved"
},
{
"Reviewer": "def",
"Status": "Approved"
}
]
}
{
ArticleId: 3,
Title: "2",
Reviewers: [
{
"Reviewer": "def",
"Status": "Approved"
}
]
}
I want to saves this data in the ES and search all articles having abc as reviewer, and aggregate by abc's review status.
{
...
buckets:[{
"doc_count": "1",
"Key": "Pending"
},{
"doc_count": "1",
"Key": "Approved"
}]
}
I was wondering how to do it in ES?