High Level Rest Client - Setting custom tokenizer

I am trying to set a custom Tokenizer to my index using the Java High Level Rest Client.

I have been looking through the API documentation, but can't find anything aside from the normal REST calls as mentioned in the guide:

https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-custom-analyzer.html

There are guides to updating index settings here:

https://www.elastic.co/guide/en/elasticsearch/client/java-rest/master/java-rest-high-indices-put-settings.html

But I can't find any examples on tokenizers. Maybe I have missed a documentation somewhere?

There is not a specific way to generate that. But you can provide a JSON which contains all the index settings, including analyzers like:

Then use the Low Level Client like this:

Or use the High Level client like this:

HTH

Ah, okay. So there's no way to do it directly through the Java API. Will do it the JSON way like you suggested.

Cheers!

There is a way but not with a nice API. as you saw in docs, you can use something like:

Settings settings =
        Settings.builder()
        .put("analysis.analyzer.custom_uax_url_email.type", "custom")
        .put("analysis.analyzer.custom_uax_url_email.tokenizer", "uax_url_email")
        // And so on...
        .build();

I see. I will give that a try to.

Thank you!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.