# Cannot disable field cache expiration

**URL:** <https://discuss.elastic.co/t/cannot-disable-field-cache-expiration/9977>\
**Category:** Elasticsearch\
**Created:** [December 6, 2012, 7:42pm UTC](https://discuss.elastic.co/t/cannot-disable-field-cache-expiration/9977 "2012-12-06T19:42:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rore/32/399_2.png) [@rore](https://discuss.elastic.co/u/rore)\
**Post date:** [December 6, 2012, 7:42pm UTC](https://discuss.elastic.co/t/cannot-disable-field-cache-expiration/9977/1 "2012-12-06T19:42:29Z")

</div>

I've changed the default expiration of an index, setting it to some value.  
Then I want to get it back to the original non-expiring mode, setting  
index.cache.field.expire:-1 in the index update settings API.  
When I do that and try to query the index I get the following error:

IllegalArgumentException[duration cannot be negative: -1000000 NANOSECONDS]

I've seen some people complaining about this before. Is there another way  
to disable expiration again on the field cache?

--

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [December 6, 2012, 7:49pm UTC](https://discuss.elastic.co/t/cannot-disable-field-cache-expiration/9977/2 "2012-12-06T19:49:51Z")

</div>

The default should be to not have expiration on the field cache. Expiration  
is only set if explicitly defined:

[https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/cache/field/data/resident/ResidentFieldDataCache.java#L79](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/cache/field/data/resident/ResidentFieldDataCache.java#L79)

On Thu, Dec 6, 2012 at 11:42 AM, Rotem [rotem.hermon@gmail.com](mailto:rotem.hermon@gmail.com) wrote:

> I've changed the default expiration of an index, setting it to some value.  
> Then I want to get it back to the original non-expiring mode, setting  
> index.cache.field.expire:-1 in the index update settings API.  
> When I do that and try to query the index I get the following error:
> 
> IllegalArgumentException[duration cannot be negative: -1000000 NANOSECONDS]
> 
> I've seen some people complaining about this before. Is there another way  
> to disable expiration again on the field cache?
> 
> --

--

---

<div class="post-metadata">

**Author:** ![rore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rore/32/399_2.png) [@rore](https://discuss.elastic.co/u/rore)\
**Post date:** [December 6, 2012, 7:52pm UTC](https://discuss.elastic.co/t/cannot-disable-field-cache-expiration/9977/3 "2012-12-06T19:52:01Z")

</div>

Yes, but once you set it, how do you unset it? The documentation says "-1"  
is the default value (that states no expiration), this is obviously not the  
case. So how do you change it back to have no expiration?

On Thu, Dec 6, 2012 at 9:49 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> The default should be to not have expiration on the field cache.  
> Expiration is only set if explicitly defined:
> 
> [https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/cache/field/data/resident/ResidentFieldDataCache.java#L79](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/cache/field/data/resident/ResidentFieldDataCache.java#L79)
> 
> On Thu, Dec 6, 2012 at 11:42 AM, Rotem [rotem.hermon@gmail.com](mailto:rotem.hermon@gmail.com) wrote:
> 
> > I've changed the default expiration of an index, setting it to some value.  
> > Then I want to get it back to the original non-expiring mode, setting  
> > index.cache.field.expire:-1 in the index update settings API.  
> > When I do that and try to query the index I get the following error:
> > 
> > IllegalArgumentException[duration cannot be negative: -1000000  
> > NANOSECONDS]
> > 
> > I've seen some people complaining about this before. Is there another way  
> > to disable expiration again on the field cache?
> > 
> > --
> 
> --

--

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [December 6, 2012, 8:06pm UTC](https://discuss.elastic.co/t/cannot-disable-field-cache-expiration/9977/4 "2012-12-06T20:06:20Z")

</div>

Sorry, I did not read your original request fully. Multitasking is bad!

My assumption was tthat Settings are only read at start time, but it  
appears that those settings are "dynamic" and there is a listener. Never  
realized that.

The limitation seems to be on Guava. Have you tried setting it to 0?

> **[GitHub - google/guava: Google core libraries for Java](https://github.com/google/guava)**
>
> Google core libraries for Java. Contribute to google/guava development by creating an account on GitHub.

On Thu, Dec 6, 2012 at 11:52 AM, Rotem Hermon [rotem.hermon@gmail.com](mailto:rotem.hermon@gmail.com)wrote:

> Yes, but once you set it, how do you unset it? The documentation says "-1"  
> is the default value (that states no expiration), this is obviously not the  
> case. So how do you change it back to have no expiration?
> 
> On Thu, Dec 6, 2012 at 9:49 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> 
> > The default should be to not have expiration on the field cache.  
> > Expiration is only set if explicitly defined:
> > 
> > [https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/cache/field/data/resident/ResidentFieldDataCache.java#L79](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/cache/field/data/resident/ResidentFieldDataCache.java#L79)
> > 
> > On Thu, Dec 6, 2012 at 11:42 AM, Rotem [rotem.hermon@gmail.com](mailto:rotem.hermon@gmail.com) wrote:
> > 
> > > I've changed the default expiration of an index, setting it to some  
> > > value.  
> > > Then I want to get it back to the original non-expiring mode, setting  
> > > index.cache.field.expire:-1 in the index update settings API.  
> > > When I do that and try to query the index I get the following error:
> > > 
> > > IllegalArgumentException[duration cannot be negative: -1000000  
> > > NANOSECONDS]
> > > 
> > > I've seen some people complaining about this before. Is there another  
> > > way to disable expiration again on the field cache?
> > > 
> > > --
> > 
> > --
> 
> --

--

---

<div class="post-metadata">

**Author:** ![rore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rore/32/399_2.png) [@rore](https://discuss.elastic.co/u/rore)\
**Post date:** [December 6, 2012, 8:10pm UTC](https://discuss.elastic.co/t/cannot-disable-field-cache-expiration/9977/5 "2012-12-06T20:10:14Z")

</div>

Yes, tried "0", it just kills the cache.

On Thu, Dec 6, 2012 at 10:06 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> Sorry, I did not read your original request fully. Multitasking is bad!
> 
> My assumption was tthat Settings are only read at start time, but it  
> appears that those settings are "dynamic" and there is a listener. Never  
> realized that.
> 
> The limitation seems to be on Guava. Have you tried setting it to 0?
> 
> [GitHub - google/guava: Google core libraries for Java](http://code.google.com/p/guava-libraries/source/browse/guava/src/com/google/common/cache/CacheBuilder.java#640)
> 
> On Thu, Dec 6, 2012 at 11:52 AM, Rotem Hermon [rotem.hermon@gmail.com](mailto:rotem.hermon@gmail.com)wrote:
> 
> > Yes, but once you set it, how do you unset it? The documentation says  
> > "-1" is the default value (that states no expiration), this is obviously  
> > not the case. So how do you change it back to have no expiration?
> > 
> > On Thu, Dec 6, 2012 at 9:49 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > 
> > > The default should be to not have expiration on the field cache.  
> > > Expiration is only set if explicitly defined:
> > > 
> > > [https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/cache/field/data/resident/ResidentFieldDataCache.java#L79](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/cache/field/data/resident/ResidentFieldDataCache.java#L79)
> > > 
> > > On Thu, Dec 6, 2012 at 11:42 AM, Rotem [rotem.hermon@gmail.com](mailto:rotem.hermon@gmail.com) wrote:
> > > 
> > > > I've changed the default expiration of an index, setting it to some  
> > > > value.  
> > > > Then I want to get it back to the original non-expiring mode, setting  
> > > > index.cache.field.expire:-1 in the index update settings API.  
> > > > When I do that and try to query the index I get the following error:
> > > > 
> > > > IllegalArgumentException[duration cannot be negative: -1000000  
> > > > NANOSECONDS]
> > > > 
> > > > I've seen some people complaining about this before. Is there another  
> > > > way to disable expiration again on the field cache?
> > > > 
> > > > --
> > > 
> > > --
> > 
> > --
> 
> --

--

---

<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, 3:01am UTC](https://discuss.elastic.co/t/cannot-disable-field-cache-expiration/9977/6 "2017-07-06T03:01:01Z")

</div>


