Skip to content

Commit

Permalink
[Tests] #24638 Fix rest high level client docs build by restoring has…
Browse files Browse the repository at this point in the history
…Child and hasParent in the tests
  • Loading branch information
jimczi committed May 12, 2017
1 parent f8df2a2 commit 4291880
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions client/rest-high-level/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ dependencies {

testCompile "org.elasticsearch.client:test:${version}"
testCompile "org.elasticsearch.test:framework:${version}"
// for parent/child testing
testCompile "org.elasticsearch.plugin:parent-join-client:${version}"

This comment has been minimized.

Copy link
@nik9000

nik9000 May 12, 2017

Member

I wonder if this should actually be a regular compile dependency so that users of the high level rest client can use those queries. @javanna, what do you think?

This comment has been minimized.

Copy link
@javanna

javanna May 12, 2017

Member

I am confused by this commit. Does the testCompile change have to do with QueryDSLDocumentationTests? cause the high level client doesn't support search yet, so I don't see how we would be testing that :) I think that QueryDSLDocumentationTests uses the transport client to send requests and test docs snippets?

That said, users of the high level client should have this by default, I agree with you @nik9000

This comment has been minimized.

Copy link
@nik9000

nik9000 May 12, 2017

Member

I think that QueryDSLDocumentationTests uses the transport client to send requests and test docs snippets?

It doesn't send the requests at all, just build them. They were originally for testing building the queries with the transport client but they looked like they could work for the high level rest client so I bounced them into the rest client's tests assuming we'd clean them up some more once the rest client supported it.

This comment has been minimized.

Copy link
@javanna

javanna May 12, 2017

Member

alright, thanks for the explanation! I still agree with you! :)

testCompile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
testCompile "junit:junit:${versions.junit}"
testCompile "org.hamcrest:hamcrest-all:${versions.hamcrest}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
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.
Expand Down Expand Up @@ -214,6 +216,24 @@ public void testGeoShape() throws IOException {
}
}

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() {
// tag::ids
idsQuery("my_type", "type2")
Expand Down

0 comments on commit 4291880

Please sign in to comment.