# How to make sure doc\_values of the field is currently works?

**URL:** <https://discuss.elastic.co/t/how-to-make-sure-doc-values-of-the-field-is-currently-works/62548>\
**Category:** Elasticsearch\
**Created:** [October 8, 2016, 6:53am UTC](https://discuss.elastic.co/t/how-to-make-sure-doc-values-of-the-field-is-currently-works/62548 "2016-10-08T06:53:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![itplayer](https://avatars.discourse-cdn.com/v4/letter/i/d26b3c/32.png) [@itplayer](https://discuss.elastic.co/u/itplayer)\
**Post date:** [October 8, 2016, 6:53am UTC](https://discuss.elastic.co/t/how-to-make-sure-doc-values-of-the-field-is-currently-works/62548/1 "2016-10-08T06:53:57Z")

</div>

Is there anyway to examine that the field is enabled doc\_values. I know that if you want to enable doc\_values of field, just set mapping doc\_values:true.  
But I'm a little bit not sure if it is actually effective.

According to this document  
[https://www.elastic.co/guide/en/elasticsearch/guide/1.x/doc-values.html#\_enabling\_doc\_values](https://www.elastic.co/guide/en/elasticsearch/guide/1.x/doc-values.html#_enabling_doc_values)

Doc values can be enabled for numeric, date, Boolean, binary, and geo-point fields, and for not\_analyzed string fields.

If this is say if I have a filed and mapping goes like

```
  "clientMac":{
     "type":"string",
     "analyzer":"keyword",
     "doc_values":true
  }

```

Since it is not "not\_analyzed", will this field _doc\_values enabled_ ?

When and what time that Elasticsearch will determine the filed should doc\_values enabled or not? (in source code level).

Your input is highly appreciated.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 8, 2016, 9:11am UTC](https://discuss.elastic.co/t/how-to-make-sure-doc-values-of-the-field-is-currently-works/62548/2 "2016-10-08T09:11:21Z")

</div>

> [@itplayer](#):
>
> Since it is not "not\_analyzed", will this field doc\_values enabled ?

Only because you also have `"doc_values":true`, as in 1.X doc values are not enabled by default.

---

<div class="post-metadata">

**Author:** ![itplayer](https://avatars.discourse-cdn.com/v4/letter/i/d26b3c/32.png) [@itplayer](https://discuss.elastic.co/u/itplayer)\
**Post date:** [October 8, 2016, 9:39am UTC](https://discuss.elastic.co/t/how-to-make-sure-doc-values-of-the-field-is-currently-works/62548/3 "2016-10-08T09:39:12Z")

</div>

Ok, I see, but my question is: how to check this is enabled and works correctly?

In my example, does it really works on field that set analyzer "keyword" or any custom analyzer?

Will elasticsearch ignore those field that not applied for doc values, where to see these log messages that has beend ignored by elasticsearch?

Thanks for your advice.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 8, 2016, 9:45am UTC](https://discuss.elastic.co/t/how-to-make-sure-doc-values-of-the-field-is-currently-works/62548/4 "2016-10-08T09:45:09Z")

</div>

> [@itplayer](#):
>
> Ok, I see, but my question is: how to check this is enabled and works correctly?

If it's mapped it's working. You can check with `_cat/fielddata` as well.

> [@itplayer](#):
>
> In my example, does it really works on field that set analyzer "keyword" or any custom analyzer?

[Keyword](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/analysis-keyword-analyzer.html) for 5.X, and only if the custom analyser includes `not_analyzed`.

> [@itplayer](#):
>
> Will elasticsearch ignore those field that not applied for doc values, where to see these log messages that has beend ignored by elasticsearch?

It doesn't ignore them, it just does what is expected and doesn't create doc values for them. It is not logged because it's expected behaviour.

---

<div class="post-metadata">

**Author:** ![itplayer](https://avatars.discourse-cdn.com/v4/letter/i/d26b3c/32.png) [@itplayer](https://discuss.elastic.co/u/itplayer)\
**Post date:** [October 8, 2016, 9:56am UTC](https://discuss.elastic.co/t/how-to-make-sure-doc-values-of-the-field-is-currently-works/62548/5 "2016-10-08T09:56:21Z")

</div>

Thank you.  
In your post, you said that " only if the custom analyser includes not\_analyzed."  
Do you mean if the custom analyzer won't work like following?  
==Field==  
"clientMac":{  
"type":"string",  
"analyzer":"lower\_case\_keyword",  
"doc\_values":true  
}

==Custom Analyzer==

```
     "lower_case_keyword":{
        "type":"custom",
        "tokenizer":"keyword",
        "filter": [
           "lowercase"
        ]
     }

```

Will my field "clientMac" doc\_values enable or not?

By the way, I see a document here  
[https://www.elastic.co/guide/en/elasticsearch/reference/1.7/analysis-keyword-analyzer.html](https://www.elastic.co/guide/en/elasticsearch/reference/1.7/analysis-keyword-analyzer.html)

Seems v1.7 support this keyword analyzer, if I change above field mapping to  
"clientMac":{  
"type":"string",  
"analyzer":"keyword",  
"doc\_values":true  
}

Will make any difference?

---

<div class="post-metadata">

**Author:** ![itplayer](https://avatars.discourse-cdn.com/v4/letter/i/d26b3c/32.png) [@itplayer](https://discuss.elastic.co/u/itplayer)\
**Post date:** [October 8, 2016, 11:01am UTC](https://discuss.elastic.co/t/how-to-make-sure-doc-values-of-the-field-is-currently-works/62548/6 "2016-10-08T11:01:26Z")

</div>

ok, I doing a quick test. My Elasticsearch is 1.7.2

==field mapping==  
"clientMac":{  
"type":"string",  
"analyzer":"keyword",  
"doc\_values":true  
}

This is actually will cause exception that Elasticsearch won't work  
==\>org.elasticsearch.index.mapper.MapperParsingException: Field [clientMac] cannot be analyzed and have doc values

So my conclusion is unless you specifically set doc\_values:true, and make index:"not\_analyzed" on string field(or numeric / boolean / date), you will not get doc\_values enabled.

Although this is _obviously_ documented here:

[https://www.elastic.co/guide/en/elasticsearch/guide/1.x/doc-values.html#\_enabling\_doc\_values](https://www.elastic.co/guide/en/elasticsearch/guide/1.x/doc-values.html#_enabling_doc_values)

---

<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:** [July 5, 2017, 10:13pm UTC](https://discuss.elastic.co/t/how-to-make-sure-doc-values-of-the-field-is-currently-works/62548/7 "2017-07-05T22:13:51Z")

</div>


