Skip to content

Commit c0ebea0

Browse files
committed
Remove ElasticsearchQueryCachingPolicy (#27190)
We have an hidden setting called `index.queries.cache.term_queries` that disables caching of term queries in the query cache. Though term queries are not cached in the Lucene UsageTrackingQueryCachingPolicy since version 6.5. This makes the es policy useless but also makes it impossible to re-enable caching for term queries. This change appeared in Lucene 6.5 so this setting is no-op since version 5.4 of Elasticsearch The change in this PR removes the setting and the custom policy.
1 parent 49959b6 commit c0ebea0

File tree

6 files changed

+1
-131
lines changed

6 files changed

+1
-131
lines changed

core/src/main/java/org/elasticsearch/common/settings/IndexScopedSettings.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
145145
IndexModule.INDEX_STORE_PRE_LOAD_SETTING,
146146
IndexModule.INDEX_QUERY_CACHE_ENABLED_SETTING,
147147
IndexModule.INDEX_QUERY_CACHE_EVERYTHING_SETTING,
148-
IndexModule.INDEX_QUERY_CACHE_TERM_QUERIES_SETTING,
149148
FsDirectoryService.INDEX_LOCK_FACTOR_SETTING,
150149
EngineConfig.INDEX_CODEC_SETTING,
151150
EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS,

core/src/main/java/org/elasticsearch/index/IndexModule.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@ public final class IndexModule {
101101
public static final Setting<Boolean> INDEX_QUERY_CACHE_EVERYTHING_SETTING =
102102
Setting.boolSetting("index.queries.cache.everything", false, Property.IndexScope);
103103

104-
// This setting is an escape hatch in case not caching term queries would slow some users down
105-
// Do not document.
106-
public static final Setting<Boolean> INDEX_QUERY_CACHE_TERM_QUERIES_SETTING =
107-
Setting.boolSetting("index.queries.cache.term_queries", false, Property.IndexScope);
108-
109104
private final IndexSettings indexSettings;
110105
private final AnalysisRegistry analysisRegistry;
111106
// pkg private so tests can mock

core/src/main/java/org/elasticsearch/index/shard/ElasticsearchQueryCachingPolicy.java

Lines changed: 0 additions & 56 deletions
This file was deleted.

core/src/main/java/org/elasticsearch/index/shard/IndexShard.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,7 @@ public IndexShard(
291291
if (IndexModule.INDEX_QUERY_CACHE_EVERYTHING_SETTING.get(settings)) {
292292
cachingPolicy = QueryCachingPolicy.ALWAYS_CACHE;
293293
} else {
294-
QueryCachingPolicy cachingPolicy = new UsageTrackingQueryCachingPolicy();
295-
if (IndexModule.INDEX_QUERY_CACHE_TERM_QUERIES_SETTING.get(settings) == false) {
296-
cachingPolicy = new ElasticsearchQueryCachingPolicy(cachingPolicy);
297-
}
298-
this.cachingPolicy = cachingPolicy;
294+
cachingPolicy = new UsageTrackingQueryCachingPolicy();
299295
}
300296
indexShardOperationPermits = new IndexShardOperationPermits(shardId, logger, threadPool);
301297
searcherWrapper = indexSearcherWrapper;

core/src/test/java/org/elasticsearch/index/shard/ElasticsearchQueryCachingPolicyTests.java

Lines changed: 0 additions & 61 deletions
This file was deleted.

test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,6 @@ public void randomIndexTemplate() throws IOException {
429429
if (randomBoolean()) {
430430
randomSettingsBuilder.put(IndexModule.INDEX_QUERY_CACHE_EVERYTHING_SETTING.getKey(), randomBoolean());
431431
}
432-
if (randomBoolean()) {
433-
randomSettingsBuilder.put(IndexModule.INDEX_QUERY_CACHE_TERM_QUERIES_SETTING.getKey(), randomBoolean());
434-
}
435432
PutIndexTemplateRequestBuilder putTemplate = client().admin().indices()
436433
.preparePutTemplate("random_index_template")
437434
.setPatterns(Collections.singletonList("*"))

0 commit comments

Comments
 (0)