How to create custom analyzer using Java API in elasticsearch 7?

Hello All,

I want to create this analyzer using JAVA API of elasticsearch. Can any one help me? I tried to add tokenizer and filter at a same time, but could not do this.

"analysis": {
  "analyzer": {
      "case_insensitive_sort": {
         "tokenizer": "keyword",
         "filter": ["lowercase"]
       }
    }
  }

I get the reference to this.
https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-analyze.html

Till 7.2 I can able to create analyzer using .filter() and .tokenizer() method. Can anyone help on that part?

@elasticsearch -- Can any one can help on this?

Hey,

the AnalyzeRequest has a couple of custom buildCustomAnalyzer methods where you can specify token filters and char filters settings. There is an example in the analyze documentation for the high level rest client at https://www.elastic.co/guide/en/elasticsearch/client/java-rest/7.4/java-rest-high-analyze.html using maps.

--Alex

1 Like

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