Left over from the `query_cache` to `request_cache` rename.
This commit is contained in:
parent
20facccaf6
commit
a14913f7b6
|
@ -130,8 +130,8 @@ public class MultiSearchRequest extends ActionRequest<MultiSearchRequest> implem
|
|||
searchRequest.types(nodeStringArrayValue(value));
|
||||
} else if ("search_type".equals(entry.getKey()) || "searchType".equals(entry.getKey())) {
|
||||
searchRequest.searchType(nodeStringValue(value, null));
|
||||
} else if ("query_cache".equals(entry.getKey()) || "queryCache".equals(entry.getKey())) {
|
||||
searchRequest.queryCache(nodeBooleanValue(value));
|
||||
} else if ("request_cache".equals(entry.getKey()) || "requestCache".equals(entry.getKey())) {
|
||||
searchRequest.requestCache(nodeBooleanValue(value));
|
||||
} else if ("preference".equals(entry.getKey())) {
|
||||
searchRequest.preference(nodeStringValue(value, null));
|
||||
} else if ("routing".equals(entry.getKey())) {
|
||||
|
|
|
@ -529,12 +529,12 @@ public class SearchRequest extends ActionRequest<SearchRequest> implements Indic
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets if this request should use the query cache or not, assuming that it can (for
|
||||
* Sets if this request should use the request cache or not, assuming that it can (for
|
||||
* example, if "now" is used, it will never be cached). By default (not set, or null,
|
||||
* will default to the index level setting if query cache is enabled or not).
|
||||
* will default to the index level setting if request cache is enabled or not).
|
||||
*/
|
||||
public SearchRequest queryCache(Boolean queryCache) {
|
||||
this.requestCache = queryCache;
|
||||
public SearchRequest requestCache(Boolean requestCache) {
|
||||
this.requestCache = requestCache;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -957,12 +957,12 @@ public class SearchRequestBuilder extends ActionRequestBuilder<SearchRequest, Se
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets if this request should use the query cache or not, assuming that it can (for
|
||||
* Sets if this request should use the request cache or not, assuming that it can (for
|
||||
* example, if "now" is used, it will never be cached). By default (not set, or null,
|
||||
* will default to the index level setting if query cache is enabled or not).
|
||||
* will default to the index level setting if request cache is enabled or not).
|
||||
*/
|
||||
public SearchRequestBuilder setQueryCache(Boolean queryCache) {
|
||||
request.queryCache(queryCache);
|
||||
public SearchRequestBuilder setRequestCache(Boolean requestCache) {
|
||||
request.requestCache(requestCache);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public class RequestCacheStats implements Streamable, ToXContent {
|
|||
|
||||
@Override
|
||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
builder.startObject(Fields.QUERY_CACHE_STATS);
|
||||
builder.startObject(Fields.REQUEST_CACHE_STATS);
|
||||
builder.byteSizeField(Fields.MEMORY_SIZE_IN_BYTES, Fields.MEMORY_SIZE, memorySize);
|
||||
builder.field(Fields.EVICTIONS, getEvictions());
|
||||
builder.field(Fields.HIT_COUNT, getHitCount());
|
||||
|
@ -103,7 +103,7 @@ public class RequestCacheStats implements Streamable, ToXContent {
|
|||
}
|
||||
|
||||
static final class Fields {
|
||||
static final XContentBuilderString QUERY_CACHE_STATS = new XContentBuilderString("request_cache");
|
||||
static final XContentBuilderString REQUEST_CACHE_STATS = new XContentBuilderString("request_cache");
|
||||
static final XContentBuilderString MEMORY_SIZE = new XContentBuilderString("memory_size");
|
||||
static final XContentBuilderString MEMORY_SIZE_IN_BYTES = new XContentBuilderString("memory_size_in_bytes");
|
||||
static final XContentBuilderString EVICTIONS = new XContentBuilderString("evictions");
|
||||
|
|
|
@ -61,7 +61,7 @@ public class RestPutWarmerAction extends BaseRestHandler {
|
|||
PutWarmerRequest putWarmerRequest = new PutWarmerRequest(request.param("name"));
|
||||
SearchRequest searchRequest = new SearchRequest(Strings.splitStringByCommaToArray(request.param("index")))
|
||||
.types(Strings.splitStringByCommaToArray(request.param("type")))
|
||||
.queryCache(request.paramAsBoolean("query_cache", null))
|
||||
.requestCache(request.paramAsBoolean("request_cache", null))
|
||||
.source(request.content());
|
||||
searchRequest.indicesOptions(IndicesOptions.fromRequest(request, searchRequest.indicesOptions()));
|
||||
putWarmerRequest.searchRequest(searchRequest);
|
||||
|
|
|
@ -110,7 +110,7 @@ public class RestSearchAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
searchRequest.extraSource(parseSearchSource(request));
|
||||
searchRequest.queryCache(request.paramAsBoolean("query_cache", null));
|
||||
searchRequest.requestCache(request.paramAsBoolean("request_cache", null));
|
||||
|
||||
String scroll = request.param("scroll");
|
||||
if (scroll != null) {
|
||||
|
|
|
@ -214,7 +214,7 @@ public class IndexWarmersMetaData extends AbstractDiffable<IndexMetaData.Custom>
|
|||
source = new BytesArray(parser.binaryValue());
|
||||
}
|
||||
} else if (token.isValue()) {
|
||||
if ("queryCache".equals(currentFieldName) || "query_cache".equals(currentFieldName)) {
|
||||
if ("requestCache".equals(currentFieldName) || "request_cache".equals(currentFieldName)) {
|
||||
queryCache = parser.booleanValue();
|
||||
}
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ public class IndexWarmersMetaData extends AbstractDiffable<IndexMetaData.Custom>
|
|||
builder.startObject(entry.name(), XContentBuilder.FieldCaseConversion.NONE);
|
||||
builder.field("types", entry.types());
|
||||
if (entry.requestCache() != null) {
|
||||
builder.field("queryCache", entry.requestCache());
|
||||
builder.field("requestCache", entry.requestCache());
|
||||
}
|
||||
builder.field("source");
|
||||
if (binary) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{"index":["test0", "test1"], "query_cache": true}
|
||||
{"index":["test0", "test1"], "request_cache": true}
|
||||
{"query" : {"match_all" {}}}
|
||||
{"index" : "test2,test3", "type" : "type1", "preference": "_local"}
|
||||
{"query" : {"match_all" {}}}
|
||||
|
|
|
@ -259,10 +259,10 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
// test explicit request parameter
|
||||
|
||||
assertThat(client().prepareSearch("idx").setSearchType(SearchType.QUERY_THEN_FETCH).setSize(0).setQueryCache(false).get().getHits().getTotalHits(), equalTo((long) numDocs));
|
||||
assertThat(client().prepareSearch("idx").setSearchType(SearchType.QUERY_THEN_FETCH).setSize(0).setRequestCache(false).get().getHits().getTotalHits(), equalTo((long) numDocs));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), equalTo(0l));
|
||||
|
||||
assertThat(client().prepareSearch("idx").setSearchType(SearchType.QUERY_THEN_FETCH).setSize(0).setQueryCache(true).get().getHits().getTotalHits(), equalTo((long) numDocs));
|
||||
assertThat(client().prepareSearch("idx").setSearchType(SearchType.QUERY_THEN_FETCH).setSize(0).setRequestCache(true).get().getHits().getTotalHits(), equalTo((long) numDocs));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), greaterThan(0l));
|
||||
|
||||
// set the index level setting to false, and see that the reverse works
|
||||
|
@ -273,7 +273,7 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(client().prepareSearch("idx").setSearchType(SearchType.QUERY_THEN_FETCH).setSize(0).get().getHits().getTotalHits(), equalTo((long) numDocs));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), equalTo(0l));
|
||||
|
||||
assertThat(client().prepareSearch("idx").setSearchType(SearchType.QUERY_THEN_FETCH).setSize(0).setQueryCache(true).get().getHits().getTotalHits(), equalTo((long) numDocs));
|
||||
assertThat(client().prepareSearch("idx").setSearchType(SearchType.QUERY_THEN_FETCH).setSize(0).setRequestCache(true).get().getHits().getTotalHits(), equalTo((long) numDocs));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), greaterThan(0l));
|
||||
}
|
||||
|
||||
|
|
|
@ -356,7 +356,7 @@ public class SimpleIndicesWarmerTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
logger.info("register warmer with query cache, validate caching happened");
|
||||
assertAcked(client().admin().indices().preparePutWarmer("warmer_1")
|
||||
.setSearchRequest(client().prepareSearch("test").setTypes("a1").setQuery(QueryBuilders.matchAllQuery()).setQueryCache(true))
|
||||
.setSearchRequest(client().prepareSearch("test").setTypes("a1").setQuery(QueryBuilders.matchAllQuery()).setRequestCache(true))
|
||||
.get());
|
||||
|
||||
// index again, to make sure it gets refreshed
|
||||
|
|
|
@ -66,8 +66,8 @@ curl -XPUT localhost:9200/_template/template_1 -d '
|
|||
}'
|
||||
--------------------------------------------------
|
||||
|
||||
On the same level as `types` and `source`, the `query_cache` flag is supported
|
||||
to enable query caching for the warmed search request. If not specified, it will
|
||||
On the same level as `types` and `source`, the `request_cache` flag is supported
|
||||
to enable request caching for the warmed search request. If not specified, it will
|
||||
use the index level configuration of query caching.
|
||||
|
||||
[float]
|
||||
|
@ -140,7 +140,7 @@ where
|
|||
|
||||
Instead of `_warmer` you can also use the plural `_warmers`.
|
||||
|
||||
The `query_cache` parameter can be used to enable query caching for
|
||||
The `request_cache` parameter can be used to enable request caching for
|
||||
the search request. If not specified, it will use the index level configuration
|
||||
of query caching.
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ curl -XPUT localhost:9200/my_index/_settings -d'
|
|||
[float]
|
||||
==== Enabling caching per request
|
||||
|
||||
The `query_cache` query-string parameter can be used to enable or disable
|
||||
The `request_cache` query-string parameter can be used to enable or disable
|
||||
caching on a *per-request* basis. If set, it overrides the index-level setting:
|
||||
|
||||
[source,js]
|
||||
|
|
|
@ -68,7 +68,7 @@ And here is a sample response:
|
|||
Defaults to `query_then_fetch`.
|
||||
See <<search-request-search-type,_Search Type_>> for more.
|
||||
|
||||
`query_cache`::
|
||||
`request_cache`::
|
||||
|
||||
Set to `true` or `false` to enable or disable the caching
|
||||
of search results for requests where `size` is 0, ie
|
||||
|
@ -85,7 +85,7 @@ And here is a sample response:
|
|||
terminate_after.
|
||||
|
||||
|
||||
Out of the above, the `search_type` and the `query_cache` must be passed as
|
||||
Out of the above, the `search_type` and the `request_cache` must be passed as
|
||||
query-string parameters. The rest of the search request should be passed
|
||||
within the body itself. The body content can also be passed as a REST
|
||||
parameter named `source`.
|
||||
|
|
|
@ -38,6 +38,10 @@
|
|||
"options" : ["open","closed","none","all"],
|
||||
"default" : "open",
|
||||
"description" : "Whether to expand wildcard expression to concrete indices that are open, closed or both, in the search request to warm."
|
||||
},
|
||||
"request_cache": {
|
||||
"type" : "boolean",
|
||||
"description" : "Specify whether the request to be wamred shoyd use the request cache, defaults to index level setting"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue