Hi all!!
First of all, sorry if this topic is an wrong thread.
I am using the nest to update or get the documents in ElasticSearch, but now I have a problem and I don't know if is possible solved it
I have these classes:
public class Archive : IElasticResult
{
public string CodeDocument { get; set; }
public string TypeDocument { get; set; }
public Archive()
{
CodeDocument = "1";
TypeDocument = string.Empty;
}
}
public class WorkerArchive : Archive
{
public string CodeWorker { get; set; }
public WorkerArchive(string code)
{
CodeDocument = code;
CodeWorker = "prove";
}
}
If I create a new object WorkerArchive and update the register works:
var response2 = Elastic.Update(DocumentPath
.Id(a.CodeDocument),
u => u
.Index(IndexName)
.Type("archive")
.DocAsUpsert(true)
.Doc((Archive)a));
}
The problem is when I want obtain this document, because I'm declaring the specific class:
ISearchResponse result = Elastic.Search(searchRequest);
And the return is of the type Archive, when have the structure of WorkerArchive.
Is possible have a list of hits of differents types?
Thanks for all!