I have an index on algolia having users like this
UserA:
{
createdAt: 1675364400000,
email: "abc@gmail.com",
products: [
{
productId: 'product1',
dateAdded: 1675364400000,
dateUpdated: 1675364400000,
status: 'active'
},
{
productId: 'product2',
dateAdded: 1675364400000,
dateUpdated: 1675364400000,
status: 'pending'
},
]
}
UserB:
{
createdAt: 1675364400000,
email: "abc1@gmail.com",
products: [
{
productId: 'product4',
dateAdded: 1675364400000,
dateUpdated: 1675364400000,
status: 'active'
},
{
productId: 'product5',
dateAdded: 1675364400000,
dateUpdated: 1675364400000,
status: 'pending'
},
]
}
Need to apply filter on algolia to get all the users who has product2 with pending status. I'm getting both UserA (because it has product2 pending) and UserB (because it has product with pending status).
I added products.status
and products.productId
in attributesForFaceting
and used the following in filters products.productId:product2 AND products.status:pending
. Its getting all the users having product2
and any products with status pending