apache/beam · error · ValueError

Not supported search strategy yet: {self.search_strategy}

Error message

Not supported search strategy yet: {self.search_strategy}

What it means

MilvusEnricher._search_documents dispatches on the configured search_strategy type (vector / keyword / hybrid). This error is thrown when the strategy object is of a type the enricher does not recognize, so no branch matches and it raises a ValueError.

Source

Thrown at sdks/python/apache_beam/ml/rag/enrichment/milvus_search.py:461

          partition_names=self.partition_names,
          output_fields=self.output_fields,
          timeout=self.timeout,
          round_decimal=self.round_decimal,
          data=data,
          **vector_search_params)
    elif isinstance(self.search_strategy, KeywordSearchParameters):
      data = list(map(self._get_keyword_search_data, embeddable_items))
      keyword_search_params = unpack_dataclass_with_kwargs(self.search_strategy)
      return self._client.search(
          collection_name=self.collection_name,
          partition_names=self.partition_names,
          output_fields=self.output_fields,
          timeout=self.timeout,
          round_decimal=self.round_decimal,
          data=data,
          **keyword_search_params)
    else:
      raise ValueError(
          f"Not supported search strategy yet: {self.search_strategy}")

  def _get_hybrid_search_data(self, embeddable_items: list[EmbeddableItem]):
    vector_search_data = list(
        map(self._get_vector_search_data, embeddable_items))
    keyword_search_data = list(
        map(self._get_keyword_search_data, embeddable_items))

    vector_search_req = AnnSearchRequest(
        data=vector_search_data,
        anns_field=self.search_strategy.vector.anns_field,
        param=self.search_strategy.vector.search_params,
        limit=self.search_strategy.vector.limit,
        expr=self.search_strategy.vector.filter)

    keyword_search_req = AnnSearchRequest(
        data=keyword_search_data,
        anns_field=self.search_strategy.keyword.anns_field,

View on GitHub (pinned to 12126d8942)

Solutions

  1. Use one of the supported strategies: VectorSearchStrategy, KeywordSearchStrategy, or HybridSearchStrategy
  2. Check the installed apache_beam version supports the strategy type you pass
  3. If a custom strategy is needed, extend _search_documents to handle it before use

Example fix

// before
params = MilvusSearchParameters(collection_name='c', search_strategy=MyCustomStrategy())
// after
params = MilvusSearchParameters(collection_name='c', search_strategy=HybridSearchStrategy(embedding_fn=fn))
Defensive patterns

Strategy: type-guard

Validate before calling

SUPPORTED = (VectorSearchStrategy, KeywordSearchStrategy, HybridSearchStrategy)
assert isinstance(params.search_strategy, SUPPORTED), 'unsupported strategy'

Type guard

def is_supported_strategy(s) -> bool:
    return isinstance(s, (VectorSearchStrategy, KeywordSearchStrategy, HybridSearchStrategy))

Try / catch

try:
    result = enricher(batch)
except ValueError as e:
    if str(e).startswith('Not supported search strategy'): log_and_skip_batch(batch)
    else: raise

Prevention

When it happens

Trigger: Passing a custom or unrecognized search strategy object to MilvusSearchParameters and then calling the enricher (via __call__), which reaches _search_documents with an unsupported strategy type.

Common situations: Implementing a custom strategy subclass not yet supported by the pipeline; version mismatch where a strategy type exists in a newer beam but the runtime has an older one; typo'd imports picking the wrong class.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/f9f7f6d92b05044a. Report an issue: GitHub.