# Elasticsearch v8 Java API client adding index settings

**URL:** <https://discuss.elastic.co/t/elasticsearch-v8-java-api-client-adding-index-settings/310888>\
**Category:** Elasticsearch\
**Tags:** reindex\
**Created:** [July 28, 2022, 2:55pm UTC](https://discuss.elastic.co/t/elasticsearch-v8-java-api-client-adding-index-settings/310888 "2022-07-28T14:55:49Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [July 28, 2022, 3:28pm UTC](https://discuss.elastic.co/t/elasticsearch-v8-java-api-client-adding-index-settings/310888/4 "2022-07-28T15:28:02Z")

</div>

The example below creates the index according to the setting you mentioned.

```auto

    TokenFilterDefinition tokenFilterDefinition = new TokenFilterDefinition.Builder()
        .shingle(ShingleTokenFilter.of(s ->
            s.maxShingleSize("3").minShingleSize("2")
        ))
        .build();

    TokenFilter tokenFilter = new TokenFilter.Builder()
        .definition(tokenFilterDefinition)
        .build();

    CustomAnalyzer customAnalyzer = new CustomAnalyzer.Builder()
        .tokenizer("standard")
        .filter("lowercase", "my_filter")
        .build();

    Analyzer analyzer = new Analyzer.Builder()
        .custom(customAnalyzer)
        .build();

    IndexSettingsAnalysis indexAnalyzers = new IndexSettingsAnalysis.Builder()
        .filter("my_filter", tokenFilter)
        .analyzer(Map.of("my_analyzer", analyzer))
        .build();

    client.indices()
        .create(createIndexBuilder -> createIndexBuilder
            .settings(builder -> builder
                .numberOfReplicas("3")
                .numberOfShards("3")
                .analysis(indexAnalyzers)
            ).index("test_analyzer"));

```

---

_[View the full topic](https://discuss.elastic.co/t/elasticsearch-v8-java-api-client-adding-index-settings/310888)._
