Poor Query Performance using nested document structure

So you have a lot of nested docs here which is causing lot of internal "joins" at search time.
Few things I can think about:

  • First once the segments are loaded in memory (if you have enough memory left for the OS FS Cache), hopefully this will be much faster.
  • May be having more shards in that case with fewer documents per shard would help to reduce that time
  • Depending on your use case, don't use nested when not absolutely necessary.

But may be @jpountz has other ideas?