use of org.elasticsearch.client.indices.AnalyzeRequest in project LinkAgent by shulieTech.
the class AnalyzeRequestIndexRename0 method reindex0.
@Override
public List<String> reindex0(Object target) {
AnalyzeRequest req = (AnalyzeRequest) target;
String index = req.index();
/**
* 如果在白名单中则不允许写
*/
if (GlobalConfig.getInstance().getSearchWhiteList().contains(index)) {
return Arrays.asList(index);
}
if (!Pradar.isClusterTestPrefix(index)) {
index = Pradar.addClusterTestPrefixLower(index);
}
try {
Reflect.on(req).set("index", index);
} catch (ReflectException e) {
throw new PressureMeasureError("can't found field index from " + AnalyzeRequest.class.getName());
}
return Arrays.asList(index);
}
use of org.elasticsearch.client.indices.AnalyzeRequest in project spring-data-elasticsearch by spring-projects.
the class RequestConverters method analyze.
public static Request analyze(AnalyzeRequest request) {
EndpointBuilder builder = new EndpointBuilder();
String index = request.index();
if (index != null) {
builder.addPathPart(index);
}
builder.addPathPartAsIs("_analyze");
Request req = new Request(HttpMethod.GET.name(), builder.build());
req.setEntity(createEntity(request, REQUEST_BODY_CONTENT_TYPE));
return req;
}
use of org.elasticsearch.client.indices.AnalyzeRequest in project kms by mahonelau.
the class EsUtils method getIkAnalyzeSearchTerms.
public List<String> getIkAnalyzeSearchTerms(String searchContent) {
AnalyzeRequest analyzeRequest = AnalyzeRequest.withIndexAnalyzer(KMConstant.DocIndexAliasName, "ik_smart", searchContent);
List<String> result = new ArrayList<>();
try {
if (!searchContent.isEmpty()) {
AnalyzeResponse analyzeResponse = restHighLevelClient.indices().analyze(analyzeRequest, RequestOptions.DEFAULT);
analyzeResponse.getTokens().forEach((e) -> result.add(e.getTerm()));
}
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
use of org.elasticsearch.client.indices.AnalyzeRequest in project dsearch-server by danawalab.
the class RankingTuningService method getMultipleAnalyze.
public AnalyzeResponse getMultipleAnalyze(UUID clusterId, String index, String analyzer, String hitValue) throws IOException {
try (RestHighLevelClient client = elasticsearchFactory.getClient(clusterId)) {
AnalyzeRequest analyzeRequest = AnalyzeRequest.withIndexAnalyzer(index, analyzer, hitValue);
AnalyzeResponse analyzeResponse = client.indices().analyze(analyzeRequest, RequestOptions.DEFAULT);
return analyzeResponse;
}
}
use of org.elasticsearch.client.indices.AnalyzeRequest in project dsearch-server by danawalab.
the class RankingTuningService method getAnalyze.
public AnalyzeResponse getAnalyze(UUID clusterId, RankingTuningRequest rankingTuningRequest, String analyzer, String hitValue) throws IOException {
try (RestHighLevelClient client = elasticsearchFactory.getClient(clusterId)) {
AnalyzeRequest analyzeRequest = AnalyzeRequest.withIndexAnalyzer(rankingTuningRequest.getIndex(), analyzer, hitValue);
AnalyzeResponse analyzeResponse = client.indices().analyze(analyzeRequest, RequestOptions.DEFAULT);
return analyzeResponse;
}
}
Aggregations