public PutIndexTemplateRequest mapping(String type,XContentBuilder source){
  try {
    mappings.put(type,source.string());
  }
 catch (  IOException e) {
    throw new IllegalArgumentException("Failed to build json for mapping request",e);
  }
  return this;
}

public PutIndexTemplateRequest mapping ( String type , XContentBuilder source ) { try { mappings . put ( type , source . string ( ) ) ; } catch ( IOException e ) { throw new IllegalArgumentException ( "Failed to build json for mapping request" , e ) ; } return this ; }
adds mapping that will be added when the index gets created .
