Best way to model a query on 10K ORs?


(Aliostad) #1

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.


(Adrien Grand) #2

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


(Aliostad) #3

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


(Adrien Grand) #4

I'm not sure what you mean by a OR query, but this is the terms query I was thinking about: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html


(Aliostad) #5

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


(system) #6