Skip to content

Use MultisearchBodyDescriptor with MultiSearchRequestDescriptor #7970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Tracked by #8356
Tora-Bora opened this issue Oct 18, 2023 · 1 comment
Open
Tracked by #8356

Use MultisearchBodyDescriptor with MultiSearchRequestDescriptor #7970

Tora-Bora opened this issue Oct 18, 2023 · 1 comment
Labels
8.x Relates to a 8.x client version Category: Feature Usability

Comments

@Tora-Bora
Copy link

Is your feature request related to a problem? Please describe.
I'm trying to migrate our code from NEST to the new client. Unable to migrate the MultiSearchAsync using descriptors. The method accepts type MultiSearchRequestDescriptor, also I found the type MultisearchBodyDescriptor that I can use to build a search request. But seems like there is no way to use MultisearchBodyDescriptor at all.

The MultiSearchRequestDescriptor.AddSearch accepts SearchRequestItem and there is no option to provide the MultisearchBodyDescriptor anyhow.

Describe the solution you'd like
Add method to MultiSearchRequestDescriptor.AddSearch that accepts MultisearchBodyDescriptor parameter

Describe alternatives you've considered
Would be also great if we can to cast SearchRequestDescriptor to MultisearchBodyDescriptor

@flobernd flobernd added the 8.x Relates to a 8.x client version label Oct 24, 2023
@flobernd
Copy link
Member

Improving usability of the multisearch endpoint is definitely on my list. The initializer based approach works for now, but I agree it might be useful to support descriptors here as well:

var multiSearchResponse = await _elasticsearchClient.MultiSearchAsync<Place>(r =>
{
    foreach (var fullTextQuery in fullTextQueries)
    {
        r.AddSearch(new SearchRequestItem(
            new MultisearchHeader { Index = "my-index" },
            new MultisearchBody { /*...*/ }));
    }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.x Relates to a 8.x client version Category: Feature Usability
Projects
None yet
Development

No branches or pull requests

2 participants