# Warning: Body deprecated in hybrid search

**URL:** <https://discuss.elastic.co/t/warning-body-deprecated-in-hybrid-search/330613>\
**Category:** Elasticsearch\
**Tags:** vector-search\
**Created:** [April 24, 2023, 8:53am UTC](https://discuss.elastic.co/t/warning-body-deprecated-in-hybrid-search/330613 "2023-04-24T08:53:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francisco\_Rocha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/francisco_rocha/32/119936_2.png) [@Francisco\_Rocha](https://discuss.elastic.co/u/Francisco_Rocha)\
**Post date:** [April 24, 2023, 8:53am UTC](https://discuss.elastic.co/t/warning-body-deprecated-in-hybrid-search/330613/1 "2023-04-24T08:53:35Z")

</div>

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:

```auto
# 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(
        index=idx_name,
        request_timeout=30,
        body=es_query,
        explain=True
    )

```

---

<div class="post-metadata">

**Author:** ![mayya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mayya/32/83147_2.png) [@mayya](https://discuss.elastic.co/u/mayya)\
**Post date:** [May 18, 2023, 10:04pm UTC](https://discuss.elastic.co/t/warning-body-deprecated-in-hybrid-search/330613/2 "2023-05-18T22:04:29Z")

</div>

> [@Francisco\_Rocha](#):
>
> `es.search(`

I am not in expert in the python client, but looking at the [documentation](https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/examples.html#ex-search) you need to use `query` parameter instead of `body`.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 15, 2023, 10:05pm UTC](https://discuss.elastic.co/t/warning-body-deprecated-in-hybrid-search/330613/3 "2023-06-15T22:05:05Z")

</div>

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