code: def _build_knn_configuration(
      self,
      *,
      es_query: Dict[str, Any],
      vector_field: str,
      vector_value: List[float],
      top_k: Optional[int] = None,
  ):
      def compute_num_candidates(k: int):
          if k < 50:
              return 500
          if 50 <= k < 200:
              return 100
          if 200 <= k < 500:
              return 2000
          # > 500
          return 2500
  
      top_k = top_k or 5
      num_candidates = compute_num_candidates(top_k)
  
      es_query_filter = es_query["query"]
  
      es_query["knn"] = {
          "field": vector_field,
          "query_vector": vector_value,
          "k": top_k,  # TODO: parameterize
          "num_candidates": num_candidates,  # TODO: parameterize
          "filter": es_query_filter,
      }
      es_query.pop("sort", None)
      del es_query["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 8 for calling the EsQueryBuilder obj's underlying member method code with example usage: obj._build_knn_configuration() and returns: int, int, int, int