Nested Query

edit

See Nested Query

QueryBuilders.nestedQuery("obj1",               // Path
                QueryBuilders.boolQuery()       // Your query
                        .must(QueryBuilders.matchQuery("obj1.name", "blue"))
                        .must(QueryBuilders.rangeQuery("obj1.count").gt(5))
            )
            .scoreMode("avg");                  // max, total, avg or none