本文整理了Java中org.elasticsearch.client.IndicesAdminClient.analyze()
方法的一些代码示例,展示了IndicesAdminClient.analyze()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IndicesAdminClient.analyze()
方法的具体详情如下:
包路径:org.elasticsearch.client.IndicesAdminClient
类名称:IndicesAdminClient
方法名:analyze
[英]Analyze text under the provided index.
[中]在提供的索引下分析文本。
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
AnalyzeRequest analyzeRequest = new AnalyzeRequest(request.param("index"));
try (XContentParser parser = request.contentOrSourceParamParser()) {
buildFromContent(parser, analyzeRequest);
} catch (IOException e) {
throw new IllegalArgumentException("Failed to parse request body", e);
}
return channel -> client.admin().indices().analyze(analyzeRequest, new RestToXContentListener<>(channel));
}
代码示例来源:origin: javanna/elasticshell
@Override
protected ActionFuture<AnalyzeResponse> doExecute(AnalyzeRequest request) {
return client.admin().indices().analyze(request);
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
AnalyzeRequest analyzeRequest = new AnalyzeRequest(request.param("index"));
try (XContentParser parser = request.contentOrSourceParamParser()) {
buildFromContent(parser, analyzeRequest);
} catch (IOException e) {
throw new IllegalArgumentException("Failed to parse request body", e);
}
return channel -> client.admin().indices().analyze(analyzeRequest, new RestToXContentListener<>(channel));
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
AnalyzeRequest analyzeRequest = new AnalyzeRequest(request.param("index"));
try (XContentParser parser = request.contentOrSourceParamParser()) {
buildFromContent(parser, analyzeRequest);
} catch (IOException e) {
throw new IllegalArgumentException("Failed to parse request body", e);
}
return channel -> client.admin().indices().analyze(analyzeRequest, new RestToXContentListener<>(channel));
}
代码示例来源:origin: NLPchina/elasticsearch-analysis-ansj
analyzeRequest.text("null");
analyzeRequest.analyzer("index_ansj");
return channel -> client.admin().indices().analyze(analyzeRequest, new RestResponseListener<AnalyzeResponse>(channel) {
@Override
public RestResponse buildResponse(final AnalyzeResponse analyzeResponse) throws Exception {
return channel -> client.admin().indices().analyze(analyzeRequest, new RestResponseListener<AnalyzeResponse>(channel) {
@Override
public RestResponse buildResponse(final AnalyzeResponse analyzeResponse) throws Exception {
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
return channel -> client.admin().indices().analyze(analyzeRequest, new RestToXContentListener<>(channel));
代码示例来源:origin: harbby/presto-connectors
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
String[] texts = request.paramAsStringArrayOrEmptyIfAll("text");
AnalyzeRequest analyzeRequest = new AnalyzeRequest(request.param("index"));
analyzeRequest.text(texts);
analyzeRequest.analyzer(request.param("analyzer"));
analyzeRequest.field(request.param("field"));
analyzeRequest.tokenizer(request.param("tokenizer"));
analyzeRequest.tokenFilters(request.paramAsStringArray("filter", request.paramAsStringArray("token_filter",
request.paramAsStringArray("token_filters", request.paramAsStringArray("filters", analyzeRequest.tokenFilters())))));
analyzeRequest.charFilters(request.paramAsStringArray("char_filter", request.paramAsStringArray("char_filters", analyzeRequest.charFilters())));
analyzeRequest.explain(request.paramAsBoolean("explain", false));
analyzeRequest.attributes(request.paramAsStringArray("attributes", analyzeRequest.attributes()));
if (RestActions.hasBodyContent(request)) {
XContentType type = RestActions.guessBodyContentType(request);
if (type == null) {
if (texts == null || texts.length == 0) {
texts = new String[]{ RestActions.getRestContent(request).toUtf8() };
analyzeRequest.text(texts);
}
} else {
// NOTE: if rest request with xcontent body has request parameters, the parameters does not override xcontent values
buildFromContent(RestActions.getRestContent(request), analyzeRequest, parseFieldMatcher);
}
}
client.admin().indices().analyze(analyzeRequest, new RestToXContentListener<AnalyzeResponse>(channel));
}
内容来源于网络,如有侵权,请联系作者删除!