Package org.elasticsearch.indices
Class IndicesRequestCache
- java.lang.Object
-
- org.elasticsearch.common.component.AbstractComponent
-
- org.elasticsearch.indices.IndicesRequestCache
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,RemovalListener<org.elasticsearch.indices.IndicesRequestCache.Key,BytesReference>
public final class IndicesRequestCache extends AbstractComponent implements RemovalListener<org.elasticsearch.indices.IndicesRequestCache.Key,BytesReference>, java.io.Closeable
The indices request cache allows to cache a shard level request stage responses, helping with improving similar requests that are potentially expensive (because of aggs for example). The cache is fully coherent with the semantics of NRT (the index reader version is part of the cache key), and relies on size based eviction to evict old reader associated cache entries as well as scheduler reaper to clean readers that are no longer used or closed shards.Currently, the cache is only enabled for count requests, and can only be opted in on an index level setting that can be dynamically changed and defaults to false.
There are still several TODOs left in this class, some easily addressable, some more complex, but the support is functional.
-
-
Field Summary
Fields Modifier and Type Field Description static Setting<java.lang.Boolean>
INDEX_CACHE_REQUEST_ENABLED_SETTING
A setting to enable or disable request caching on an index level.static Setting<TimeValue>
INDICES_CACHE_QUERY_EXPIRE
static Setting<ByteSizeValue>
INDICES_CACHE_QUERY_SIZE
-
Fields inherited from class org.elasticsearch.common.component.AbstractComponent
deprecationLogger, logger, settings
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
onRemoval(RemovalNotification<org.elasticsearch.indices.IndicesRequestCache.Key,BytesReference> notification)
-
Methods inherited from class org.elasticsearch.common.component.AbstractComponent
logDeprecatedSetting, logRemovedSetting, nodeName
-
-
-
-
Field Detail
-
INDEX_CACHE_REQUEST_ENABLED_SETTING
public static final Setting<java.lang.Boolean> INDEX_CACHE_REQUEST_ENABLED_SETTING
A setting to enable or disable request caching on an index level. Its dynamic by default since we are checking on the cluster state IndexMetaData always.
-
INDICES_CACHE_QUERY_SIZE
public static final Setting<ByteSizeValue> INDICES_CACHE_QUERY_SIZE
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
onRemoval
public void onRemoval(RemovalNotification<org.elasticsearch.indices.IndicesRequestCache.Key,BytesReference> notification)
- Specified by:
onRemoval
in interfaceRemovalListener<org.elasticsearch.indices.IndicesRequestCache.Key,BytesReference>
-
-