class_docstr: Datasets records DAO
class_docstr_tok: ["Datasets","records","DAO"]
code: def search_records(
      self,
      dataset: DatasetDB,
      search: Optional[DaoRecordsSearch] = None,
      size: int = 100,
      record_from: int = 0,
      exclude_fields: List[str] = None,
      highligth_results: bool = True,
  ) -> DaoRecordsSearchResults:
      try:
          search = search or DaoRecordsSearch()
  
          total, records = self._es.search_records(
              id=dataset.id,
              query=search.query,
              sort=search.sort,
              record_from=record_from,
              size=size,
              exclude_fields=exclude_fields,
              enable_highlight=highligth_results,
          )
          if isinstance(total, dict):
              total = total["value"]
          return DaoRecordsSearchResults(
              total=total,
              records=records,
          )
      except ClosedIndexError:
          raise ClosedDatasetError(dataset.name)
      except IndexNotFoundError:
          raise MissingDatasetRecordsError(
              f"No records index found for dataset {dataset.name}"
          )
  
file_path: argilla/src/argilla/server/daos/records.py
imports: import datetime
  from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Type
  from fastapi import Depends
  from argilla.server.daos.backend import GenericElasticEngineBackend
  from argilla.server.daos.backend.base import ClosedIndexError, IndexNotFoundError
  from argilla.server.daos.backend.generic_elastic import PaginatedSortInfo
  from argilla.server.daos.backend.search.model import BaseRecordsQuery, SortableField
  from argilla.server.daos.models.datasets import DatasetDB
  from argilla.server.daos.models.records import DaoRecordsSearch, DaoRecordsSearchResults, RecordDB
  from argilla.server.errors import ClosedDatasetError, MissingDatasetRecordsError
label_desc: Use image node_id 6 for calling the DatasetRecordsDAO obj's underlying member method code with example usage: obj.search_records(dataset, search, size, record_from, exclude_fields, highligth_results) and returns: DaoRecordsSearchResults