1

Does anyone know the syntax for using MultiSearch using the NEST library version 7.6.

We have tried:

var result = client.MultiSearch(ms => ms
    .Search<ElasticsearchProject>("projects", s => s.MatchAll())
    .Search<Person>("people", s => s.MatchAll())
);

It seems this is not valid anymore in version 7.6

2 Answers 2

2

MultiSearch expects an Indices as the first parameter, although it is an optional parameter. To pass just the delegate, label the parameter

var result = client.MultiSearch(selector: ms => ms
    .Search<ElasticsearchProject>("projects", s => s.MatchAll())
    .Search<Person>("people", s => s.MatchAll())
);
Sign up to request clarification or add additional context in comments.

1 Comment

Is this soemwhere in docs? Would appreciate you pointing us to it. Thanks.
2
var d = new MultiSearchDescriptor();
            d.Search<ElasticsearchProject>("projects", s => s
                             .Index("<indexname>")
                               .Query(q => q
                                       .MatchAll()
                                     )
                             .From(1)
                             .Size(10)
                           );
            d.Search<Person>("people", s => s
                           .Index("<indexname>")
                           .Query(q => q
                           .MatchAll()
                               )
                           .From(1)
                           .Size(10)
                         );

            var re = _elasticClient.MultiSearch(d);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.