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

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

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

1 Like

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