Check the environment variable and the given argument parameter to decide if aggregations needed.

        argument value is expected to be '0' or '1'

def should_aggregate(self, req):
        """Check the environment variable and the given argument parameter to decide if aggregations needed.

        argument value is expected to be '0' or '1'
        """
        try:
            return self.app.config.get('ELASTICSEARCH_AUTO_AGGREGATIONS') or \
                   bool(req.args and int(req.args.get('aggregations')))
        except (AttributeError, TypeError):
            return False