does RediSearch support facets

facets search is quite commonly implemented by the search engines, Ex, lucene, does RediSearch support facets? I don’t see relate doc.

if RediSearch does not support facets, do you guys have any alternative solution to have facets search on Redis data set?


If you mean counting categories etc - then at the moment no, but the next version will include aggregations which can do that and way more. ETA is 1-2 weeks

Yes, that's exactly what I asked, counting categories.
Good to know that will be available soon.

Great. The way it will work is that you’ll have to issue two separate requests - one for the actual results, and one for the facets.
The fact query will look like this:

FT.AGGREGATE myIndex “hello world”
GROUPBY 1 @category
REDUCE count 0 AS categry_size
SORTBY 1 @category_size MAX 20

This will yield the top 20 categories for the query “hello world”

You can actually play with it right now, but it’s not documented yet, so I’d wait a bit more.

What about if we have an array of categories? I have a similar requirement but I couldn’t write the query. How can I use groupby and reduce if I have an array of categories?

31 Ocak 2018 Çarşamba 12:28:59 UTC+3 tarihinde Dvir Volk yazdı:

Hello Mehmet,

Please excuse my ignorance, but could you please clarify what you mean by “an array of categories”?




We want to make facet search not by category but by variations like We have a lot of variations and variation values in our filters.

I send you our data model by attach. We want to make facet search by that variation serials. These serials are id of the variations and we will get the real names of them from cache. I tried a query something like this:

FT.AGGREGATE product_search mollit APPLY split(@variationSerials) as serial GROUPBY 1 @serial REDUCE COUNT 0

I can’t get any results with this query, it runs forever. If I don’t use GROUPBY part I can see the variation serials seperately. How can I group and reduce to get count of each variation serials?

17 Ağustos 2018 Cuma 16:34:37 UTC+3 tarihinde Itamar Haber yazdı:

I do not want to hijack someone else’s topic, but my question is actually very related to the subject.

We want to use RediSearch aggregations as facets in our search. We have various properties that needs to be grouped and calculated on every search.

Let’s say we have a user search with some personal info.

Is it possible to do a facet search with only one FT. AGGREGATE request, eg: GROUP and COUNT these fields seperatly (gender, age, country).

Or do we have to do a separate FT.AGGREGATE for each property, which is probably more time consuming?

Just like in any other database, you can group by whatever you want and count whatever you want.
But for each grouping and counting you have a cartesian product. If you group by age, gender and occupation you end up with a shit ton of groups.

If you want to group and count by age, then group and count by gender, then group and count by occupation -that’s 3 separate queries.

What this use case essentially requires is several distinct pipelines that can be executed in parallel. It’s usually not the strict nature of a “single” query (the age, for example- in this query, has no relation to gender) but the user still would like them to be summed. When specifying multiple GROUPBYs currently, it all affects a single pipeline. I am wondering if we cannot add a MULTIGROUPBY which functions just like GROUPBY, but executes pipelines in parallel (in theory).

Mark Nunberg | Senior Software Engineer
Redis Labs - home of Redis