def mapping_create(index, doc_type, body, hosts=None, profile=None):
 es = _get_instance(hosts, profile)
 try:
  result = es.indices.put_mapping(index=index, doc_type=doc_type, body=body)
  return mapping_get(index, doc_type)
 except elasticsearch.exceptions.NotFoundError:
  return None
 return None

def mapping_create ( index , doc_type , body , hosts = None , profile = None ) : es = _get_instance ( hosts , profile ) try : result = es . indices . put_mapping ( index = index , doc_type = doc_type , body = body ) return mapping_get ( index , doc_type ) except elasticsearch . exceptions . NotFoundError : return None return None
create a mapping in a given index cli example:: salt myminion elasticsearch .