Nested queries (or secondary query)

Hi all,

I encountered an issue and will appreciate your help with it.
I have a huge index (~0.5B documents) with a mapping that includes numeric fields (enum values), one keyword field and a nested field.
The nested field includes and array of textual data (text fields) - can reach MBs of data.

I want to query the index in the following order:

  1. First filter out only the items that have specific enum values (reduce the number of optional results from 0.5B to much reasonable number) - should usually reduce the items to 10K - 100K
  2. Then go over the remained items and filter out only the relevant items which the nested items include.

I tried the nested query, as I understood it should perform some kind of a join between the two queries (regular and nested objects), however it doesn't reduce the response times.

My questions are:

  1. What am I doing wrong?
  2. Is it even possible in elastic?

Thanks in advance,
Elad.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.