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

**URL:** <https://discuss.elastic.co/t/how-to-create-custom-analyzer-using-java-api-in-elasticsearch-7/201502>\
**Category:** Elasticsearch\
**Created:** [September 28, 2019, 6:28pm UTC](https://discuss.elastic.co/t/how-to-create-custom-analyzer-using-java-api-in-elasticsearch-7/201502 "2019-09-28T18:28:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![het](https://avatars.discourse-cdn.com/v4/letter/h/c67d28/32.png) [@het](https://discuss.elastic.co/u/het)\
**Post date:** [September 28, 2019, 6:28pm UTC](https://discuss.elastic.co/t/how-to-create-custom-analyzer-using-java-api-in-elasticsearch-7/201502/1 "2019-09-28T18:28:11Z")

</div>

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](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?

---

<div class="post-metadata">

**Author:** ![het](https://avatars.discourse-cdn.com/v4/letter/h/c67d28/32.png) [@het](https://discuss.elastic.co/u/het)\
**Post date:** [October 12, 2019, 5:51pm UTC](https://discuss.elastic.co/t/how-to-create-custom-analyzer-using-java-api-in-elasticsearch-7/201502/2 "2019-10-12T17:51:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 14, 2019, 11:57am UTC](https://discuss.elastic.co/t/how-to-create-custom-analyzer-using-java-api-in-elasticsearch-7/201502/3 "2019-10-14T11:57:59Z")

</div>

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](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/7.4/java-rest-high-analyze.html) using maps.

--Alex

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 11, 2019, 11:58am UTC](https://discuss.elastic.co/t/how-to-create-custom-analyzer-using-java-api-in-elasticsearch-7/201502/4 "2019-11-11T11:58:01Z")

</div>

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