Filter based on id, not on metadata

After we make a query, we want to avoid showing the same results in the next query response, so we want to filter the results based on the previously fetched ids.

Is there a way to filter based on id rather than the metadata?

We can put the id in the metadata, but it will be maximum cardinality so probably high cost

2 Likes

Did you ever get an answer for this? Is it possible? I’m looking to do the exact same thing.

Hello @0x-jj and @doable,

After we make a query, we want to avoid showing the same results in the next query response, so we want to filter the results based on the previously fetched ids.

I would like to know more about your use case; why would you want to do this?

There might be a better way of solving this problem. A native approach is to do both queries and filter on the client side.

With our new Serverless you can do some filtering base on the prefix of the ID, but that’s for list operation and not query - manage rag documents

Hello @patrick1,

I think it would be a useful feature to have as well. In my case, I’m doing retrieval on books and I receive the list of ids of books that the user has previously read so I’d like to filter them out from the query. A possible workaround for me would be to include the title, ean (or isbn) of each book as metadata and filter based on these. The problem though is that I can’t do it for the title because some books have the same title and as for the isbns and eans I don’t always have values for them.

I could also duplicate the id field as a metadata, but I don’t know if that’s recommended. Any advice ?