index.js
function (db, indexName, whereClause, groupBy, fieldsToSum, cb) {
			var url = host + 'databases/' + db + '/facets/' + indexName + '?';
			url += whereClause ? '&query=' + encodeURIComponent(whereClause) : '';
			url += '&facetStart=0&facetPageSize=1024';
			var facets = fieldsToSum
				.map(function (field) {
					return {
						"Mode": 0,
						"Aggregation": 16,
						"AggregationField": field,
						"Name": groupBy,
						"DisplayName": field,
						"Ranges": [],
						"MaxResults": null,
						"TermSortMode": 0,
						"IncludeRemainingTerms": false
					};
				});
			url += '&facets=' + JSON.stringify(facets);
			request(url, function (error, response, body) {
				if (!error && response.statusCode === 200) {
					var result = JSON.parse(body);
					cb(null, result);
				} else {
					cb(error || new Error(response.statusCode), null);
				}
			});
		}
function (db, indexName, whereClause, groupBy, fieldsToSum, cb) {
			var url = host + 'databases/' + db + '/facets/' + indexName + '?';
			url += whereClause ? '&query=' + encodeURIComponent(whereClause) : '';
			url += '&facetStart=0&facetPageSize=1024';
			var facets = fieldsToSum
				.map(function (field) {
					return {
						"Mode": 0,
						"Aggregation": 16,
						"AggregationField": field,
						"Name": groupBy,
						"DisplayName": field,
						"Ranges": [],
						"MaxResults": null,
						"TermSortMode": 0,
						"IncludeRemainingTerms": false
					};
				});
			url += '&facets=' + JSON.stringify(facets);
			request(url, function (error, response, body) {
				if (!error && response.statusCode === 200) {
					var result = JSON.parse(body);
					cb(null, result);
				} else {
					cb(error || new Error(response.statusCode), null);
				}
			});
		}
function ( db , indexName , whereClause , groupBy , fieldsToSum , cb ) { var url = host + 'databases/' + db + '/facets/' + indexName + '?' ; url += whereClause ? '&query=' + encodeURIComponent ( whereClause ) : '' ; url += '&facetStart=0&facetPageSize=1024' ; var facets = fieldsToSum . map ( function ( field ) { return { "Mode" : 0 , "Aggregation" : 16 , "AggregationField" : field , "Name" : groupBy , "DisplayName" : field , "Ranges" : [ ] , "MaxResults" : null , "TermSortMode" : 0 , "IncludeRemainingTerms" : false } ; } ) ; url += '&facets=' + JSON . stringify ( facets ) ; request ( url , function ( error , response , body ) { if ( ! error && response . statusCode === 200 ) { var result = JSON . parse ( body ) ; cb ( null , result ) ; } else { cb ( error || new Error ( response . statusCode ) , null ) ; } } ) ; }
Generates and returns Dynamic Report.
@param {string} db
@param {string} indexName
@param {string} whereClause
@param {string} groupBy
@param {Array<string>} fieldsToSum
@param {Function} cb
Generates and returns Dynamic Report .