See Nested Query
QueryBuilder qb = nestedQuery( "obj1", boolQuery() .must(matchQuery("obj1.name", "blue")) .must(rangeQuery("obj1.count").gt(5)) ) .scoreMode("avg");
path to nested document
your query. Any fields referenced inside the query must use the complete path (fully qualified).
score mode could be max, total, avg (default) or none
max
total
avg
none