AND filtering by elements of an array of objects

Hello.

I am looking to search in Algolia for users who have multiple abilities. Each ability has a name and a level. An example of a user record would look like this (not the actual data itself):

{
    "name": "John",
    "abilities": [
        {
            "name": "Magic Spear",
            "level": 3
        },
        {
            "name": "Repair",
            "level": 5
        }
    ]
}

Here, I would like to search for a user who has “Magic Spear” with level 4 or higher and “Repair” with level 5 or higher.

If the condition is only one of the two, I might solve the problem by creating an index with records split by user ability. However, doing so would result in a huge number of records, and it does not seem to support searches that combine multiple conditions.

So I would be glad if a way to filter specific objects in the array is provided. For example, it would be nice to be able to specify a filter like the following:

abilities.(name:'Magic Spear' AND level>=4) AND abilities.(name:Repair AND level>=5)

Thank you.

1 Like