Best way to model a query on 10K ORs?

I know this sounds like a strange question but I am looking for the sanest way to achieve this:

I have a list of ~10K ProductIds coming from a ML engine and I need to create filters and facets on the top of this list, where the product metadata is stored in ES. I am trying to find the best way to pass this list as a parameter which is 1) not too verbose 2) performant.

I can create a filter and pass 10K OR terms statements but that sounds like really freaky.

Is there a better way to do this? Also can consider change in data modelling.

The least insane way to do it would be to use a terms query.

So you mean a 10K OR filter? OK, thanks I will give it a go and let you know how it works.

I'm not sure what you mean by a OR query, but this is the terms query I was thinking about:

Gotcha! Terms not Term... I did not really dig the difference :slight_smile: