Lets say we have a class called acls and this class has a List property called lprop.
Now lets say I have another List which has values 1,3,5 and lets say this variables name is tosearch.
I want to search tosearch values in acls typed records lprop property in an index of elasticsearch by using nest and finding only one match is sufficient.
Ex:
`public class acls
{
public List<int> lprop {get;set;}
}
public void main()
{
//.. creating connection and etc..
// we have 3 recs of acls
// 1. lprop values: 2,4,6,8
// 2. lprop values: 1,9,0,4
// 3. lprop values: 6,7,8
List<int> tosearch = new int[] { 1, 3, 5 }.ToList();
//Now I want to search tosearch values in acls lprop values.
// Result should be: 2. records
}`
Use a Terms
query
client.Search<acls>(s => s
.Query(q => q
.Terms(c => c
.Field(p => p.lprop)
.Terms<string>(tosearch)
)
)
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With