Skip to content

Column

This is the object that the .columns() function expects as parameters. It represents the field used to perform the aggregate query. An example of its use is below.

1
2
3
4
5
6
7
8
pivotQuery = cf.provider('elasticsearch')
        .source('logstash-2015.05.*')
        .columns(cf.Column('@timestamp').func('YEAR'))
        .metrics(cf.Metric('count'))
        .filter(cf.Filter('@timestamp')
                         .between('2025-05-18 14:00:00.000', '2035-05-18 14:59:59.999'))
        .element('dummy')
        .execute();

The Column constructor takes the name of the field that exists in the data engine and optionally a label.

Note

To update labels, the best practice is to use Custom Metadata. This avoids having to apply the same labels multiple times in your application.

  • func() only applies to time attributes and it defines granularity of the data. The possible values are SECOND, MINUTE, HOUR, DAY, WEEK, MONTH and YEAR. If the data is in date format for example, we can not tell the object to use SECOND or MINUTE. This will be possible only data is in datetime format. If the data represents monthly events for example, there is no point in using DAY but MONTH or YEAR.

The Column object is very similar to the Row object as they define fields to aggregate by. The difference is how they are rendered in visualizations.

Refer to Querying Data for more information on how the Row and Column objects are used to perform Simple multigroup queries.