title: How does doc_values work in ElasticSearch
body: <p>Can someone explain to me how does doc_values work?
  Why would that help me when doing aggregations?</p>
  
  <p>Would it help me when filtering?</p>
  
  <p>For filtering, the way I see it, ElasticSearch would access the inverted index to find "pointers" to all the documents that fit the aggregations, so doc_values, which is an "uninverted index" according to the documentation, is irrelevant? Or am I wrong?</p>
  
  <p>Can someone explain the flow of an aggregation when doc_values is enabled, and when it isn't, and why enabling it saves memory?</p>
  
  <p>Thanks.</p>