Created
August 5, 2013 15:09
-
-
Save TimSin/6156670 to your computer and use it in GitHub Desktop.
Setting elasticsearch index and mapping settings using the java API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XContentBuilder settings = // ...create settings JSON object | |
XContentBuilder mapping = // ...build mapping JSON object | |
CreateIndexRequestBuilder irb = client.admin().indices().prepareCreate(INDEX_NAME); | |
irb.setSettings(settings); | |
irb.execute().actionGet(); | |
PutMappingResponse response = client.admin().indices() | |
.preparePutMapping(INDEX_NAME).setType(TYPE_NAME) | |
.setSource(mapping).setIndices(INDEX_NAME) | |
.execute().actionGet(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment