public class Mainsearch
{
public int id{get;set;}
public string name {get;set;}
public list tblref{get;set;}
}
public class tblreference
{
public int Id{get;set;}
public int RefId{get;set}
public string Name {get;set;}
}
I had created an index with above mentioned. i'm using querystring for search.
Now am searching for nested docs where i will pass querystring as Mainsearch.name='X', the tblreference.RefId contains list of docs... i need to get that tblreference.RefId's and pass to Mainsearch.Id and need to returns the results that should equals Mainsearch.Id = tblreference.RefId.
you can format code by highlighting it and pressing </> in the editor bar (or fencing it in 3 backticks at start and end).
so i get list of docs from that i'll get tblreference.RefId and pass that RefId to my main search.
I'm not sure what you are trying to achieve; perhaps if you provide some more detail on the problem you're trying to solve, I may be able to help.
Assuming that your POCOs looks like the following
public class Mainsearch
{
public int id { get; set; }
public string name { get; set; }
public List<tblreference> tblref { get; set; }
}
public class tblreference
{
public int Id { get; set; }
public int RefId { get; set; }
public string Name { get; set; }
}
And assuming that tblreference has been mapped as a nested type, a nested query on it would be
client.Search<Mainsearch>(s => s
.Query(q => q
.Nested(n => n
.Path(p => p.tblref)
.Query(nq => nq
.Match(m => m
// The expression here is simply to get a reference to the `RefId` field
// on tblref types.
.Field(f => f.tblref.First().RefId)
.Query("reference_id")
)
)
)
)
);
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.