|
|
@@ -37,33 +37,33 @@ import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
public class GraphIT extends ESRestHighLevelClientTestCase {
|
|
|
-
|
|
|
+
|
|
|
@Before
|
|
|
public void indexDocuments() throws IOException {
|
|
|
// Create chain of doc IDs across indices 1->2->3
|
|
|
Request doc1 = new Request(HttpPut.METHOD_NAME, "/index1/_doc/1");
|
|
|
doc1.setJsonEntity("{ \"num\":[1], \"const\":\"start\"}");
|
|
|
client().performRequest(doc1);
|
|
|
-
|
|
|
+
|
|
|
Request doc2 = new Request(HttpPut.METHOD_NAME, "/index2/_doc/1");
|
|
|
doc2.setJsonEntity("{\"num\":[1,2], \"const\":\"foo\"}");
|
|
|
client().performRequest(doc2);
|
|
|
-
|
|
|
+
|
|
|
Request doc3 = new Request(HttpPut.METHOD_NAME, "/index2/_doc/2");
|
|
|
doc3.setJsonEntity("{\"num\":[2,3], \"const\":\"foo\"}");
|
|
|
- client().performRequest(doc3);
|
|
|
+ client().performRequest(doc3);
|
|
|
|
|
|
Request doc4 = new Request(HttpPut.METHOD_NAME, "/index_no_field_data/_doc/2");
|
|
|
doc4.setJsonEntity("{\"num\":\"string\", \"const\":\"foo\"}");
|
|
|
- client().performRequest(doc4);
|
|
|
-
|
|
|
+ client().performRequest(doc4);
|
|
|
+
|
|
|
Request doc5 = new Request(HttpPut.METHOD_NAME, "/index_no_field_data/_doc/2");
|
|
|
doc5.setJsonEntity("{\"num\":[2,4], \"const\":\"foo\"}");
|
|
|
- client().performRequest(doc5);
|
|
|
+ client().performRequest(doc5);
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- client().performRequest(new Request(HttpPost.METHOD_NAME, "/_refresh"));
|
|
|
- }
|
|
|
+ client().performRequest(new Request(HttpPost.METHOD_NAME, "/_refresh"));
|
|
|
+ }
|
|
|
|
|
|
public void testCleanExplore() throws Exception {
|
|
|
GraphExploreRequest graphExploreRequest = new GraphExploreRequest();
|
|
|
@@ -75,7 +75,7 @@ public class GraphIT extends ESRestHighLevelClientTestCase {
|
|
|
if (i == 0) {
|
|
|
guidingQuery = new TermQueryBuilder("const.keyword", "start");
|
|
|
} else if (randomBoolean()){
|
|
|
- guidingQuery = new TermQueryBuilder("const.keyword", "foo");
|
|
|
+ guidingQuery = new TermQueryBuilder("const.keyword", "foo");
|
|
|
}
|
|
|
Hop hop = graphExploreRequest.createNextHop(guidingQuery);
|
|
|
VertexRequest vr = hop.addVertexRequest("num");
|
|
|
@@ -94,13 +94,13 @@ public class GraphIT extends ESRestHighLevelClientTestCase {
|
|
|
}
|
|
|
assertEquals(expectedTermsAndDepths, actualTermsAndDepths);
|
|
|
assertThat(exploreResponse.isTimedOut(), Matchers.is(false));
|
|
|
- ShardOperationFailedException[] failures = exploreResponse.getShardFailures();
|
|
|
+ ShardOperationFailedException[] failures = exploreResponse.getShardFailures();
|
|
|
assertThat(failures.length, Matchers.equalTo(0));
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public void testBadExplore() throws Exception {
|
|
|
- //Explore indices where lack of fielddata=true on one index leads to partial failures
|
|
|
+ //Explore indices where lack of fielddata=true on one index leads to partial failures
|
|
|
GraphExploreRequest graphExploreRequest = new GraphExploreRequest();
|
|
|
graphExploreRequest.indices("index1", "index2", "index_no_field_data");
|
|
|
graphExploreRequest.useSignificance(false);
|
|
|
@@ -110,7 +110,7 @@ public class GraphIT extends ESRestHighLevelClientTestCase {
|
|
|
if (i == 0) {
|
|
|
guidingQuery = new TermQueryBuilder("const.keyword", "start");
|
|
|
} else if (randomBoolean()){
|
|
|
- guidingQuery = new TermQueryBuilder("const.keyword", "foo");
|
|
|
+ guidingQuery = new TermQueryBuilder("const.keyword", "foo");
|
|
|
}
|
|
|
Hop hop = graphExploreRequest.createNextHop(guidingQuery);
|
|
|
VertexRequest vr = hop.addVertexRequest("num");
|
|
|
@@ -131,9 +131,9 @@ public class GraphIT extends ESRestHighLevelClientTestCase {
|
|
|
assertThat(exploreResponse.isTimedOut(), Matchers.is(false));
|
|
|
ShardOperationFailedException[] failures = exploreResponse.getShardFailures();
|
|
|
assertThat(failures.length, Matchers.equalTo(1));
|
|
|
- assertTrue(failures[0].reason().contains("Fielddata is disabled"));
|
|
|
-
|
|
|
+ assertTrue(failures[0].reason().contains("Text fields are not optimised for operations that require per-document field data"));
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|