Pivoting in Elasticsearch

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Pivoting in Elasticsearch

depp1993
This post has NOT been accepted by the mailing list yet.
Hey ,

Can anybody tell me is there a way in elasticsearch/kibana to provide pivoting feature as in Oracle?

I want to create a report with pivoting a field with sum as aggregation.

For example : I have this schema indexed in `test-index/test-type` Doc id being `ID`.

    ID | NAME | Code | AMT
    -----------------------
    1  | ABC  |   a  | 10
    2  | DEF  |   c  | 20
    3  | XYZ  |   a  | 30
    4  | ABC  |   a  | 10
    5  | ABC  |   c  | 20
    6  | XYZ  |   b  | 30
    7  | DEF  |   c  | 10
    8  | DEF  |   a  | 20


I want to generate a report pivoting done like this : SUM(AMT) FOR CODE IN (a,b,c)

    NAME | a  |  b  | c
    ---------------------
    ABC  | 20 |  0  | 20
    DEF  | 20 |  0  | 30
    XYZ  | 30 | 30  | 0

 Can we do it using elasticsearch and reports generated in kibana?
PS. I am new to Elasticsearch Query DSL, so it would be helpful if someone having good grasp on query DSL can help me out whether its possible in ES , or suggest me a way to do this??