Examples of AnalyzeRequest


Examples of org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest

* @author kimchy (shay.banon)
*/
public class AnalyzeRequestBuilder extends BaseIndicesRequestBuilder<AnalyzeRequest, AnalyzeResponse> {

    public AnalyzeRequestBuilder(IndicesAdminClient indicesClient, String index, String text) {
        super(indicesClient, new AnalyzeRequest(index, text));
    }
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest

                logger.warn("Failed to send response", e1);
            }
            return;
        }

        AnalyzeRequest analyzeRequest = new AnalyzeRequest(request.param("index"), text);
        analyzeRequest.preferLocal(request.paramAsBoolean("prefer_local", analyzeRequest.preferLocalShard()));
        analyzeRequest.analyzer(request.param("analyzer"));
        analyzeRequest.field(request.param("field"));
        client.admin().indices().analyze(analyzeRequest, new ActionListener<AnalyzeResponse>() {
            @Override public void onResponse(AnalyzeResponse response) {
                try {
                    XContentBuilder builder = restContentBuilder(request);
                    builder.startObject();
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest

    public static final String ANALYZER = "configured_analyzer";

    protected void assertAnalyzesTo(String analyzer, String input, String[] output, int startOffsets[], int endOffsets[], String types[], int posIncrements[]) {
        assertThat(output, notNullValue());
        AnalyzeResponse response = client().admin().indices().analyze(new AnalyzeRequest(INDEX, input).analyzer(analyzer)).actionGet();
        if (VERBOSE) {
            try {
                Map<String,String> params = new HashMap<String,String>();
                params.put("format", "text");
                logger.info("Tokens for \""+input+"\": " + response.toXContent(jsonBuilder().startObject(), new ToXContent.MapParams(params)).endObject().string());
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest

*/
@SuppressWarnings("unused")
public class AnalyzeRequestBuilder<JsonInput, JsonOutput> extends AbstractRequestBuilderToXContent<AnalyzeRequest, AnalyzeResponse, JsonInput, JsonOutput> {

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

Examples of org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest

        super(client, new AnalyzeRequest(null), jsonToString, stringToJson);
    }

    public AnalyzeRequestBuilder<JsonInput, JsonOutput> text(String text) {
        //we need to create a new request since there's no setter for index
        AnalyzeRequest newRequest = new AnalyzeRequest(text);
        newRequest.index(request.index())
                .analyzer(request.analyzer())
                .field(request.field())
                .tokenizer(request.tokenizer())
                .tokenFilters(request.tokenFilters());
        this.request = newRequest;
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest

    @Test
    public void testAnalyze() {
        String analyzeShardAction = AnalyzeAction.NAME + "[s]";
        interceptTransportActions(analyzeShardAction);

        AnalyzeRequest analyzeRequest = new AnalyzeRequest(randomIndexOrAlias(), "text");
        internalCluster().clientNodeClient().admin().indices().analyze(analyzeRequest).actionGet();

        clearInterceptedActions();
        assertSameIndices(analyzeRequest, analyzeShardAction);
    }
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest

        }
        if (text == null) {
            throw new ElasticsearchIllegalArgumentException("text is missing");
        }

        AnalyzeRequest analyzeRequest = new AnalyzeRequest(request.param("index"), text);
        analyzeRequest.listenerThreaded(false);
        analyzeRequest.preferLocal(request.paramAsBoolean("prefer_local", analyzeRequest.preferLocalShard()));
        analyzeRequest.analyzer(request.param("analyzer"));
        analyzeRequest.field(request.param("field"));
        analyzeRequest.tokenizer(request.param("tokenizer"));
        analyzeRequest.tokenFilters(request.paramAsStringArray("token_filters", request.paramAsStringArray("filters", analyzeRequest.tokenFilters())));
        analyzeRequest.charFilters(request.paramAsStringArray("char_filters", analyzeRequest.charFilters()));
        client.admin().indices().analyze(analyzeRequest, new RestToXContentListener<AnalyzeResponse>(channel));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.