Skip to content

Instantly share code, notes, and snippets.

@suresk
Created April 10, 2016 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suresk/38012ca8845019a9a8ef09e2659627d8 to your computer and use it in GitHub Desktop.
Save suresk/38012ca8845019a9a8ef09e2659627d8 to your computer and use it in GitHub Desktop.
Elasticsearch put mapping
String mapping = getMapFile(aliasName);
if(mapping != null)
{
elasticClient.admin().indices().putMapping(new PutMappingRequest(indexName).source(getMapFile(aliasName)));
}
...
private String getMapFile(String aliasName)
{
InputStream is = AliasingRebuildService.class.getResourceAsStream(String.format("/mappings/%s.json", aliasName));
try
{
if(is == null)
{
return null;
}
return IOUtils.toString(is);
}
catch(Exception e)
{
throw new RuntimeException(e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment