I'm using Java API Client [7.17] in my project. I'm able to do most of the queries, but I'm trying to figure out how to search for multiple values in a particular fields and return values containing any of the values provided. I would assume Terms Query is what I'm looking for. But how do I pass a String array/list into the TermsQuery in Java API Client.
For example how do I write the below in Java:
GET /_search
{
"query": {
"terms": {
"referenceno": [ "xxx", "yyy" ]
}
}
}
For MatchQuery I'm using the following block of code:
Query docField = MatchQuery.of(m -> m
.field(field)
.query(String.valueOf(value))
)._toQuery();
And passing docField as parameter in bool query. Is there a similar way I can write terms query?
Thanks in advance!