# RestHighLevelClient. How to create settings and mappings programmaticaly from json File?

**URL:** <https://discuss.elastic.co/t/resthighlevelclient-how-to-create-settings-and-mappings-programmaticaly-from-json-file/102372>\
**Category:** Elasticsearch\
**Created:** [October 1, 2017, 12:04pm UTC](https://discuss.elastic.co/t/resthighlevelclient-how-to-create-settings-and-mappings-programmaticaly-from-json-file/102372 "2017-10-01T12:04:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tanjok](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tanjok/32/22686_2.png) [@tanjok](https://discuss.elastic.co/u/tanjok)\
**Post date:** [October 1, 2017, 12:04pm UTC](https://discuss.elastic.co/t/resthighlevelclient-how-to-create-settings-and-mappings-programmaticaly-from-json-file/102372/1 "2017-10-01T12:04:07Z")

</div>

Hi, is it possible to do something like this with RestHighLevelClient?

```
public void createMapping() {
        Client client = transportClientFactory.getTransportClient();
        CreateIndexRequestBuilder createIndexRequestBuilder = client.admin().indices().prepareCreate(newIndexName);
        createIndexRequestBuilder.setSource(getIndexSettingsMappings());
        CreateIndexResponse createIndexResponse = createIndexRequestBuilder.execute().actionGet();
        if (!createIndexResponse.isAcknowledged()) {
            logger.error("Settings and mapping wasn't created for " + newIndexName);
        }
    }

```

Thank you in advance

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 1, 2017, 12:46pm UTC](https://discuss.elastic.co/t/resthighlevelclient-how-to-create-settings-and-mappings-programmaticaly-from-json-file/102372/2 "2017-10-01T12:46:43Z")

</div>

No. You need to use the Low Level one (which you can get from the HL Client). For example:

> <https://github.com/dadoonet/fscrawler/blob/master/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/ElasticsearchClient.java#L82-L105>

---

<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:** [October 29, 2017, 12:46pm UTC](https://discuss.elastic.co/t/resthighlevelclient-how-to-create-settings-and-mappings-programmaticaly-from-json-file/102372/3 "2017-10-29T12:46:47Z")

</div>

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