Package org.elasticsearch.action.admin.indices.validate.query

Examples of org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest


*/
@SuppressWarnings("unused")
public class ValidateQueryRequestBuilder<JsonInput, JsonOutput> extends AbstractRequestBuilderJsonOutput<ValidateQueryRequest, ValidateQueryResponse, JsonInput, JsonOutput> {

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


    @Test
    public void testValidateQuery() {
        String validateQueryShardAction = ValidateQueryAction.NAME + "[s]";
        interceptTransportActions(validateQueryShardAction);

        ValidateQueryRequest validateQueryRequest = new ValidateQueryRequest(randomIndicesOrAliases());
        internalCluster().clientNodeClient().admin().indices().validateQuery(validateQueryRequest).actionGet();

        clearInterceptedActions();
        assertSameIndices(validateQueryRequest, validateQueryShardAction);
    }
View Full Code Here

        controller.registerHandler(POST, "/{index}/{type}/_validate/query", this);
    }

    @Override
    public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
        ValidateQueryRequest validateQueryRequest = new ValidateQueryRequest(Strings.splitStringByCommaToArray(request.param("index")));
        validateQueryRequest.listenerThreaded(false);
        validateQueryRequest.indicesOptions(IndicesOptions.fromRequest(request, validateQueryRequest.indicesOptions()));
        if (request.hasContent()) {
            validateQueryRequest.source(request.content(), request.contentUnsafe());
        } else {
            String source = request.param("source");
            if (source != null) {
                validateQueryRequest.source(source);
            } else {
                QuerySourceBuilder querySourceBuilder = RestActions.parseQuerySource(request);
                if (querySourceBuilder != null) {
                    validateQueryRequest.source(querySourceBuilder);
                }
            }
        }
        validateQueryRequest.types(Strings.splitStringByCommaToArray(request.param("type")));
        if (request.paramAsBoolean("explain", false)) {
            validateQueryRequest.explain(true);
        } else {
            validateQueryRequest.explain(false);
        }

        client.admin().indices().validateQuery(validateQueryRequest, new RestBuilderListener<ValidateQueryResponse>(channel) {
            @Override
            public RestResponse buildResponse(ValidateQueryResponse response, XContentBuilder builder) throws Exception {
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest

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.