Package org.elasticsearch.action.percolate

Examples of org.elasticsearch.action.percolate.PercolateRequest


* @author kimchy (shay.banon)
*/
public class PercolateRequestBuilder extends BaseRequestBuilder<PercolateRequest, PercolateResponse> {

    public PercolateRequestBuilder(Client client, String index, String type) {
        super(client, new PercolateRequest(index, type));
    }
View Full Code Here


        controller.registerHandler(GET, "/{index}/{type}/_percolate", this);
        controller.registerHandler(POST, "/{index}/{type}/_percolate", this);
    }

    @Override public void handleRequest(final RestRequest request, final RestChannel channel) {
        PercolateRequest percolateRequest = new PercolateRequest(request.param("index"), request.param("type"));
        percolateRequest.source(request.contentByteArray(), request.contentByteArrayOffset(), request.contentLength(), request.contentUnsafe());

        // we just send a response, no need to fork
        percolateRequest.listenerThreaded(false);
        // we don't spawn, then fork if local
        percolateRequest.operationThreaded(true);

        percolateRequest.preferLocal(request.paramAsBoolean("prefer_local", percolateRequest.preferLocalShard()));
        client.percolate(percolateRequest, new ActionListener<PercolateResponse>() {
            @Override public void onResponse(PercolateResponse response) {
                try {
                    XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
                    builder.startObject();
View Full Code Here

*/
@SuppressWarnings("unused")
public class PercolateRequestBuilder<JsonInput, JsonOutput> extends AbstractRequestBuilderJsonOutput<PercolateRequest, PercolateResponse, JsonInput, JsonOutput> {

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

        String percolateShardAction = PercolateAction.NAME + "[s]";
        interceptTransportActions(percolateShardAction);

        client().prepareIndex("test-get", "type", "1").setSource("field","value").get();

        PercolateRequest percolateRequest = new PercolateRequest().indices(randomIndicesOrAliases()).documentType("type");
        if (randomBoolean()) {
            percolateRequest.getRequest(new GetRequest("test-get", "type", "1"));
        } else {
            percolateRequest.source("\"field\":\"value\"");
        }
        internalCluster().clientNodeClient().percolate(percolateRequest).actionGet();

        clearInterceptedActions();
        assertSameIndices(percolateRequest, percolateShardAction);
View Full Code Here

        List<String> indices = new ArrayList<>();
        int numRequests = iterations(1, 30);
        for (int i = 0; i < numRequests; i++) {
            String[] indicesOrAliases = randomIndicesOrAliases();
            Collections.addAll(indices, indicesOrAliases);
            PercolateRequest percolateRequest = new PercolateRequest().indices(indicesOrAliases).documentType("type");
            if (randomBoolean()) {
                percolateRequest.getRequest(new GetRequest("test-get", "type", "1"));
            } else {
                percolateRequest.source("\"field\":\"value\"");
            }
            multiPercolateRequest.add(percolateRequest);
        }

        internalCluster().clientNodeClient().multiPercolate(multiPercolateRequest).actionGet();
View Full Code Here

        client.percolate(percolateRequest, new RestToXContentListener<PercolateResponse>(restChannel));
    }

    @Override
    public void handleRequest(RestRequest restRequest, RestChannel restChannel, final Client client) {
        PercolateRequest percolateRequest = new PercolateRequest();
        parseDocPercolate(percolateRequest, restRequest, restChannel, client);
    }
View Full Code Here

            super(settings, controller, client);
        }

        @Override
        public void handleRequest(RestRequest restRequest, RestChannel restChannel, final Client client) {
            PercolateRequest percolateRequest = new PercolateRequest();
            percolateRequest.onlyCount(true);
            parseDocPercolate(percolateRequest, restRequest, restChannel, client);
        }
View Full Code Here

            super(settings, controller, client);
        }

        @Override
        public void handleRequest(RestRequest restRequest, RestChannel restChannel, final Client client) {
            PercolateRequest percolateRequest = new PercolateRequest();
            parseExistingDocPercolate(percolateRequest, restRequest, restChannel, client);
        }
View Full Code Here

            super(settings, controller, client);
        }

        @Override
        public void handleRequest(RestRequest restRequest, RestChannel restChannel, final Client client) {
            PercolateRequest percolateRequest = new PercolateRequest();
            percolateRequest.onlyCount(true);
            parseExistingDocPercolate(percolateRequest, restRequest, restChannel, client);
        }
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.percolate.PercolateRequest

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.