Skip to content

MultiGetRequest does not serialize request parameters for SourceConfigParam properly #8267

Closed
@MartinAprimo

Description

@MartinAprimo

Elastic.Clients.Elasticsearch version: 8.14.6

Elasticsearch version: 8.8.2

.NET runtime version: .NET Framework 4.8.9241.0

Operating system version: Win 11

Description of the problem including expected versus actual behavior:
When I search using MultiGetRequest, the code the SourceConfigParam is not serialized to the URI properly. The URI for the request that is send to elastic looks like
POST: /tenant-1_unittests_uniquekeycacheindex_20240716100527714/_mget?pretty=true&error_trace=true&_source=Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam&realtime=true&refresh=false
Instead of POST: /_mget?pretty=true&error_trace=true&_source=true&realtime=true&refresh=false

Steps to reproduce:
Small code samle

MultiGetRequest multiGetRequest = new MultiGetRequest()
{
				Docs = new List<MultiGetOperation>(),
				Source = new SourceConfigParam(Elastic.Clients.Elasticsearch.Fields.FromString("entityId")), 
};

foreach (var add in updates[UniqueKeyAction.Add])
{
				MultiGetOperation getOperation = new MultiGetOperation() { 
					Id = new Id(UniqueKeyHelper.GenerateUniqueKeyEntryId(add)), Index = CacheName };
				multiGetRequest.Docs.Add(getOperation);
}

foreach (var update in updates[UniqueKeyAction.Update])
{
				MultiGetOperation getOperation = new MultiGetOperation() { Id = new Id(UniqueKeyHelper.GenerateUniqueKeyEntryId(update)), Index = CacheName };
				multiGetRequest.Docs.Add(getOperation);
}

multiGetRequest.Realtime = true;
multiGetRequest.Refresh = false;
multiGetRequest.RequestConfiguration = new RequestConfiguration
{
				MaxRetries = 0
};

var multiGetResponse = await Client.MultiGetAsync<ElasticUniqueKeyDto>(multiGetRequest).ConfigureAwait(false);

Expected behavior
The URI should (I believe) look like /_mget?pretty=true&error_trace=true&_source=true&realtime=true&refresh=false

Provide ConnectionSettings (if relevant):

Provide DebugInformation (if relevant):

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions