def create_schema(storage_index_url):
    # making three tries, in case of communication errors with elasticsearch
    for _ in xrange(3):
        try:
            # delete index if already exist
            response = requests.head(storage_index_url)
            if response.status_code == 200:
                response = requests.delete(storage_index_url)
                response.raise_for_status()

            # create index
            response = requests.post(storage_index_url, data=json.dumps(
                SETTINGS))
            response.raise_for_status()

            # set mappings
            response = requests.put("{0}/blueprint/_mapping".format(
                storage_index_url), json.dumps(BLUEPRINT_SCHEMA))
            response.raise_for_status()
            response = requests.put("{0}/deployment/_mapping".format(
                storage_index_url), json.dumps(DEPLOYMENT_SCHEMA))
            response.raise_for_status()

            response = requests.put("{0}/node/_mapping".format(
                storage_index_url), json.dumps(NODE_SCHEMA))
            response.raise_for_status()

            response = requests.put("{0}/node_instance/_mapping".format(
                storage_index_url), json.dumps(NODE_INSTANCE_SCHEMA))
            response.raise_for_status()

            print 'Done creating elasticsearch storage schema.'
            break
        except __HOLE__:
            pass
dataset/ETHPy150Open cloudify-cosmo/cloudify-manager/tests/testenv/es_schema_creator.py/create_schema