class_docstr: Group of functions related to elasticsearch filters
class_docstr_tok: ["Group","of","functions","related","to","elasticsearch","filters"]
code: def term_filter(
      field: str, value: Union[str, Enum]
  ) -> Optional[Dict[str, Any]]:
      if value is None:
          return None
      return {
          "term": {
              field: value.value if isinstance(value, Enum) else value
          }
      }
  
imports: from enum import Enum
  from typing import Any, Dict, List, Optional, Type, Union
  from argilla.server.commons.models import TaskStatus
  from argilla.server.daos.backend.mappings.helpers import mappings
  from argilla.server.pydantic_v1 import BaseModel
label_desc: Use image node_id 8 for calling the filters obj's underlying member method code with example usage: obj.term_filter(field, value) and returns: dict, None