Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mfshao
Copy link
Contributor

@mfshao mfshao commented Apr 13, 2020

This PR fulfills https://ctds-planx.atlassian.net/browse/PXP-4737

Adding support to nested aggregations
Example query:

query: {
  _aggregation: {
      visits: {
        visit_label: {
          histogram: {
            key
            count
          }
        }
        follow_ups: {
          days_to_follow_up: {
            histogram(rangeStep: 1) {
              key
              count
            }
          }
        }
      }
    }
  }
}

Result:

{
  "data": {
    "_aggregation": {
      "subject": {
        "visits": {
          "visit_label": {
            "histogram": [
              {
                "key": "vst_lbl_3",
                "count": 29
              },
              ...
            ]
          },
          "follow_ups": {
            "days_to_follow_up": {
              "histogram": [
                {
                  "key": [
                    1,
                    2
                  ],
                  "count": 21
                },
                ...
              ]
            }
          }
        }
      }
    }
  }
}

Deployed at https://mingfei.planx-pla.net/query

New Features

  • Supports aggregation on nested documents (nested aggregation)

Dependency updates

  • The current ES nested aggregation query syntax requires ES 6.7+ (note Guppy will not work for ES 7 yet)

@lgtm-com
Copy link

lgtm-com bot commented Apr 13, 2020

This pull request introduces 1 alert when merging bb22c6a into fc10343 - view on LGTM.com

new alerts:

  • 1 for Superfluous trailing arguments

@mfshao
Copy link
Contributor Author

mfshao commented Apr 14, 2020

Notice: the nested aggregation in this branch DOES NOT work on any DEV or QA envs yet since the ES version is too old. Will update if we figured out how to address this. For now you can test this feature locally.

QA and DEV has been upgrade to ES 6.8

em-ingram
em-ingram previously approved these changes Apr 16, 2020
Copy link
Contributor

@em-ingram em-ingram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@em-ingram em-ingram self-requested a review April 27, 2020 16:43
em-ingram
em-ingram previously approved these changes Apr 27, 2020
@mfshao mfshao merged commit e47582a into master May 1, 2020
@mfshao mfshao deleted the feat/nested-agg branch May 1, 2020 16:30
@mfshao mfshao mentioned this pull request Aug 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants