Warning: Body deprecated in hybrid search

Hi there, don't know how to remove this warning:

  • DeprecationWarning: The 'body' parameter is deprecated for the 'search' API and will be removed in a future version. Instead use API parameters directly.

The following code produces the error:

# define the Elasticsearch query using HNSW ANN and BM25
    es_query = {
      "query": {
        "match": {
          "content": {
            "query": query,
            "boost": 0.5
      "knn": {
        "field": "embeddings",
        "query_vector": query_vector,
        "k": k,
        "num_candidates": 60,
        "boost": 0.5
      "size": k * 2

    # execute the Elasticsearch query
    results = es.search(

I am not in expert in the python client, but looking at the documentation you need to use query parameter instead of body.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.