Can we access a field when doc_values & index = false and _source is disabled?

I have a field that I don't want to search/aggregate.. on but which I'd like to retrieve as part of a doc but as well preserve as much as I can the storage (typically a 'metric' document).

Here is my current template:

{
  "index_patterns": [
    "*_metric"
  ],
  "mappings": {
    "_doc": {
      "_source": {
        "enabled": false
      },
      "properties": {
        "id": {
          "type": "keyword"
        },
        "t": {
          "type": "integer"
        },
        "v": {
          "type": "float",
          "index": false,
          "doc_values": false
        }
      }
    }
  }
}

Basically v stands for the value and t for the timestamp.
I query providing one or more metric ID with a time range:

{
  "docvalue_fields": [
    "id",
    "t"
  ],
  "query": {
    "bool": {
      "filter": [
        {
          "range": {
            "t": {
              "gte": 1519313081,
              "lte": 1519314881
            }
          }
        },
        {
          "terms": {
            "id": [
              "SomeMetricId"
            ]
          }
        }
      ]
    }
  },
  "sort": [
    {
      "t": {
        "order": "asc"
      }
    }
  ],
  "size": 200
}

To get the value within the response, am I forced to set doc_values=true?
Is there is another way to still access to the value?

Many thanks

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