Query index for [numeric_attribute] < 20 OR [numeric_attribute] not set

Hi, I want to query for a numeric attribute I have, while still returning all items that doesn’t contain the numeric attribute. Is it possible here or do I need to do 2 separate queries and merge the results?

In summary, I would like to query index for [numeric_attribute] < 20 OR [numeric_attribute] not set.

I tried passing [numeric_attribute] <= 20 OR [numeric_attribute]: null and [numeric_attribute] <= 20 OR [numeric_attribute] = null, but none worked.

Hi there,

I recommending checking out our “optionalFilters” API parameter as your use-case matches the general use of this parameter.

Let me know if you have further questions.
Best regards,

1 Like

Unfortunatelly, the optionalFilters still doesn’t match my use-case. I may not have explained properly:

I have some items that have a proper value on [numeric_attribute] and some that doesn’t have the attribute at all. What I want to query are: (a) if the item has the [numeric_attribute], filter them by the number (e.g. < 20); (b) if the item does not have [numeric_attribute], return the item.

Using optionalFilters, every item will be returned.