Hi i am trying to use nest client for c# to write search query .
i know these ways of writing query
var searchresponse = client.Search<test>(s => s
.From(0)
.Size(10)
.Index("sales*")
.Query(q => q
.Match(m => m
.Field(f => f.documenttype)
.Query("salesinvoice")
)
)
);
other way of doing same thing
var searchResponse = client.LowLevel.Search<StringResponse>("sales*", @"
{
""from"": 0,
""size"": 10,
""query"": {
""match"": {
""documenttype"": {
""query"": ""SalesInvoice""
}
}
}
}");
But i want to create some generic function where my class type can be pass as argument
var searchresponse = client.Search<T>((s => s
.From(0)
.Size(10)
.Index("sales*")
.Query(q => q
.Match(m => m
.Field(f => f.documenttype)
.Query("salesinvoice")
)
)
is there any way where i can do some thing like this , where my class type can be generic for ES client .
As response i directly want to map with my class type .
any help or suggestion .
Thanks .