I'm using NEST
to send a manual query to the multisearch API, with the body as NDJSOn as docuemnted in Elastic's docs:
var query = @"
...
";
StringResponse response = await _elastic.LowLevel.MultiSearchAsync<StringResponse>(indexName, PostData.String(query));
The response is succesful and I'm receiving 200. However, I'd like to serialize it to MultisearchResponse
. For regular search queries, I'm using the built-in serializer like so:
var stream = new MemoryStream(Encoding.UTF8.GetBytes(response.Body));
SearchResponse<MetadataDto> searchResponse = _elastic.RequestResponseSerializer.Deserialize<SearchResponse<MetadataDto>>(stream);
However, when trying to do the same and use MultiSearchResponse
, it throws: Constructor on type 'Nest.MultiSearchResponseFormatter' not found.
:
var stream = new MemoryStream(Encoding.UTF8.GetBytes(response.Body));
MultiSearchResponse multiSearchResponse = _elastic.RequestResponseSerializer.Deserialize<MultiSearchResponse>(stream);
// TODO: Get all the responses using 'multiSearchResponse.GetResponses<T>`.
Why is that happening, or what am I doing wrong?