# Questions about doc\_values and ttl

**URL:** <https://discuss.elastic.co/t/questions-about-doc-values-and-ttl/14791>\
**Category:** Elasticsearch\
**Created:** [December 10, 2013, 1:30pm UTC](https://discuss.elastic.co/t/questions-about-doc-values-and-ttl/14791 "2013-12-10T13:30:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddorian43](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ddorian43/32/36093_2.png) [@ddorian43](https://discuss.elastic.co/u/ddorian43)\
**Post date:** [December 10, 2013, 1:30pm UTC](https://discuss.elastic.co/t/questions-about-doc-values-and-ttl/14791/1 "2013-12-10T13:30:20Z")

</div>

So i want to filter and sort on a field. Can i only use doc\_values or  
should i also index the field for filtering ? (meaning is doc\_values only  
for sorting/faceting)

Since doc\_values accepts 'long' data types, does it also accept 'dates'  
since they are stored as 'long' ?

If a document has expired but hasn't yet been deleted, is it returned when  
searching ?

Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6e764788-f131-4fcb-aeef-2d5f7963c68c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6e764788-f131-4fcb-aeef-2d5f7963c68c%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [December 10, 2013, 1:57pm UTC](https://discuss.elastic.co/t/questions-about-doc-values-and-ttl/14791/2 "2013-12-10T13:57:04Z")

</div>

Hi,

On Tue, Dec 10, 2013 at 2:30 PM, ddorian43 [dorian.hoxha@gmail.com](mailto:dorian.hoxha@gmail.com) wrote:

> So i want to filter and sort on a field. Can i only use doc\_values or  
> should i also index the field for filtering ? (meaning is doc\_values only  
> for sorting/faceting)

Filtering will work without indexing the field if the filter that you would  
like to use has a 'field\_data' execution mode. For example, the range  
filter[1] is able to use field data to execute the filter.

However, please note that the field\_data execution mode of filters is  
_very_ different from the index execution mode and may be much slower if  
your filter matches few documents (and vice-versa, it may behave better if  
your filter matches most documents).

> Since doc\_values accepts 'long' data types, does it also accept 'dates'  
> since they are stored as 'long' ?

Indeed, dates support doc values.

> If a document has expired but hasn't yet been deleted, is it returned when  
> searching ?

Yes, documents which have expired but are not deleted yet will be returned.

> Thanks
> 
> [1]  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-range-filter.html)

--  
Adrien Grand

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j6U8mn1D%2Br088uN2A9ero4NgBK%2BTZOnHZipw4gf3CL4hQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j6U8mn1D%2Br088uN2A9ero4NgBK%2BTZOnHZipw4gf3CL4hQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:02am UTC](https://discuss.elastic.co/t/questions-about-doc-values-and-ttl/14791/3 "2017-07-06T02:02:15Z")

</div>


