COUNT after applying a FILTER

is it possible to return the count after a FILTER has been applied? I am using 1.4.2, which returns the correct results, however the COUNT returned is before any of the filters have been applied.

Ideally I would like to be able to return the COUNT before and after the filter, but this wouldn’t be that big of a problem since I could issue a second statement for the COUNT without a FILTER clause.

Thank you,


Are you talking about the FT.SEARCH api or FT.AGGREGATE api?

What I meant is the actual count, or the number of records, matching the FT.AGREGGATE criteria is the same whether I use FILTER statements or not

For instance, if FT.AGGREGATE … says there are 20 records total, FT.AGGREGATE … FILTER … also says there are 20 records, it seems to me like the total count is set prior to applying any of the FILTER statements.

If that doesn’t make sense I can provide an example.

Unfortunately the count indicator is unreliable for aggregations, or for anything where the number of results is not known ahead of time. It’s useful for search where all the results are pre-sorted, scored, etc. — however aggregations currently does not do this. You could force a sort order (AFTER filter)