# Does none-indexd field has doc values?

**URL:** <https://discuss.elastic.co/t/does-none-indexd-field-has-doc-values/170834>\
**Category:** Elasticsearch\
**Created:** [March 5, 2019, 7:53am UTC](https://discuss.elastic.co/t/does-none-indexd-field-has-doc-values/170834 "2019-03-05T07:53:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![saiergon](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@saiergon](https://discuss.elastic.co/u/saiergon)\
**Post date:** [March 5, 2019, 7:53am UTC](https://discuss.elastic.co/t/does-none-indexd-field-has-doc-values/170834/1 "2019-03-05T07:53:14Z")

</div>

hi, if i set one filed type to text, and the index attribute set to false, dose this field will generate doc values?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 5, 2019, 8:07am UTC](https://discuss.elastic.co/t/does-none-indexd-field-has-doc-values/170834/2 "2019-03-05T08:07:32Z")

</div>

No. It won't be indexed at all.

---

<div class="post-metadata">

**Author:** ![saiergon](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@saiergon](https://discuss.elastic.co/u/saiergon)\
**Post date:** [March 5, 2019, 9:18am UTC](https://discuss.elastic.co/t/does-none-indexd-field-has-doc-values/170834/3 "2019-03-05T09:18:21Z")

</div>

what if for long type filed, i found can set a long filed as follow, i set index to false, and then i put a recored to the index, and then i can agg on this long filed. so, i guess if es build doc values fo this field?

```auto
PUT my_index_xxx
{
  "mappings": {
    "my_type": {
      "properties": {
        "customer_token": {
          "type": "long",
          "index": "false" 
        }
      }
    }
  }
}

POST my_index_xxx/my_type
{
  "customer_token":"10"
}

GET my_index_xxx/my_type/_search
{
  "aggs": {
    "NAME": {
      "terms": {
        "field": "customer_token",
        "size": 10
      }
    }
  }
}

and the search result is:
{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "my_index_xxx",
        "_type" : "my_type",
        "_id" : "st4YTWkBHyBYKlyphyhi",
        "_score" : 1.0,
        "_source" : {
          "customer_token" : "10"
        }
      }
    ]
  },
  "aggregations" : {
    "NAME" : {
      "doc_count_error_upper_bound" : 0,
      "sum_other_doc_count" : 0,
      "buckets" : [
        {
          "key" : 10,
          "doc_count" : 1
        }
      ]
    }
  }
} 

```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 5, 2019, 9:32am UTC](https://discuss.elastic.co/t/does-none-indexd-field-has-doc-values/170834/4 "2019-03-05T09:32:37Z")

</div>

Yes. Doc values are activated by default on numbers. See [https://www.elastic.co/guide/en/elasticsearch/reference/6.6/number.html#number-params](https://www.elastic.co/guide/en/elasticsearch/reference/6.6/number.html#number-params)

Doc values don't exist on text type. See [https://www.elastic.co/guide/en/elasticsearch/reference/6.6/text.html](https://www.elastic.co/guide/en/elasticsearch/reference/6.6/text.html)

---

<div class="post-metadata">

**Author:** ![saiergon](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@saiergon](https://discuss.elastic.co/u/saiergon)\
**Post date:** [March 5, 2019, 9:39am UTC](https://discuss.elastic.co/t/does-none-indexd-field-has-doc-values/170834/5 "2019-03-05T09:39:55Z")

</div>

thanks for your reply, by the way , if i set a text field index to false, dose es will build norms? because i see norms are set default to true on text field.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 2, 2019, 9:39am UTC](https://discuss.elastic.co/t/does-none-indexd-field-has-doc-values/170834/6 "2019-04-02T09:39:59Z")

</div>

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