Count statement in Elastic Search based on Multiple Columns

am trying to implement a query in elastic search.

      Col1 Col2 Col3 Date
        1     1    1     D1
        1     1    2     D1
        2     1    1     D1
        1     1    1     D2

From Table similar to shown above. I want to find unique groups based on two columns Col1,Col2 and date in elastic search.

One option available is to use aggregations. But, using that will give me output similar to this.

     date{
          col1:{
              col2:{count: some_value}
             }
        }

I need to take count as 1 if Col1 and Col2 matches. so the output should look like this.

     date{
         count : value
       }

How can I write such query?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.