[[java-query-dsl-has-child-query]]
==== Has Child Query

See {ref}/query-dsl-has-child-query.html[Has Child Query]

When using the `has_child` query it is important to use the `PreBuiltTransportClient` instead of the regular client:

[source,java]
--------------------------------------------------
Settings settings = Settings.builder().put("cluster.name", "elasticsearch").build();
TransportClient client = new PreBuiltTransportClient(settings);
client.addTransportAddress(new TransportAddress(new InetSocketAddress(InetAddresses.forString("127.0.0.1"), 9300)));
--------------------------------------------------

Otherwise the parent-join module doesn't get loaded and the `has_child` query can't be used from the transport client.

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{query-dsl-test}[has_child]
--------------------------------------------------
<1> child type to query against
<2> query
<3> score mode can be `ScoreMode.Avg`, `ScoreMode.Max`, `ScoreMode.Min`, `ScoreMode.None` or `ScoreMode.Total`