(sketch_id, aggregator_name, aggregator_parameters=None,
                   index=None)
return result_obj, meta
Run an aggregator and return back results.

    Args:
        sketch_id (int): the sketch ID.
        aggregator_name (str): the name of the aggregator class to run.
        aggregator_parameters (dict): dict containing the parameters used
            for running the aggregator.
        index (list): the list of OpenSearch index names to use.

    Returns:
        Tuple[Object, Dict]: a tuple containing the aggregator result object
            (instance of AggregationResult) and a dict containing metadata
            from the aggregator run.
Run an aggregator and return back results.
Run an aggregator and return back results .
def run_aggregator(sketch_id, aggregator_name, aggregator_parameters=None,
                   index=None):
    """Run an aggregator and return back results.

    Args:
        sketch_id (int): the sketch ID.
        aggregator_name (str): the name of the aggregator class to run.
        aggregator_parameters (dict): dict containing the parameters used
            for running the aggregator.
        index (list): the list of OpenSearch index names to use.

    Returns:
        Tuple[Object, Dict]: a tuple containing the aggregator result object
            (instance of AggregationResult) and a dict containing metadata
            from the aggregator run.
    """
    agg_class = aggregator_manager.AggregatorManager.get_aggregator(
        aggregator_name)
    if not agg_class:
        return None, {}
    if not aggregator_parameters:
        aggregator_parameters = {}

    aggregator = agg_class(sketch_id=sketch_id, index=index)

    chart_type = aggregator_parameters.pop('supported_charts', None)
    chart_color = aggregator_parameters.pop('chart_color', '')

    time_before = time.time()
    result_obj = aggregator.run(**aggregator_parameters)
    time_after = time.time()

    aggregator_description = aggregator.describe

    meta = {
        'method': 'aggregator_run',
        'chart_type': chart_type,
        'chart_color': chart_color,
        'name': aggregator_description.get('name'),
        'description': aggregator_description.get('description'),
        'es_time': time_after - time_before,
    }

    if chart_type:
        meta['vega_spec'] = result_obj.to_chart(
            chart_name=chart_type,
            chart_title=aggregator.chart_title, color=chart_color)
        meta['vega_chart_title'] = aggregator.chart_title

    return result_obj, meta
def run_aggregator ( sketch_id , aggregator_name , aggregator_parameters = None , index = None ) : agg_class = aggregator_manager . AggregatorManager . get_aggregator ( aggregator_name ) if not agg_class : return None , { } if not aggregator_parameters : aggregator_parameters = { } aggregator = agg_class ( sketch_id = sketch_id , index = index ) chart_type = aggregator_parameters . pop ( 'supported_charts' , None ) chart_color = aggregator_parameters . pop ( 'chart_color' , '' ) time_before = time . time ( ) result_obj = aggregator . run ( * * aggregator_parameters ) time_after = time . time ( ) aggregator_description = aggregator . describe meta = { 'method' : 'aggregator_run' , 'chart_type' : chart_type , 'chart_color' : chart_color , 'name' : aggregator_description . get ( 'name' ) , 'description' : aggregator_description . get ( 'description' ) , 'es_time' : time_after - time_before , } if chart_type : meta [ 'vega_spec' ] = result_obj . to_chart ( chart_name = chart_type , chart_title = aggregator . chart_title , color = chart_color ) meta [ 'vega_chart_title' ] = aggregator . chart_title return result_obj , meta