[Tests] #24638 Fix rest high level client docs build by restoring hasChild and hasParent in the tests

This commit is contained in:
Jim Ferenczi 2017-05-12 17:03:26 +02:00
parent f8df2a22e9
commit 4291880a29
2 changed files with 22 additions and 0 deletions

View File

@ -29,6 +29,8 @@ dependencies {
testCompile "org.elasticsearch.client:test:${version}" testCompile "org.elasticsearch.client:test:${version}"
testCompile "org.elasticsearch.test:framework:${version}" testCompile "org.elasticsearch.test:framework:${version}"
// for parent/child testing
testCompile "org.elasticsearch.plugin:parent-join-client:${version}"
testCompile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}" testCompile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
testCompile "junit:junit:${versions.junit}" testCompile "junit:junit:${versions.junit}"
testCompile "org.hamcrest:hamcrest-all:${versions.hamcrest}" testCompile "org.hamcrest:hamcrest-all:${versions.hamcrest}"

View File

@ -77,6 +77,8 @@ import static org.elasticsearch.index.query.QueryBuilders.typeQuery;
import static org.elasticsearch.index.query.QueryBuilders.wildcardQuery; 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.exponentialDecayFunction;
import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.randomFunction; 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. * Examples of using the transport client that are imported into the transport client documentation.
@ -214,6 +216,24 @@ public class QueryDSLDocumentationTests extends ESTestCase {
} }
} }
public void testHasChild() {
// tag::has_child
hasChildQuery(
"blog_tag", // <1>
termQuery("tag","something"), // <2>
ScoreMode.None); // <3>
// end::has_child
}
public void testHasParent() {
// tag::has_parent
hasParentQuery(
"blog", // <1>
termQuery("tag","something"), // <2>
false); // <3>
// end::has_parent
}
public void testIds() { public void testIds() {
// tag::ids // tag::ids
idsQuery("my_type", "type2") idsQuery("my_type", "type2")