From 8b84301744052814acb189e616a1afd96d2aee7a Mon Sep 17 00:00:00 2001 From: Patric Forsgard Date: Sun, 15 Feb 2015 13:12:02 +0100 Subject: [PATCH 1/2] Add index-settings for index.cache.query.enable #1244 --- src/Nest/DSL/UpdateSettingsDescriptor.cs | 9 ++++++++- .../UpdateSettings/UpdateSettingsBody.json | 1 + .../UpdateSettings/UpdateSettingsRequestTests.cs | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Nest/DSL/UpdateSettingsDescriptor.cs b/src/Nest/DSL/UpdateSettingsDescriptor.cs index 0f392688997..945755ff6c9 100644 --- a/src/Nest/DSL/UpdateSettingsDescriptor.cs +++ b/src/Nest/DSL/UpdateSettingsDescriptor.cs @@ -59,6 +59,9 @@ public interface IUpdateSettingsRequest : IIndexOptionalPath RoutingAllocationInclude { get; set; } @@ -236,6 +241,8 @@ public partial class UpdateSettingsDescriptor string IUpdateSettingsRequest.CacheFilterExpire { get; set; } + bool? IUpdateSettingsRequest.CacheQueryEnable { get; set; } + string IUpdateSettingsRequest.GatewaySnapshotInterval { get; set; } IDictionary IUpdateSettingsRequest.RoutingAllocationInclude { get; set; } diff --git a/src/Tests/Nest.Tests.Unit/ObjectInitializer/UpdateSettings/UpdateSettingsBody.json b/src/Tests/Nest.Tests.Unit/ObjectInitializer/UpdateSettings/UpdateSettingsBody.json index 7a6280773d2..d74836283f2 100644 --- a/src/Tests/Nest.Tests.Unit/ObjectInitializer/UpdateSettings/UpdateSettingsBody.json +++ b/src/Tests/Nest.Tests.Unit/ObjectInitializer/UpdateSettings/UpdateSettingsBody.json @@ -16,6 +16,7 @@ "index.translog.disable_flush": true, "index.cache.filter.max_size": "-1", "index.cache.filter.expire": "-1", + "index.cache.query.enable": true, "index.gateway.snapshot_interval": "5s", "index.routing.allocation.include": { "tag": "value1,value2" diff --git a/src/Tests/Nest.Tests.Unit/ObjectInitializer/UpdateSettings/UpdateSettingsRequestTests.cs b/src/Tests/Nest.Tests.Unit/ObjectInitializer/UpdateSettings/UpdateSettingsRequestTests.cs index 0903c535f42..5877f4aa4e9 100644 --- a/src/Tests/Nest.Tests.Unit/ObjectInitializer/UpdateSettings/UpdateSettingsRequestTests.cs +++ b/src/Tests/Nest.Tests.Unit/ObjectInitializer/UpdateSettings/UpdateSettingsRequestTests.cs @@ -35,6 +35,7 @@ public UpdateSettingsRequestTests() TranslogDisableFlush = true, CacheFilterMaxSize = "-1", CacheFilterExpire = "-1", + CacheQueryEnable = true, GatewaySnapshotInterval = "5s", RoutingAllocationInclude = new Dictionary { { "tag", "value1,value2" } }, RoutingAllocationExclude = new Dictionary { { "tag", "value3" } }, From afbd0f749cfd46182c50ae6a73fc62e35dffb4f5 Mon Sep 17 00:00:00 2001 From: Patric Forsgard Date: Sun, 15 Feb 2015 14:17:45 +0100 Subject: [PATCH 2/2] Update descriptor with the new settings Add the index.cache.query.enabled to the UpdateSettingsDescriptior also --- src/Nest/DSL/UpdateSettingsDescriptor.cs | 9 +++++++++ .../Core/UpdateSettings/AllUpdateSettings.json | 1 + .../Core/UpdateSettings/UpdateSettingsTests.cs | 1 + 3 files changed, 11 insertions(+) diff --git a/src/Nest/DSL/UpdateSettingsDescriptor.cs b/src/Nest/DSL/UpdateSettingsDescriptor.cs index 945755ff6c9..22f41c69f17 100644 --- a/src/Nest/DSL/UpdateSettingsDescriptor.cs +++ b/src/Nest/DSL/UpdateSettingsDescriptor.cs @@ -441,6 +441,15 @@ public UpdateSettingsDescriptor CacheFilterExpire(string cacheFilterExpire) return this; } + /// + /// Enable or disable the query cache. + /// + public UpdateSettingsDescriptor CacheQueryEnable(bool cacheQueryEnable) + { + this.Self.CacheQueryEnable = cacheQueryEnable; + return this; + } + /// /// The gateway snapshot interval (only applies to shared gateways). Defaults to 10s. /// diff --git a/src/Tests/Nest.Tests.Unit/Core/UpdateSettings/AllUpdateSettings.json b/src/Tests/Nest.Tests.Unit/Core/UpdateSettings/AllUpdateSettings.json index d36e69b35b4..00042a46d3c 100644 --- a/src/Tests/Nest.Tests.Unit/Core/UpdateSettings/AllUpdateSettings.json +++ b/src/Tests/Nest.Tests.Unit/Core/UpdateSettings/AllUpdateSettings.json @@ -16,6 +16,7 @@ "index.translog.disable_flush": true, "index.cache.filter.max_size": "1Gb", "index.cache.filter.expire": "1m", + "index.cache.query.enable": true, "index.gateway.snapshot_interval": "1h", "index.routing.allocation.include": { "_ip": "10.0.0.1" diff --git a/src/Tests/Nest.Tests.Unit/Core/UpdateSettings/UpdateSettingsTests.cs b/src/Tests/Nest.Tests.Unit/Core/UpdateSettings/UpdateSettingsTests.cs index d4823019e87..cbf3eca4c6d 100644 --- a/src/Tests/Nest.Tests.Unit/Core/UpdateSettings/UpdateSettingsTests.cs +++ b/src/Tests/Nest.Tests.Unit/Core/UpdateSettings/UpdateSettingsTests.cs @@ -20,6 +20,7 @@ public void AllUpdateSettings() .BlocksWrite() .CacheFilterExpire("1m") .CacheFilterMaxSize("1Gb") + .CacheQueryEnable(true) .CodeBloomLoad() .Codec("default") .CompoundFormat()