How to create request body for Rust Elasticsearch mSearch

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

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

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?;
1 Like

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