Elasticsearch Java API addMapping() and setSettings() usage
Solution:I managed to do it with my original json file using createIndexRequestBuilder.setSource(settings_json);
I think the problem is with structure of your mapping file.
Here is a sample example.
mapping.json{"en_brochures": { "properties": { "text": { "type": "string", "store": true, "index_analyzer": "en_analyzer", "term_vector": "yes" }, "classification": { "type": "string", "index": "not_analyzed" }, "language": { "type": "string", "index": "not_analyzed" } } }}String mapping = new String(Files.readAllBytes(Paths.get("mapping.json"))); createIndexRequestBuilder.addMapping('en_brochures', mapping); CreateIndexResponse indexResponse =createIndexRequestBuilder.execute().actionGet();
This works in mine, you can try.