Having difficulty creating multiple field queries

I'm attempting to create slightly more complex queries using Java API client 7.16 (like the json below), but I'm not sure which direction to go in to do this correctly. Do I use terms query for something like this query below, or do I add multiple terms to a query?

Also, it's difficult to navigate the docs for this version, so I can't find a way to even specify multiple terms via a list.
The below java code only works for "keyword" types, but doesn't work for any text fields - is there something I'm missing? I tried attaching an analyzer but the client threw some errors there.
My ideal scenario would be providing a map of queries { "textField1": "foo", "boolField1": "True", "intField1": "20", "keywordField1": "Af:5E:1b:D8", "obj1.name": "bar"} and using the search response to fetch all the matching documents (note: the query could contain nested fields and non-nested fields). Does this exist? What is the best way to do something like this if it does not?

Thank you in advance.

SearchRequest sr = new SearchRequest.Builder()
            .query(q -> q
                .term(t -> t
                    .value(v -> v.stringValue("foobar"))
            {"match": {"textField1": "foo"}},
            {"match": {"boolField1": True}},
            {"match": {"intField1": 20}},
            {"match": {"keywordField1": "Af:5E:1b:D8"}},
                "nested": {
                    "path": "obj1",
                    "query": {
                        "bool": {
                            "must": [
                                { "match": { "obj1.name": "bar" } }

Update: I found that QueryString with lucene syntax fits my use case far better in case anyone is trying to do something similar.
Also, I realized that writing out the builders in similar to how it appears in the actual JSON query makes using the Java API client much more straight forward.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.