class_docstr: Encapsulates logic about the communication, queries and index mapping
  transformations between DAOs layer and the elasticsearch backend.
docstr: Creates an instance of ElasticsearchBackend.
  
  This function is used in fastapi for resolve component dependencies.
  
  See <https://fastapi.tiangolo.com/tutorial/dependencies/>
  
  Returns
  -------
docstr_tok: ["Creates","an","instance","of","ElasticsearchBackend",".","This","function","is","used","in","fastapi","for","resolve","component","dependencies",".","See","<","https",":","\/\/fastapi.tiangolo.com\/tutorial\/dependencies\/",">","Returns","--","--","--","-"]
code: def get_instance(cls) -> "GenericElasticEngineBackend":
      """
      Creates an instance of ElasticsearchBackend.
  
      This function is used in fastapi for resolve component dependencies.
  
      See <https://fastapi.tiangolo.com/tutorial/dependencies/>
  
      Returns
      -------
  
      """
  
      if not cls._INSTANCE:
          instance = cls(
              client=ClientAdapterFactory.get(
                  hosts=settings.elasticsearch,
                  index_shards=settings.es_records_index_shards,
                  ssl_verify=settings.elasticsearch_ssl_verify,
                  ca_path=settings.elasticsearch_ca_path,
              ),
              metrics={**ALL_METRICS},
              mappings={
                  TaskType.text_classification: text_classification_mappings(),
                  TaskType.token_classification: token_classification_mappings(),
                  TaskType.text2text: text2text_mappings(),
              },
          )
          cls._INSTANCE = instance
  
      return cls._INSTANCE
  
imports: from typing import Any, Dict, Iterable, List, Optional, Tuple
  from argilla.logging import LoggingMixin
  from argilla.server.commons.models import TaskType
  from argilla.server.constants import PROTECTED_METADATA_FIELD_PREFIX
  from argilla.server.daos.backend.base import IndexNotFoundError, InvalidSearchError
  from argilla.server.daos.backend.client_adapters.base import IClientAdapter
  from argilla.server.daos.backend.client_adapters.factory import ClientAdapterFactory
  from argilla.server.daos.backend.mappings.datasets import DATASETS_INDEX_NAME, datasets_index_mappings
  from argilla.server.daos.backend.mappings.helpers import mappings, tasks_common_mappings, tasks_common_settings
  from argilla.server.daos.backend.mappings.text2text import text2text_mappings
  from argilla.server.daos.backend.mappings.text_classification import text_classification_mappings
  from argilla.server.daos.backend.mappings.token_classification import token_classification_mappings
  from argilla.server.daos.backend.metrics import ALL_METRICS
  from argilla.server.daos.backend.metrics.base import ElasticsearchMetric
  from argilla.server.daos.backend.search.model import BackendRecordsQuery, BaseDatasetsQuery, BaseQuery, BaseRecordsQuery, SortableField, SortConfig
  from argilla.server.errors import BadRequestError, EntityNotFoundError
  from argilla.server.errors.task_errors import MetadataLimitExceededError
  from argilla.server.pydantic_v1 import BaseModel, Field
  from argilla.server.settings import settings
label_desc: Use image node_id 1 for calling the GenericElasticEngineBackend obj's underlying member method code with example usage: obj.get_instance(cls) and returns: cls