Search in sources :

Example 1 with AnalyzeResponse

use of org.elasticsearch.client.indices.AnalyzeResponse in project graylog2-server by Graylog2.

the class MessagesAdapterES7 method analyze.

@Override
public List<String> analyze(String toAnalyze, String index, String analyzer) {
    final AnalyzeRequest analyzeRequest = AnalyzeRequest.withIndexAnalyzer(index, analyzer, toAnalyze);
    final AnalyzeResponse result = client.execute((c, requestOptions) -> c.indices().analyze(analyzeRequest, requestOptions));
    return result.getTokens().stream().map(AnalyzeResponse.AnalyzeToken::getTerm).collect(Collectors.toList());
}
Also used : AnalyzeRequest(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.indices.AnalyzeRequest) AnalyzeResponse(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.indices.AnalyzeResponse)

Aggregations

AnalyzeRequest (org.graylog.shaded.elasticsearch7.org.elasticsearch.client.indices.AnalyzeRequest)1 AnalyzeResponse (org.graylog.shaded.elasticsearch7.org.elasticsearch.client.indices.AnalyzeResponse)1