title: Why are is IndexOrDocValuesQuery taking so long?
body: <p>I am using a 5 node elasticsearch cluster with a ~120GB index.</p>
  
  <p>We are having issues with slow queries that have several filters. After profiling our queries, I see that IndexOrDocValuesQuery is taking about 3.2 seconds each. Each query has about 4 or 5 of these steps which cause it to take 20 seconds. What is weird is that the TermQuery which I would imagine is much more expensive takes 64 ms.</p>
  
  <p>Where should we poke around to get more information as to what could be slowing these queries down?</p>
  
  <p>Elasticsearch V5.5, I think there are like 280M documents but 40M primary documents (without nested)</p>
  
  <p>Node Specs:
  4 CPUs
  26 GB RAM
  12 GB Heap</p>
  
  <p>5 Data Nodes, 2 Masters, 2 Clients. Masters and clients are much lower speced than nodes.</p>
  
  <p>Here is the query: <a href="https://gist.github.com/wakawaka54/d4cad864d858efc41a0b2806ea0041b4" rel="nofollow noreferrer">https://gist.github.com/wakawaka54/d4cad864d858efc41a0b2806ea0041b4</a> 1</p>
  
  <p>Here is the query profile result: <a href="https://gist.github.com/wakawaka54/6b52fd0eef2b8ead1589241e65c239fe" rel="nofollow noreferrer">https://gist.github.com/wakawaka54/6b52fd0eef2b8ead1589241e65c239fe</a></p>
  
  <p>Here is the index mapping:
  <a href="https://gist.github.com/wakawaka54/417602c8f73a613830904b20398b7bac" rel="nofollow noreferrer">https://gist.github.com/wakawaka54/417602c8f73a613830904b20398b7bac</a></p>