I am using Elastic Search 6.5.4 and NEST client Version 6. I have an array of strings to be searched with a field in the index. I tried using Terms Query and it is as follows.
Example
dynamicOrganizationList = [ "org1","org2" ].
And in my Index I have different organization values for different records. Like for Document 1, I have org1 as Organization.<b For 2nd document, I have org2 as an organization and for 3rd document have org3 as organization
{
{
id:"doc1",
Organization:"org1"
}
{
id:"doc2",
Organization:"org2"
}
{
id:"doc3",
Organization:"org3"
}
}
Now I need the records having organization Ids as org1 or org2
.
This is the query I have used
.Query(q => q.Terms(b => b.Name("metrics_query").Boost(1.1).Field(f => f.Organization).Terms(dynamicOrganizationList))
Thanks in advance.