docs: updated java client api to take this into account too to take into account the p/c queries are in parent-join module
Closes #25624
This commit is contained in:
parent
ec66d655b5
commit
02fad9ac8c
|
@ -28,6 +28,7 @@ import org.elasticsearch.common.unit.DistanceUnit;
|
|||
import org.elasticsearch.index.query.GeoShapeQueryBuilder;
|
||||
import org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder;
|
||||
import org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder.FilterFunctionBuilder;
|
||||
import org.elasticsearch.join.query.JoinQueryBuilders;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
|
@ -77,8 +78,6 @@ import static org.elasticsearch.index.query.QueryBuilders.typeQuery;
|
|||
import static org.elasticsearch.index.query.QueryBuilders.wildcardQuery;
|
||||
import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.exponentialDecayFunction;
|
||||
import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.randomFunction;
|
||||
import static org.elasticsearch.join.query.JoinQueryBuilders.hasChildQuery;
|
||||
import static org.elasticsearch.join.query.JoinQueryBuilders.hasParentQuery;
|
||||
|
||||
/**
|
||||
* Examples of using the transport client that are imported into the transport client documentation.
|
||||
|
@ -218,7 +217,7 @@ public class QueryDSLDocumentationTests extends ESTestCase {
|
|||
|
||||
public void testHasChild() {
|
||||
// tag::has_child
|
||||
hasChildQuery(
|
||||
JoinQueryBuilders.hasChildQuery(
|
||||
"blog_tag", // <1>
|
||||
termQuery("tag","something"), // <2>
|
||||
ScoreMode.None); // <3>
|
||||
|
@ -227,7 +226,7 @@ public class QueryDSLDocumentationTests extends ESTestCase {
|
|||
|
||||
public void testHasParent() {
|
||||
// tag::has_parent
|
||||
hasParentQuery(
|
||||
JoinQueryBuilders.hasParentQuery(
|
||||
"blog", // <1>
|
||||
termQuery("tag","something"), // <2>
|
||||
false); // <3>
|
||||
|
|
|
@ -3,6 +3,17 @@
|
|||
|
||||
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 InetSocketTransportAddress(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]
|
||||
|
|
|
@ -3,6 +3,17 @@
|
|||
|
||||
See {ref}/query-dsl-has-parent-query.html[Has Parent]
|
||||
|
||||
When using the `has_parent` 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 InetSocketTransportAddress(new InetSocketAddress(InetAddresses.forString("127.0.0.1"), 9300)));
|
||||
--------------------------------------------------
|
||||
|
||||
Otherwise the parent-join module doesn't get loaded and the `has_parent` query can't be used from the transport client.
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{query-dsl-test}[has_parent]
|
||||
|
|
Loading…
Reference in New Issue