code: def map_2_es_query(
      self,
      schema: Union[Dict[str, Any], None],
      query: BackendQuery,
      sort: SortConfig = SortConfig(),
      exclude_fields: Optional[List[str]] = None,
      include_fields: List[str] = None,
      doc_from: Optional[int] = None,
      highlight: Optional[HighlightParser] = None,
      size: Optional[int] = None,
      search_after_param: Optional[Any] = None,
  ) -> Dict[str, Any]:
      if query and query.raw_query:
          es_query = {"query": query.raw_query}
      else:
          es_query: Dict[str, Any] = (
              {"query": self._datasets_to_es_query(query)}
              if isinstance(query, BaseDatasetsQuery)
              else {"query": self._search_to_es_query(schema, query)}
          )
  
      if search_after_param:
          es_query["search_after"] = search_after_param
  
      if sort.shuffle:
          self._setup_random_score(es_query)
      else:
          es_sort = self.map_2_es_sort_configuration(
              schema=schema, sort=sort
          )
          if es_sort:
              es_query["sort"] = es_sort
  
      if doc_from:
          es_query["from"] = doc_from
  
      source = {}
      if exclude_fields:
          source.update({"excludes": exclude_fields})
      if include_fields:
          source.update({"includes": include_fields})
      if source:
          es_query["_source"] = source
  
      if highlight and (
          not include_fields
          # Enable highlight when requesting ALL fields
          # or specific request the search_keywords one
          or "*" in include_fields
          or highlight.search_keywords_field in include_fields
      ):
          es_query["highlight"] = highlight.build_query_highlight()
  
      if hasattr(query, "vector") and query.vector is not None:
          self._build_knn_configuration(
              es_query=es_query,
              vector_field=self.get_vector_field_name(
                  query.vector.name
              ),
              vector_value=query.vector.value,
              top_k=query.vector.k or size,
          )
  
      return es_query
  
imports: import logging
  import re
  from enum import Enum
  from typing import Any, Dict, List, Optional, Union
  from argilla.server.daos.backend.query_helpers import filters
  from argilla.server.daos.backend.search.model import BackendDatasetsQuery, BackendQuery, BackendRecordsQuery, BaseDatasetsQuery, QueryRange, SortableField, SortConfig
label_desc: Use image node_id 4 for calling the EsQueryBuilder obj's underlying member method code with example usage: obj.map_2_es_query(schema, query, sort, exclude_fields, include_fields, doc_from, highlight, size, search_after_param) and returns: es_query