Skip to content

Commit 7abe781

Browse files
committed
Merge pull request #1245 from Tasteful/fix-index-query-cache
Add index-settings for index.cache.query.enable
2 parents bc6e768 + afbd0f7 commit 7abe781

File tree

5 files changed

+21
-1
lines changed

5 files changed

+21
-1
lines changed

src/Nest/DSL/UpdateSettingsDescriptor.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ public interface IUpdateSettingsRequest : IIndexOptionalPath<UpdateSettingsReque
5959
[JsonProperty("index.cache.filter.expire")]
6060
string CacheFilterExpire { get; set; }
6161

62+
[JsonProperty("index.cache.query.enable")]
63+
bool? CacheQueryEnable { get; set; }
64+
6265
[JsonProperty("index.gateway.snapshot_interval")]
6366
string GatewaySnapshotInterval { get; set; }
6467

@@ -154,8 +157,10 @@ public partial class UpdateSettingsRequest : IndexOptionalPathBase<UpdateSetting
154157
public string CacheFilterMaxSize { get; set; }
155158

156159
public string CacheFilterExpire { get; set; }
160+
161+
public bool? CacheQueryEnable { get; set; }
157162

158-
public string GatewaySnapshotInterval { get; set; }
163+
public string GatewaySnapshotInterval { get; set; }
159164

160165
public IDictionary<string, object> RoutingAllocationInclude { get; set; }
161166

@@ -236,6 +241,8 @@ public partial class UpdateSettingsDescriptor
236241

237242
string IUpdateSettingsRequest.CacheFilterExpire { get; set; }
238243

244+
bool? IUpdateSettingsRequest.CacheQueryEnable { get; set; }
245+
239246
string IUpdateSettingsRequest.GatewaySnapshotInterval { get; set; }
240247

241248
IDictionary<string, object> IUpdateSettingsRequest.RoutingAllocationInclude { get; set; }
@@ -434,6 +441,15 @@ public UpdateSettingsDescriptor CacheFilterExpire(string cacheFilterExpire)
434441
return this;
435442
}
436443

444+
/// <summary>
445+
/// Enable or disable the query cache.
446+
/// </summary>
447+
public UpdateSettingsDescriptor CacheQueryEnable(bool cacheQueryEnable)
448+
{
449+
this.Self.CacheQueryEnable = cacheQueryEnable;
450+
return this;
451+
}
452+
437453
/// <summary>
438454
/// The gateway snapshot interval (only applies to shared gateways). Defaults to 10s.
439455
/// </summary>

src/Tests/Nest.Tests.Unit/Core/UpdateSettings/AllUpdateSettings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"index.translog.disable_flush": true,
1717
"index.cache.filter.max_size": "1Gb",
1818
"index.cache.filter.expire": "1m",
19+
"index.cache.query.enable": true,
1920
"index.gateway.snapshot_interval": "1h",
2021
"index.routing.allocation.include": {
2122
"_ip": "10.0.0.1"

src/Tests/Nest.Tests.Unit/Core/UpdateSettings/UpdateSettingsTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public void AllUpdateSettings()
2020
.BlocksWrite()
2121
.CacheFilterExpire("1m")
2222
.CacheFilterMaxSize("1Gb")
23+
.CacheQueryEnable(true)
2324
.CodeBloomLoad()
2425
.Codec("default")
2526
.CompoundFormat()

src/Tests/Nest.Tests.Unit/ObjectInitializer/UpdateSettings/UpdateSettingsBody.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"index.translog.disable_flush": true,
1717
"index.cache.filter.max_size": "-1",
1818
"index.cache.filter.expire": "-1",
19+
"index.cache.query.enable": true,
1920
"index.gateway.snapshot_interval": "5s",
2021
"index.routing.allocation.include": {
2122
"tag": "value1,value2"

src/Tests/Nest.Tests.Unit/ObjectInitializer/UpdateSettings/UpdateSettingsRequestTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public UpdateSettingsRequestTests()
3535
TranslogDisableFlush = true,
3636
CacheFilterMaxSize = "-1",
3737
CacheFilterExpire = "-1",
38+
CacheQueryEnable = true,
3839
GatewaySnapshotInterval = "5s",
3940
RoutingAllocationInclude = new Dictionary<string, object> { { "tag", "value1,value2" } },
4041
RoutingAllocationExclude = new Dictionary<string, object> { { "tag", "value3" } },

0 commit comments

Comments
 (0)