code: def _CreateIndexIfNotExists(self, index_name, mappings):
      
      try:
        if not self._client.indices.exists(index_name):
          self._client.indices.create(
              body={'mappings': mappings}, index=index_name)
  
      except elasticsearch.exceptions.ConnectionError as exception:
        raise RuntimeError(
            'Unable to create Elasticsearch index with error: {0!s}'.format(
                exception))
docs: Creates an Elasticsearch index if it does not exist.
  
      Args:
        index_name (str): mame of the index.
        mappings (dict[str, object]): mappings of the index.
  
      Raises:
        RuntimeError: if the Elasticsearch index cannot be created.