OpenSearch QueryBuilder in Golang

I am using a golang client to talk to Opensearch version 1.2.4 .

I have been looking for a while to find out elastic search equivalent of "" in opensearch to build queries. At the moment I am using the following library "".

I am looking for built in APIs like NewTermQuery(), NewBoolQuery(), ShouldQuery() etc in opensearch library.

Are these APIs available in opensearch golang libraries?

Hi @sresd - I don’t know off the top of my head - I’m definitely not an expert at go. I did a quick look through the source code of the go libraries. It looks like there’s a short little piece of go for each of the methods that can be called. Have a peek at this:

You might be able to find your answer there with a bit of reading. Let me know if you need further help. I’ll be happy to see if I can draw in another expert. :slight_smile:


Hello @nateynate ,

Thanks for looking into this. As a matter of fact I went through these files before reaching out here.
if my understanding is right, these APIs do not talk about query building as such but they are mostly about talking to opensearch if you have the query in hand.

Also Query is defined as a string in these files which makes me wonder even more if APIs are builtin to construct it.