Hey there, I’m using opensearch-go and relying heavily on the typed client usage. In trying to define a terms query, I’ve hit a wall, as I’m not quite sure how to simply match on a single field for multiple values.
For a singular term query, it looks like this works:
But I’m stumped as to how the Terms field on the CommonQueryDSLQueryContainer works. It doesn’t appear to have any way to specify a field name and then the set of values to match? For example, it does not appear to have any equivalent *FromValue() method?
Does anyone have an example of how it should be used?
I suppose at worst, I can just define multiple singlular Term queries each with the different values?
The Terms field works the same way as your Term example. It is a map keyed by field name, but each entry holds the whole list of values for that field instead of a single value, so build it the same way you built q.Term, just with the values list for the field. I am not 100% sure of the exact constructor name in 3.9, but the map keyed by field name is the part to get right.