code: def gen_search_param(index_type, metric_type="L2"):
      search_params = []
      if index_type in ["FLAT", "IVF_FLAT", "IVF_SQ8", "IVF_PQ"]:
          for nprobe in [10]:
              ivf_search_params = {
                  "metric_type": metric_type,
                  "params": {"nprobe": nprobe},
              }
              search_params.append(ivf_search_params)
      elif index_type in ["BIN_FLAT", "BIN_IVF_FLAT"]:
          for nprobe in [10]:
              bin_search_params = {
                  "metric_type": "HAMMING",
                  "params": {"nprobe": nprobe},
              }
              search_params.append(bin_search_params)
      elif index_type in ["HNSW"]:
          for ef in [150]:
              hnsw_search_param = {
                  "metric_type": metric_type,
                  "params": {"ef": ef},
              }
              search_params.append(hnsw_search_param)
      elif index_type == "ANNOY":
          for search_k in [1000]:
              annoy_search_param = {
                  "metric_type": metric_type,
                  "params": {"search_k": search_k},
              }
              search_params.append(annoy_search_param)
      else:
          logger.info("Invalid index_type.")
          raise Exception("Invalid index_type.")
      return search_params[0]
  
file_path: milvus/tests/python_client/deploy/scripts/first_recall_test.py
imports: import threading
  import h5py
  import numpy
  import time
  import sys
  import copy
  from pathlib import Path
  from loguru import logger
  import pymilvus
  from pymilvus import connections, FieldSchema, CollectionSchema, DataType, Collection, utility
label_desc: Use image node_id 2 for calling a global function with example usage: gen_search_param(index_type, metric_type) and returns: search_params