When are the DOC_VALUES used by elastic?

Hi,
In the documentation and in some of the posts, you recommend using multi-fields to have a particular field available for both full text search and aggregations / sorting.
Something like this:

"properties": {
  "title": {
    "type": "text",
    "analyzer": "my_analyzer",
    "fields": {
      "raw": {
        "type": "keyword",
        "index": false
      }
    }
  }
}

Doc_values are available by default for data types <> text.
Does it mean that every sorting or aggregation on title.raw will always use doc_values access pattern to perform a required operation?

In which case using multi-fields with the doc_values disabled could be useful?

kind regards,
Kasia

From https://www.elastic.co/guide/en/elasticsearch/reference/current/doc-values.html:

" If you are sure that you don’t need to sort or aggregate on a field, or access the field value from a script, you can disable doc values in order to save disk space"

Hope this helps,
Isabel

It helped:slight_smile: Thank you, Isabel.
As for the second question, I already know the answer. For instance, multi-fields to use 2 different analyzers for a multi-match query in order to increase recall could be a case.

best regards,
Kasia

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