Is there a client.Read(...) without generics? I have found none, neither in Nest nor ElasticSearch.Net.
Version 1.5 has an IDocument that might solve my problem but I cannot use that version with Elasticsearch5.5.
All examples, version 5 and 6, of ElasticSearch.Net and Nest require me to know the format of the response as generic at compile time. E.g. Read<Customer>(...)
My problem is that the we do not know the format of the database and we don't know the format of the output; but it should all be configurable.
You can use
dynamicas the generic type if the response is truly dynamic.In 5.x, this will be Json.NET's
JObjecttype under the covers (so you could useJObjectinstead if you prefer).In 6.x,
dynamicwill also work but the actual type will be an internalJObjecttype. If you would prefer to work with Json.NET'sJObjecttype, you can hook up Json.NET as the serializer using the NEST.JsonNetSerializer nuget package, to use as the serializer for your documents and then use itsJObjecttype as per 5.x.