Package org.elasticsearch.action.admin.indices.cache.clear

Examples of org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest


     *
     * @param indices The indices to clean their caches. Use <tt>null</tt> or <tt>_all</tt> to execute against all indices
     * @return The request
     */
    public static ClearIndicesCacheRequest clearIndicesCacheRequest(String... indices) {
        return new ClearIndicesCacheRequest(indices);
    }
View Full Code Here


* @author kimchy (shay.banon)
*/
public class ClearIndicesCacheRequestBuilder extends BaseIndicesRequestBuilder<ClearIndicesCacheRequest, ClearIndicesCacheResponse> {

    public ClearIndicesCacheRequestBuilder(IndicesAdminClient indicesClient) {
        super(indicesClient, new ClearIndicesCacheRequest());
    }
View Full Code Here

        controller.registerHandler(GET, "/_cache/clear", this);
        controller.registerHandler(GET, "/{index}/_cache/clear", this);
    }

    @Override public void handleRequest(final RestRequest request, final RestChannel channel) {
        ClearIndicesCacheRequest clearIndicesCacheRequest = new ClearIndicesCacheRequest(RestActions.splitIndices(request.param("index")));
        try {
            clearIndicesCacheRequest.filterCache(request.paramAsBoolean("filter", clearIndicesCacheRequest.filterCache()));
            clearIndicesCacheRequest.fieldDataCache(request.paramAsBoolean("field_data", clearIndicesCacheRequest.fieldDataCache()));
            clearIndicesCacheRequest.idCache(request.paramAsBoolean("id", clearIndicesCacheRequest.idCache()));
            clearIndicesCacheRequest.bloomCache(request.paramAsBoolean("bloom", clearIndicesCacheRequest.bloomCache()));

            // we just send back a response, no need to fork a listener
            clearIndicesCacheRequest.listenerThreaded(false);
            BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operationThreading"), BroadcastOperationThreading.SINGLE_THREAD);
            if (operationThreading == BroadcastOperationThreading.NO_THREADS) {
                // since we don't spawn, don't allow no_threads, but change it to a single thread
                operationThreading = BroadcastOperationThreading.THREAD_PER_SHARD;
            }
            clearIndicesCacheRequest.operationThreading(operationThreading);
        } catch (Exception e) {
            try {
                XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
                channel.sendResponse(new XContentRestResponse(request, BAD_REQUEST, builder.startObject().field("error", e.getMessage()).endObject()));
            } catch (IOException e1) {
View Full Code Here

*/
@SuppressWarnings("unused")
public class ClearCacheRequestBuilder<JsonInput, JsonOutput> extends AbstractRequestBuilderJsonOutput<ClearIndicesCacheRequest, ClearIndicesCacheResponse, JsonInput, JsonOutput> {

    public ClearCacheRequestBuilder(Client client, JsonToString<JsonInput> jsonToString, StringToJson<JsonOutput> stringToJson) {
        super(client, new ClearIndicesCacheRequest(), jsonToString, stringToJson);
    }
View Full Code Here

                 .endObject().endObject().endObject().string();
         Settings settings = ImmutableSettings.settingsBuilder().loadFromSource(settingsSource).build();
         client.admin().indices().updateSettings(new UpdateSettingsRequest(settings,"test"))
                 .actionGet();

         client.admin().indices().clearCache(new ClearIndicesCacheRequest()).actionGet();

      SearchResponse searchResponse = client
          .prepareSearch()
          .setSearchType(SearchType.COUNT)
          .setFacets(
View Full Code Here

                .preparePutMapping(__index)
                .setType(__type1)
                .setSource(mapping)
                .execute().actionGet();
        client().admin().indices().clearCache(
                new ClearIndicesCacheRequest("_all"));
        System.gc();
        assertEquals(0L, countAll());
    }
View Full Code Here

     *
     * @param indices The indices to clean their caches. Use <tt>null</tt> or <tt>_all</tt> to execute against all indices
     * @return The request
     */
    public static ClearIndicesCacheRequest clearIndicesCacheRequest(String... indices) {
        return new ClearIndicesCacheRequest(indices);
    }
View Full Code Here

    @Test
    public void testClearCache() {
        String clearCacheAction = ClearIndicesCacheAction.NAME + "[s]";
        interceptTransportActions(clearCacheAction);

        ClearIndicesCacheRequest clearIndicesCacheRequest = new ClearIndicesCacheRequest(randomIndicesOrAliases());
        internalCluster().clientNodeClient().admin().indices().clearCache(clearIndicesCacheRequest).actionGet();

        clearInterceptedActions();
        assertSameIndices(clearIndicesCacheRequest, clearCacheAction);
    }
View Full Code Here

    /**
     * Builds a clear cache request from the settings
     */
    public void buildClearCachesRequestFromSettings() {
        clearCaches = new ClearIndicesCacheRequest(indices);
        clearCaches.filterCache(clearCachesSettings.filterCache);
        clearCaches.fieldDataCache(clearCachesSettings.fieldDataCache);
        clearCaches.idCache(clearCachesSettings.idCache);
        clearCaches.recycler(clearCachesSettings.recyclerCache);
        clearCaches.fields(clearCachesSettings.fields);
View Full Code Here

        numSlowest = in.readVInt();
        warmup = in.readBoolean();
        indices = in.readStringArray();
        types = in.readStringArray();
        searchType = SearchType.fromId(in.readByte());
        clearCaches = in.readOptionalStreamable(new ClearIndicesCacheRequest());
        final int size = in.readVInt();
        for (int i = 0; i < size; i++) {
            SearchRequest searchRequest = new SearchRequest();
            searchRequest.readFrom(in);
            searchRequests.add(searchRequest);
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.