Dynamic reporting

In order to explain this feature, let us start with an example. First we are creating the a simple index. The one thing to notice is that we are explicitly setting the Sort mode for Total to be Double.

Figure 1: Create index

Now we are going to Query > Reporting:

Figure 2: Go to reporting

And then we can start issue reporting queries:

Figure 2:Use reporting

This is the equivalent of doing:

select EmployeeID, sum(tot.Total) Total from Orders o join 
        select sum((Quantity * UnitPrice) * (1- Discount)) Total, OrderId from [Order Details]
        group by OrderID
    ) tot
    on o.OrderID = tot.OrderID
where o.CustomerID = @CustomerId
group by EmployeeID

The nice thing about this, and what makes this feature different from standard map/reduce, is that you can filter the input data into the aggregation. In code, this would look something like this:

  .Where(x => x.Company == "companies/1")
  .AggregateBy(x => x.Employee)
  .SumOn(x => x.Total)

This reporting availability takes advantage of the dynamic aggregation feature.