How to filter based on list of values

Hi

I have a list of field’s values like 1,2,3,4,5
I wanna filter that field by any of these values in the REST API
so, the query would be something like this

filed=1 or field=2 or field=3 or field4 or field=5

as you see if the list is too long (like 1000) it wouldn’t be accepted in the URL
do we have something like SQL?

field in (1,2,3,4,5)

Using IN would just postpone it; IIRC, the issue occurs because (some) relational databases have a limit on the size of the request.
Instead of making one big request, do multiple requests.

Additionally, instead of doing it like so, you can write a query such as field > 0 AND field <= 5.
Your exact case probably differs, but it can probably be compressed as above.

Worst case; make multiple requests; in such cases I tend to use chunks of size 300-400

1 Like

@tjerman the field most of the time is an ID from different systems
and for multiple requests wouldn’t be efficient if you have 10K IDs!

That is true, but if you have a larger amount of data you’ll probably need to fetch it in chunks regardless so it doesn’t change much if you split up the query.

@tjerman is there any implementation plan for such functionality?

For which part?

Supporting IN? Not that I would know of – as mentioned above, it wouldn’t solve the problem.

Chunking requests? That you’ll need to do manually. Iterators, under the hood, load data in chunks to avoid overloading the system, but they won’t split up the query.
Wrap the iterator in another iterator that splits up the query values.

1 Like