# How to create request body for Rust Elasticsearch mSearch

**URL:** <https://discuss.elastic.co/t/how-to-create-request-body-for-rust-elasticsearch-msearch/337540>\
**Category:** Elasticsearch\
**Created:** [July 4, 2023, 9:18am UTC](https://discuss.elastic.co/t/how-to-create-request-body-for-rust-elasticsearch-msearch/337540 "2023-07-04T09:18:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aniket\_mandhare](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aniket_mandhare/32/122986_2.png) [@aniket\_mandhare](https://discuss.elastic.co/u/aniket_mandhare)\
**Post date:** [July 4, 2023, 9:18am UTC](https://discuss.elastic.co/t/how-to-create-request-body-for-rust-elasticsearch-msearch/337540/1 "2023-07-04T09:18:42Z")

</div>

Please help me to implement multi search functionality or \_msearch api in in Rust programming language.

---

<div class="post-metadata">

**Author:** ![aniket\_mandhare](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aniket_mandhare/32/122986_2.png) [@aniket\_mandhare](https://discuss.elastic.co/u/aniket_mandhare)\
**Post date:** [July 4, 2023, 9:50am UTC](https://discuss.elastic.co/t/how-to-create-request-body-for-rust-elasticsearch-msearch/337540/2 "2023-07-04T09:50:50Z")

</div>

hello folks...I got the solution, thanks in advance  
Solution

```auto
let msearch_response = client
    .msearch(MsearchParts::None)
    .body::<JsonBody<Value>>(vec![
        json!({"index":"cat_food"}).into(),
        json!({"query":{"term":{"name":{"term":"Whiskers"}}}}).into(),
        json!({"index":"cat_food"}).into(),
        json!({"query":{"term":{"name":{"term":"Chicken"}}}}).into(),
        json!({"index":"cat_food"}).into(),
        json!({"query":{"term":{"name":{"term":"Turkey"}}}}).into(),
    ])
    .send()
    .await?;

```

---

<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:** [August 1, 2023, 9:51am UTC](https://discuss.elastic.co/t/how-to-create-request-body-for-rust-elasticsearch-msearch/337540/3 "2023-08-01T09:51:15Z")

</div>

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