Get hit (hits) based on key of an object's entry

Hi! I would like to ask you is it possible to get hits from algolia based on key of an object’s entry?

I know it’s possible to do it for non-nested values (like SKU in our case which is string), example:

await index.search('', {
    filters: '(sku:1234-gray OR sku:1234-orange OR sku:1234-blue)'
 })

However, I need to get hits based on key of an object’s entry. Let’s consider this hit data model:

hit: {
    sku: '1234-gray',
    product_variants: {
        key_to_use_for_algolia_request: { ... },
        another_key_to_ignore: { ... }
    },
}

Is it possible to get hit using key_to_use_for_algolia_request?

It is not possible to modify hit’s data model.

Thanks in advance :slight_smile:

Hi @bartosz.grabowski, Algolia supports dot(.) notation for nested attributes. So you should be able to do something like

await index.search('', {
    filters: '(product_variants.key_to_use_for_algolia_request:value_to_use)'
 })

https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/creating-and-using-nested-attributes/