elasticsearch-net icon indicating copy to clipboard operation
elasticsearch-net copied to clipboard

Elasticsearch NEST deserializing issue

Open r4nc1d opened this issue 1 year ago • 1 comments

NEST/Elasticsearch.Net version: 7.17.10

Elasticsearch version: 7.17.10

.NET runtime version: net6.0

Operating system version: Windows

Description of the problem including expected versus actual behavior:

When using multiple template search in NEST the expected result would be to be able to search and deserialize the response. What currently is happening, when making a request using MultiSearchTemplateRequest and calling var multiSearchResponse = this.client.MultiSearchTemplate(indexTemplateRequest); The response can not be deserialize using var responses = multiSearchResponse.GetResponse<PocoObj>("some-index"); as it always returns null.

But it does look like there is an exception being thrown. I pulled the github repo and debugged it. Got the following. image

Steps to reproduce: Please see the link below

var indexTemplateRequest = new MultiSearchTemplateRequest
{
    Operations = new Dictionary<string, ISearchTemplateRequest>
    {
        {
            "custom-form-index", new SearchTemplateRequest("some-index")
            {
                Id = "some-index-template",
                Params = new Dictionary<string, object>
                {
                    { "query", "test"},
                    { "clauses", new List<object>() }
                }
            }
        }
    }
};

var multiSearchResponse = this.client.MultiSearchTemplate(indexTemplateRequest);
var responses = multiSearchResponse.GetResponse<PocoObj>("some-index"); -> ALWAYS RETURNS NULL

Can also refer to the below link https://discuss.elastic.co/t/how-to-run-multiple-search-templates-using-nest/334933

Expected behavior When calling multiSearchResponse.GetResponse<PocoObj>("some-index"); it is expected to return List of type <T> (in this case PocoObj)

r4nc1d avatar Jun 05 '23 11:06 r4nc1d

I am also getting this issue

bryanvam avatar Jun 05 '23 11:06 bryanvam