Equivalent to SQL IN equivalent

I have a scenario where I need to search for some documents. The values ​​of one of the search fields are the result of another search query. In a typical SQL script, it looks something like this:

Select * from table1 where column1 IN( select columnnx from table2 where date 'sampleDate')

One work for this that I found is to cache this columnx from document2 (table2) and use it in termQuerys

boolQuery.must(QueryBuilders.termsQuery(fieldName, cachedList);

However, I am worried about the performance of this, as my cache can grow and contain more than 100,000 elements. Therefore, if there is an alternative solution, suggest.

Thanks in advance. PS I'm new to elastics.

+4
source share

Source: https://habr.com/ru/post/1628999/


All Articles