code: def _datasets_to_es_query(
      self, query: Optional[BackendDatasetsQuery] = None
  ) -> Dict[str, Any]:
      if not query:
          return filters.match_all()
  
      query_filters = []
      if query.workspaces:
          query_filters.append(
              filters.boolean_filter(
                  should_filters=[
                      filters.terms_filter(
                          "owner.keyword", query.workspaces
                      ),  # backward comp.
                      filters.terms_filter(
                          "workspace.keyword", query.workspaces
                      ),
                  ]
              )
          )
  
      if query.tasks:
          query_filters.append(
              filters.terms_filter(
                  field="task.keyword",
                  values=query.tasks,
              )
          )
      if query.name:
          query_filters.append(
              filters.term_filter(
                  field="name.keyword",
                  value=query.name,
              )
          )
      if not query_filters:
          return filters.match_all()
  
      return filters.boolean_filter(
          should_filters=query_filters,
          minimum_should_match=len(query_filters),
      )
  
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 2 for calling the EsQueryBuilder obj's underlying member method code with example usage: obj._datasets_to_es_query(query) and returns: filters, filters, filters