diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index d56591bcab3..cb69c5a7468 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -51,6 +51,7 @@ import org.gradle.api.tasks.compile.JavaCompile import org.gradle.api.tasks.javadoc.Javadoc import org.gradle.internal.jvm.Jvm import org.gradle.process.ExecResult +import org.gradle.process.ExecSpec import org.gradle.util.GradleVersion import java.nio.charset.StandardCharsets @@ -232,6 +233,95 @@ class BuildPlugin implements Plugin { project.ext.java9Home = project.rootProject.ext.java9Home } + static void requireDocker(final Task task) { + final Project rootProject = task.project.rootProject + if (rootProject.hasProperty('requiresDocker') == false) { + /* + * This is our first time encountering a task that requires Docker. We will add an extension that will let us track the tasks + * that register as requiring Docker. We will add a delayed execution that when the task graph is ready if any such tasks are + * in the task graph, then we check two things: + * - the Docker binary is available + * - we can execute a Docker command that requires privileges + * + * If either of these fail, we fail the build. + */ + final boolean buildDocker + final String buildDockerProperty = System.getProperty("build.docker") + if (buildDockerProperty == null || buildDockerProperty == "true") { + buildDocker = true + } else if (buildDockerProperty == "false") { + buildDocker = false + } else { + throw new IllegalArgumentException( + "expected build.docker to be unset or one of \"true\" or \"false\" but was [" + buildDockerProperty + "]") + } + rootProject.rootProject.ext.buildDocker = buildDocker + rootProject.rootProject.ext.requiresDocker = [] + rootProject.gradle.taskGraph.whenReady { TaskExecutionGraph taskGraph -> + // check if the Docker binary exists and record its path + final List maybeDockerBinaries = ['/usr/bin/docker', '/usr/local/bin/docker'] + final String dockerBinary = maybeDockerBinaries.find { it -> new File(it).exists() } + + int exitCode + String dockerErrorOutput + if (dockerBinary == null) { + exitCode = -1 + dockerErrorOutput = null + } else { + // the Docker binary executes, check that we can execute a privileged command + final ByteArrayOutputStream output = new ByteArrayOutputStream() + final ExecResult result = LoggedExec.exec(rootProject, { ExecSpec it -> + it.commandLine dockerBinary, "images" + it.errorOutput = output + it.ignoreExitValue = true + }) + if (result.exitValue == 0) { + return + } + exitCode = result.exitValue + dockerErrorOutput = output.toString() + } + final List tasks = + ((List)rootProject.requiresDocker).findAll { taskGraph.hasTask(it) }.collect { " ${it.path}".toString()} + if (tasks.isEmpty() == false) { + /* + * There are tasks in the task graph that require Docker. Now we are failing because either the Docker binary does not + * exist or because execution of a privileged Docker command failed. + */ + String message + if (dockerBinary == null) { + message = String.format( + Locale.ROOT, + "Docker (checked [%s]) is required to run the following task%s: \n%s", + maybeDockerBinaries.join(","), + tasks.size() > 1 ? "s" : "", + tasks.join('\n')) + } else { + assert exitCode > 0 && dockerErrorOutput != null + message = String.format( + Locale.ROOT, + "a problem occurred running Docker from [%s] yet it is required to run the following task%s: \n%s\n" + + "the problem is that Docker exited with exit code [%d] with standard error output [%s]", + dockerBinary, + tasks.size() > 1 ? "s" : "", + tasks.join('\n'), + exitCode, + dockerErrorOutput.trim()) + } + throw new GradleException( + message + "\nyou can address this by attending to the reported issue, " + + "removing the offending tasks from being executed, " + + "or by passing -Dbuild.docker=false") + } + } + } + if (rootProject.buildDocker) { + rootProject.requiresDocker.add(task) + } else { + task.enabled = false + } + } + private static String findCompilerJavaHome() { String compilerJavaHome = System.getenv('JAVA_HOME') final String compilerJavaProperty = System.getProperty('compiler.java') @@ -785,10 +875,6 @@ class BuildPlugin implements Plugin { task.shouldRunAfter testTask } } - // no loose ends: check has to depend on all test tasks - project.tasks.matching {it.name == "check"}.all { - dependsOn(task) - } // TODO: why are we not passing maxmemory to junit4? jvmArg '-Xmx' + System.getProperty('tests.heap.size', '512m') diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy index 038686247f4..28d18e9b876 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy @@ -129,6 +129,7 @@ public class PluginBuildPlugin extends BuildPlugin { RestIntegTestTask integTest = project.tasks.create('integTest', RestIntegTestTask.class) integTest.mustRunAfter(project.precommit, project.test) project.integTestCluster.distribution = System.getProperty('tests.distribution', 'integ-test-zip') + project.check.dependsOn(integTest) } /** diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy index 86e048e93dc..b786e525fe2 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy @@ -18,6 +18,7 @@ */ package org.elasticsearch.gradle.test +import java.util.stream.Collectors import org.apache.tools.ant.DefaultLogger import org.apache.tools.ant.taskdefs.condition.Os import org.elasticsearch.gradle.BuildPlugin @@ -92,7 +93,8 @@ class ClusterFormationTasks { throw new Exception("tests.distribution=integ-test-zip is not supported") } configureDistributionDependency(project, config.distribution, currentDistro, VersionProperties.elasticsearch) - if (config.numBwcNodes > 0) { + boolean hasBwcNodes = config.numBwcNodes > 0 + if (hasBwcNodes) { if (config.bwcVersion == null) { throw new IllegalArgumentException("Must specify bwcVersion when numBwcNodes > 0") } @@ -134,6 +136,16 @@ class ClusterFormationTasks { esConfig['discovery.zen.hosts_provider'] = 'file' } esConfig['discovery.zen.ping.unicast.hosts'] = [] + if (hasBwcNodes == false && esConfig['discovery.type'] == null) { + esConfig['discovery.type'] = 'zen2' + esConfig['cluster.initial_master_nodes'] = nodes.stream().map({ n -> + if (n.config.settings['node.name'] == null) { + return "node-" + n.nodeNum + } else { + return n.config.settings['node.name'] + } + }).collect(Collectors.toList()) + } esConfig } dependsOn = startDependencies diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy index c91bc57204d..193bca32114 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy @@ -19,14 +19,10 @@ package org.elasticsearch.gradle.test import com.carrotsearch.gradle.junit4.RandomizedTestingTask -import org.elasticsearch.gradle.BuildPlugin import org.elasticsearch.gradle.VersionProperties import org.gradle.api.DefaultTask -import org.gradle.api.Project import org.gradle.api.Task import org.gradle.api.execution.TaskExecutionAdapter -import org.gradle.api.provider.Property -import org.gradle.api.provider.Provider import org.gradle.api.tasks.Copy import org.gradle.api.tasks.Input import org.gradle.api.tasks.TaskState @@ -36,7 +32,6 @@ import org.gradle.plugins.ide.idea.IdeaPlugin import java.nio.charset.StandardCharsets import java.nio.file.Files import java.util.stream.Stream - /** * A wrapper task around setting up a cluster and running rest tests. */ diff --git a/buildSrc/src/main/resources/checkstyle_suppressions.xml b/buildSrc/src/main/resources/checkstyle_suppressions.xml index 14adcf3cf60..06a389e64c6 100644 --- a/buildSrc/src/main/resources/checkstyle_suppressions.xml +++ b/buildSrc/src/main/resources/checkstyle_suppressions.xml @@ -57,38 +57,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -113,45 +81,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/buildSrc/version.properties b/buildSrc/version.properties index 17772abc10f..7b02c7c3e9f 100644 --- a/buildSrc/version.properties +++ b/buildSrc/version.properties @@ -1,5 +1,5 @@ elasticsearch = 7.0.0 -lucene = 8.0.0-snapshot-c78429a554 +lucene = 8.0.0-snapshot-aaa64d70159 # optional dependencies spatial4j = 0.7 diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java index 2f2b1f26b53..6583cd35a79 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java @@ -615,8 +615,18 @@ final class RequestConverters { } static Request termVectors(TermVectorsRequest tvrequest) throws IOException { - String endpoint = new EndpointBuilder().addPathPart( - tvrequest.getIndex(), tvrequest.getType(), tvrequest.getId()).addPathPartAsIs("_termvectors").build(); + String endpoint; + if (tvrequest.getType() != null) { + endpoint = new EndpointBuilder().addPathPart(tvrequest.getIndex(), tvrequest.getType(), tvrequest.getId()) + .addPathPartAsIs("_termvectors") + .build(); + } else { + endpoint = new EndpointBuilder().addPathPart(tvrequest.getIndex()) + .addPathPartAsIs("_termvectors") + .addPathPart(tvrequest.getId()) + .build(); + } + Request request = new Request(HttpGet.METHOD_NAME, endpoint); Params params = new Params(request); params.withRouting(tvrequest.getRouting()); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/core/TermVectorsRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/core/TermVectorsRequest.java index 30e97d3fc9c..001896641cf 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/core/TermVectorsRequest.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/core/TermVectorsRequest.java @@ -20,6 +20,7 @@ package org.elasticsearch.client.core; import org.elasticsearch.client.Validatable; +import org.elasticsearch.common.Nullable; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.xcontent.ToXContentObject; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -31,7 +32,7 @@ import java.util.Map; public class TermVectorsRequest implements ToXContentObject, Validatable { private final String index; - private final String type; + @Nullable private final String type; private String id = null; private XContentBuilder docBuilder = null; @@ -47,25 +48,57 @@ public class TermVectorsRequest implements ToXContentObject, Validatable { private Map perFieldAnalyzer = null; private Map filterSettings = null; + /** + * Constructs TermVectorRequest for the given document + * + * @param index - index of the document + * @param docId - id of the document + */ + public TermVectorsRequest(String index, String docId) { + this.index = index; + this.type = null; + this.id = docId; + } /** * Constructs TermVectorRequest for the given document + * * @param index - index of the document * @param type - type of the document * @param docId - id of the document + * + * @deprecated Types are in the process of being removed, use + * {@link #TermVectorsRequest(String, String)} instead. */ + @Deprecated public TermVectorsRequest(String index, String type, String docId) { this.index = index; this.type = type; this.id = docId; } + /** + * Constructs TermVectorRequest for an artificial document + * + * @param index - index of the document + * @param docBuilder - an artificial document + */ + public TermVectorsRequest(String index, XContentBuilder docBuilder) { + this.index = index; + this.type = null; + this.docBuilder = docBuilder; + } + /** * Constructs TermVectorRequest for an artificial document * @param index - index of the document * @param type - type of the document * @param docBuilder - an artificial document + * + * @deprecated Types are in the process of being removed, use + * {@link TermVectorsRequest(String, XContentBuilder)} instead. */ + @Deprecated public TermVectorsRequest(String index, String type, XContentBuilder docBuilder) { this.index = index; this.type = type; @@ -104,7 +137,10 @@ public class TermVectorsRequest implements ToXContentObject, Validatable { /** * Returns the type of the request + * + * @deprecated Types are in the process of being removed. */ + @Deprecated public String getType() { return type; } @@ -218,7 +254,9 @@ public class TermVectorsRequest implements ToXContentObject, Validatable { public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(); builder.field("_index", index); - builder.field("_type", type); + if (type != null) { + builder.field("_type", type); + } if (id != null) builder.field("_id", id); // set values only when different from defaults if (requestPositions == false) builder.field("positions", false); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/core/TermVectorsResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/core/TermVectorsResponse.java index 5c57fc11b6f..eef76ed7cb0 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/core/TermVectorsResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/core/TermVectorsResponse.java @@ -94,7 +94,10 @@ public class TermVectorsResponse { /** * Returns the type for the response + * + * @deprecated Types are in the process of being removed. */ + @Deprecated public String getType() { return type; } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/CCRIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/CCRIT.java index 3126538468b..21ff66d2434 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/CCRIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/CCRIT.java @@ -83,6 +83,7 @@ public class CCRIT extends ESRestHighLevelClientTestCase { }); } + @AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/36339") public void testIndexFollowing() throws Exception { CcrClient ccrClient = highLevelClient().ccr(); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/CrudIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/CrudIT.java index e04a6a8867a..e78a7b4e512 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/CrudIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/CrudIT.java @@ -1137,7 +1137,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase { } { // test _termvectors on real documents - TermVectorsRequest tvRequest = new TermVectorsRequest(sourceIndex, "_doc", "1"); + TermVectorsRequest tvRequest = new TermVectorsRequest(sourceIndex, "1"); tvRequest.setFields("field"); TermVectorsResponse tvResponse = execute(tvRequest, highLevelClient()::termvectors, highLevelClient()::termvectorsAsync); @@ -1160,7 +1160,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase { XContentBuilder docBuilder = XContentFactory.jsonBuilder(); docBuilder.startObject().field("field", "valuex").endObject(); - TermVectorsRequest tvRequest = new TermVectorsRequest(sourceIndex, "_doc", docBuilder); + TermVectorsRequest tvRequest = new TermVectorsRequest(sourceIndex, docBuilder); TermVectorsResponse tvResponse = execute(tvRequest, highLevelClient()::termvectors, highLevelClient()::termvectorsAsync); TermVectorsResponse.TermVector.Token expectedToken = new TermVectorsResponse.TermVector.Token(0, 6, 0, null); @@ -1180,7 +1180,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase { // Not entirely sure if _termvectors belongs to CRUD, and in the absence of a better place, will have it here public void testTermvectorsWithNonExistentIndex() { - TermVectorsRequest request = new TermVectorsRequest("non-existent", "non-existent", "non-existent"); + TermVectorsRequest request = new TermVectorsRequest("non-existent", "non-existent"); ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> execute(request, highLevelClient()::termvectors, highLevelClient()::termvectorsAsync)); @@ -1214,7 +1214,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase { { // test _mtermvectors where MultiTermVectorsRequest is constructed with ids and a template String[] expectedIds = {"1", "2"}; - TermVectorsRequest tvRequestTemplate = new TermVectorsRequest(sourceIndex, "_doc", "fake_id"); + TermVectorsRequest tvRequestTemplate = new TermVectorsRequest(sourceIndex, "fake_id"); tvRequestTemplate.setFields("field"); MultiTermVectorsRequest mtvRequest = new MultiTermVectorsRequest(expectedIds, tvRequestTemplate); @@ -1233,13 +1233,13 @@ public class CrudIT extends ESRestHighLevelClientTestCase { { // test _mtermvectors where MultiTermVectorsRequest constructed with adding each separate request MultiTermVectorsRequest mtvRequest = new MultiTermVectorsRequest(); - TermVectorsRequest tvRequest1 = new TermVectorsRequest(sourceIndex, "_doc", "1"); + TermVectorsRequest tvRequest1 = new TermVectorsRequest(sourceIndex, "1"); tvRequest1.setFields("field"); mtvRequest.add(tvRequest1); XContentBuilder docBuilder = XContentFactory.jsonBuilder(); docBuilder.startObject().field("field", "valuex").endObject(); - TermVectorsRequest tvRequest2 = new TermVectorsRequest(sourceIndex, "_doc", docBuilder); + TermVectorsRequest tvRequest2 = new TermVectorsRequest(sourceIndex, docBuilder); mtvRequest.add(tvRequest2); MultiTermVectorsResponse mtvResponse = diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java index 5946fa709ad..d9023987a5f 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java @@ -53,11 +53,11 @@ import org.elasticsearch.action.support.master.AcknowledgedRequest; import org.elasticsearch.action.support.master.MasterNodeReadRequest; import org.elasticsearch.action.support.master.MasterNodeRequest; import org.elasticsearch.action.support.replication.ReplicationRequest; -import org.elasticsearch.client.core.MultiTermVectorsRequest; -import org.elasticsearch.client.core.TermVectorsRequest; import org.elasticsearch.action.update.UpdateRequest; import org.elasticsearch.client.RequestConverters.EndpointBuilder; import org.elasticsearch.client.core.CountRequest; +import org.elasticsearch.client.core.MultiTermVectorsRequest; +import org.elasticsearch.client.core.TermVectorsRequest; import org.elasticsearch.common.CheckedBiConsumer; import org.elasticsearch.common.Strings; import org.elasticsearch.common.bytes.BytesArray; @@ -1266,9 +1266,9 @@ public class RequestConvertersTests extends ESTestCase { public void testTermVectors() throws IOException { String index = randomAlphaOfLengthBetween(3, 10); - String type = randomAlphaOfLengthBetween(3, 10); String id = randomAlphaOfLengthBetween(3, 10); - TermVectorsRequest tvRequest = new TermVectorsRequest(index, type, id); + + TermVectorsRequest tvRequest = new TermVectorsRequest(index, id); Map expectedParams = new HashMap<>(); String[] fields; if (randomBoolean()) { @@ -1289,7 +1289,7 @@ public class RequestConvertersTests extends ESTestCase { Request request = RequestConverters.termVectors(tvRequest); StringJoiner endpoint = new StringJoiner("/", "/", ""); - endpoint.add(index).add(type).add(id).add("_termvectors"); + endpoint.add(index).add("_termvectors").add(id); assertEquals(HttpGet.METHOD_NAME, request.getMethod()); assertEquals(endpoint.toString(), request.getEndpoint()); @@ -1304,13 +1304,27 @@ public class RequestConvertersTests extends ESTestCase { assertToXContentBody(tvRequest, request.getEntity()); } + public void testTermVectorsWithType() throws IOException { + String index = randomAlphaOfLengthBetween(3, 10); + String type = randomAlphaOfLengthBetween(3, 10); + String id = randomAlphaOfLengthBetween(3, 10); + TermVectorsRequest tvRequest = new TermVectorsRequest(index, type, id); + + Request request = RequestConverters.termVectors(tvRequest); + StringJoiner endpoint = new StringJoiner("/", "/", ""); + endpoint.add(index).add(type).add(id).add("_termvectors"); + + assertEquals(HttpGet.METHOD_NAME, request.getMethod()); + assertEquals(endpoint.toString(), request.getEndpoint()); + } + public void testMultiTermVectors() throws IOException { MultiTermVectorsRequest mtvRequest = new MultiTermVectorsRequest(); int numberOfRequests = randomIntBetween(0, 5); for (int i = 0; i < numberOfRequests; i++) { String index = randomAlphaOfLengthBetween(3, 10); - String type = randomAlphaOfLengthBetween(3, 10); + String type = randomBoolean() ? null : randomAlphaOfLengthBetween(3, 10); String id = randomAlphaOfLengthBetween(3, 10); TermVectorsRequest tvRequest = new TermVectorsRequest(index, type, id); String[] fields = generateRandomStringArray(10, 5, false, false); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java index de315dd14b0..4fc7fd21a39 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java @@ -1558,18 +1558,16 @@ public class CRUDDocumentationIT extends ESRestHighLevelClientTestCase { { // tag::term-vectors-request - TermVectorsRequest request = new TermVectorsRequest("authors", "_doc", "1"); + TermVectorsRequest request = new TermVectorsRequest("authors", "1"); request.setFields("user"); // end::term-vectors-request } { // tag::term-vectors-request-artificial - XContentBuilder docBuilder = XContentFactory.jsonBuilder(); docBuilder.startObject().field("user", "guest-user").endObject(); TermVectorsRequest request = new TermVectorsRequest("authors", - "_doc", docBuilder); // <1> // end::term-vectors-request-artificial @@ -1600,7 +1598,7 @@ public class CRUDDocumentationIT extends ESRestHighLevelClientTestCase { // end::term-vectors-request-optional-arguments } - TermVectorsRequest request = new TermVectorsRequest("authors", "_doc", "1"); + TermVectorsRequest request = new TermVectorsRequest("authors", "1"); request.setFields("user"); // tag::term-vectors-execute @@ -1687,21 +1685,21 @@ public class CRUDDocumentationIT extends ESRestHighLevelClientTestCase { // tag::multi-term-vectors-request MultiTermVectorsRequest request = new MultiTermVectorsRequest(); // <1> TermVectorsRequest tvrequest1 = - new TermVectorsRequest("authors", "_doc", "1"); + new TermVectorsRequest("authors", "1"); tvrequest1.setFields("user"); request.add(tvrequest1); // <2> XContentBuilder docBuilder = XContentFactory.jsonBuilder(); docBuilder.startObject().field("user", "guest-user").endObject(); TermVectorsRequest tvrequest2 = - new TermVectorsRequest("authors", "_doc", docBuilder); + new TermVectorsRequest("authors", docBuilder); request.add(tvrequest2); // <3> // end::multi-term-vectors-request } // tag::multi-term-vectors-request-template TermVectorsRequest tvrequestTemplate = - new TermVectorsRequest("authors", "_doc", "fake_id"); // <1> + new TermVectorsRequest("authors", "fake_id"); // <1> tvrequestTemplate.setFields("user"); String[] ids = {"1", "2"}; MultiTermVectorsRequest request = diff --git a/distribution/docker/build.gradle b/distribution/docker/build.gradle new file mode 100644 index 00000000000..84a80815ac2 --- /dev/null +++ b/distribution/docker/build.gradle @@ -0,0 +1,106 @@ +import org.elasticsearch.gradle.BuildPlugin +import org.elasticsearch.gradle.LoggedExec +import org.elasticsearch.gradle.MavenFilteringHack +import org.elasticsearch.gradle.VersionProperties + +apply plugin: 'base' + +configurations { + dockerPlugins + dockerSource + ossDockerSource +} + +dependencies { + dockerPlugins project(path: ":plugins:ingest-geoip", configuration: 'zip') + dockerPlugins project(path: ":plugins:ingest-user-agent", configuration: 'zip') + dockerSource project(path: ":distribution:archives:tar") + ossDockerSource project(path: ":distribution:archives:oss-tar") +} + +ext.expansions = { oss -> + return [ + 'elasticsearch' : oss ? "elasticsearch-oss-${VersionProperties.elasticsearch}.tar.gz" : "elasticsearch-${VersionProperties.elasticsearch}.tar.gz", + 'jdkUrl' : 'https://download.java.net/java/GA/jdk11/13/GPL/openjdk-11.0.1_linux-x64_bin.tar.gz', + 'jdkVersion' : '11.0.1', + 'license': oss ? 'Apache-2.0' : 'Elastic License', + 'ingest-geoip' : "ingest-geoip-${VersionProperties.elasticsearch}.zip", + 'ingest-user-agent' : "ingest-user-agent-${VersionProperties.elasticsearch}.zip", + 'version' : VersionProperties.elasticsearch + ] +} + +private static String files(final boolean oss) { + return "build/${ oss ? 'oss-' : ''}docker" +} + +private static String taskName(final String prefix, final boolean oss, final String suffix) { + return "${prefix}${oss ? 'Oss' : ''}${suffix}" +} + +void addCopyDockerContextTask(final boolean oss) { + task(taskName("copy", oss, "DockerContext"), type: Sync) { + into files(oss) + + into('bin') { + from 'src/docker/bin' + } + + into('config') { + from 'src/docker/config' + } + + if (oss) { + from configurations.ossDockerSource + } else { + from configurations.dockerSource + } + + from configurations.dockerPlugins + } +} + +void addCopyDockerfileTask(final boolean oss) { + task(taskName("copy", oss, "Dockerfile"), type: Copy) { + mustRunAfter(taskName("copy", oss, "DockerContext")) + into files(oss) + + from('src/docker/Dockerfile') { + MavenFilteringHack.filter(it, expansions(oss)) + } + } +} + +void addBuildDockerImage(final boolean oss) { + final Task buildDockerImageTask = task(taskName("build", oss, "DockerImage"), type: LoggedExec) { + dependsOn taskName("copy", oss, "DockerContext") + dependsOn taskName("copy", oss, "Dockerfile") + List tags + if (oss) { + tags = [ "docker.elastic.co/elasticsearch/elasticsearch-oss:${VersionProperties.elasticsearch}" ] + } else { + tags = [ + "elasticsearch:${VersionProperties.elasticsearch}", + "docker.elastic.co/elasticsearch/elasticsearch:${VersionProperties.elasticsearch}", + "docker.elastic.co/elasticsearch/elasticsearch-full:${VersionProperties.elasticsearch}" + ] + } + executable 'docker' + final List dockerArgs = ['build', files(oss), '--pull'] + for (final String tag : tags) { + dockerArgs.add('--tag') + dockerArgs.add(tag) + } + args dockerArgs.toArray() + } + BuildPlugin.requireDocker(buildDockerImageTask) +} + +for (final boolean oss : [false, true]) { + addCopyDockerContextTask(oss) + addCopyDockerfileTask(oss) + addBuildDockerImage(oss) +} + +assemble.dependsOn "buildOssDockerImage" +assemble.dependsOn "buildDockerImage" diff --git a/distribution/docker/src/docker/Dockerfile b/distribution/docker/src/docker/Dockerfile new file mode 100644 index 00000000000..cdc8591dc30 --- /dev/null +++ b/distribution/docker/src/docker/Dockerfile @@ -0,0 +1,92 @@ +################################################################################ +# This Dockerfile was generated from the template at distribution/src/docker/Dockerfile +# +# Beginning of multi stage Dockerfile +################################################################################ + +################################################################################ +# Build stage 0 `builder`: +# Extract elasticsearch artifact +# Install required plugins +# Set gid=0 and make group perms==owner perms +################################################################################ + +FROM centos:7 AS builder + +ENV PATH /usr/share/elasticsearch/bin:$PATH +ENV JAVA_HOME /opt/jdk-${jdkVersion} + +RUN curl -s ${jdkUrl} | tar -C /opt -zxf - + +# Replace OpenJDK's built-in CA certificate keystore with the one from the OS +# vendor. The latter is superior in several ways. +# REF: https://github.com/elastic/elasticsearch-docker/issues/171 +RUN ln -sf /etc/pki/ca-trust/extracted/java/cacerts /opt/jdk-${jdkVersion}/lib/security/cacerts + +RUN yum install -y unzip which + +RUN groupadd -g 1000 elasticsearch && \ + adduser -u 1000 -g 1000 -d /usr/share/elasticsearch elasticsearch + +WORKDIR /usr/share/elasticsearch + +COPY ${elasticsearch} ${ingest-geoip} ${ingest-user-agent} /opt/ +RUN tar zxf /opt/${elasticsearch} --strip-components=1 +RUN elasticsearch-plugin install --batch file:///opt/${ingest-geoip} +RUN elasticsearch-plugin install --batch file:///opt/${ingest-user-agent} +RUN mkdir -p config data logs +RUN chmod 0775 config data logs +COPY config/elasticsearch.yml config/log4j2.properties config/ + + +################################################################################ +# Build stage 1 (the actual elasticsearch image): +# Copy elasticsearch from stage 0 +# Add entrypoint +################################################################################ + +FROM centos:7 + +ENV ELASTIC_CONTAINER true +ENV JAVA_HOME /opt/jdk-${jdkVersion} + +COPY --from=builder /opt/jdk-${jdkVersion} /opt/jdk-${jdkVersion} + +RUN yum update -y && \ + yum install -y nc unzip wget which && \ + yum clean all + +RUN groupadd -g 1000 elasticsearch && \ + adduser -u 1000 -g 1000 -G 0 -d /usr/share/elasticsearch elasticsearch && \ + chmod 0775 /usr/share/elasticsearch && \ + chgrp 0 /usr/share/elasticsearch + +WORKDIR /usr/share/elasticsearch +COPY --from=builder --chown=1000:0 /usr/share/elasticsearch /usr/share/elasticsearch +ENV PATH /usr/share/elasticsearch/bin:$PATH + +COPY --chown=1000:0 bin/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh + +# Openshift overrides USER and uses ones with randomly uid>1024 and gid=0 +# Allow ENTRYPOINT (and ES) to run even with a different user +RUN chgrp 0 /usr/local/bin/docker-entrypoint.sh && \ + chmod g=u /etc/passwd && \ + chmod 0775 /usr/local/bin/docker-entrypoint.sh + +EXPOSE 9200 9300 + +LABEL org.label-schema.schema-version="1.0" \ + org.label-schema.vendor="Elastic" \ + org.label-schema.name="elasticsearch" \ + org.label-schema.version="${version}" \ + org.label-schema.url="https://www.elastic.co/products/elasticsearch" \ + org.label-schema.vcs-url="https://github.com/elastic/elasticsearch" \ + license="${license}" + +ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] +# Dummy overridable parameter parsed by entrypoint +CMD ["eswrapper"] + +################################################################################ +# End of multi-stage Dockerfile +################################################################################ diff --git a/distribution/docker/src/docker/bin/docker-entrypoint.sh b/distribution/docker/src/docker/bin/docker-entrypoint.sh new file mode 100644 index 00000000000..3158aaedae1 --- /dev/null +++ b/distribution/docker/src/docker/bin/docker-entrypoint.sh @@ -0,0 +1,100 @@ +#!/bin/bash +set -e + +# Files created by Elasticsearch should always be group writable too +umask 0002 + +run_as_other_user_if_needed() { + if [[ "$(id -u)" == "0" ]]; then + # If running as root, drop to specified UID and run command + exec chroot --userspec=1000 / "${@}" + else + # Either we are running in Openshift with random uid and are a member of the root group + # or with a custom --user + exec "${@}" + fi +} + +# Allow user specify custom CMD, maybe bin/elasticsearch itself +# for example to directly specify `-E` style parameters for elasticsearch on k8s +# or simply to run /bin/bash to check the image +if [[ "$1" != "eswrapper" ]]; then + if [[ "$(id -u)" == "0" && $(basename "$1") == "elasticsearch" ]]; then + # centos:7 chroot doesn't have the `--skip-chdir` option and + # changes our CWD. + # Rewrite CMD args to replace $1 with `elasticsearch` explicitly, + # so that we are backwards compatible with the docs + # from the previous Elasticsearch versions<6 + # and configuration option D: + # https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docker.html#_d_override_the_image_8217_s_default_ulink_url_https_docs_docker_com_engine_reference_run_cmd_default_command_or_options_cmd_ulink + # Without this, user could specify `elasticsearch -E x.y=z` but + # `bin/elasticsearch -E x.y=z` would not work. + set -- "elasticsearch" "${@:2}" + # Use chroot to switch to UID 1000 + exec chroot --userspec=1000 / "$@" + else + # User probably wants to run something else, like /bin/bash, with another uid forced (Openshift?) + exec "$@" + fi +fi + +# Parse Docker env vars to customize Elasticsearch +# +# e.g. Setting the env var cluster.name=testcluster +# +# will cause Elasticsearch to be invoked with -Ecluster.name=testcluster +# +# see https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html#_setting_default_settings + +declare -a es_opts + +while IFS='=' read -r envvar_key envvar_value +do + # Elasticsearch settings need to have at least two dot separated lowercase + # words, e.g. `cluster.name`, except for `processors` which we handle + # specially + if [[ "$envvar_key" =~ ^[a-z0-9_]+\.[a-z0-9_]+ || "$envvar_key" == "processors" ]]; then + if [[ ! -z $envvar_value ]]; then + es_opt="-E${envvar_key}=${envvar_value}" + es_opts+=("${es_opt}") + fi + fi +done < <(env) + +# The virtual file /proc/self/cgroup should list the current cgroup +# membership. For each hierarchy, you can follow the cgroup path from +# this file to the cgroup filesystem (usually /sys/fs/cgroup/) and +# introspect the statistics for the cgroup for the given +# hierarchy. Alas, Docker breaks this by mounting the container +# statistics at the root while leaving the cgroup paths as the actual +# paths. Therefore, Elasticsearch provides a mechanism to override +# reading the cgroup path from /proc/self/cgroup and instead uses the +# cgroup path defined the JVM system property +# es.cgroups.hierarchy.override. Therefore, we set this value here so +# that cgroup statistics are available for the container this process +# will run in. +export ES_JAVA_OPTS="-Des.cgroups.hierarchy.override=/ $ES_JAVA_OPTS" + +if [[ -d bin/x-pack ]]; then + # Check for the ELASTIC_PASSWORD environment variable to set the + # bootstrap password for Security. + # + # This is only required for the first node in a cluster with Security + # enabled, but we have no way of knowing which node we are yet. We'll just + # honor the variable if it's present. + if [[ -n "$ELASTIC_PASSWORD" ]]; then + [[ -f /usr/share/elasticsearch/config/elasticsearch.keystore ]] || (run_as_other_user_if_needed elasticsearch-keystore create) + if ! (run_as_other_user_if_needed elasticsearch-keystore list | grep -q '^bootstrap.password$'); then + (run_as_other_user_if_needed echo "$ELASTIC_PASSWORD" | elasticsearch-keystore add -x 'bootstrap.password') + fi + fi +fi + +if [[ "$(id -u)" == "0" ]]; then + # If requested and running as root, mutate the ownership of bind-mounts + if [[ -n "$TAKE_FILE_OWNERSHIP" ]]; then + chown -R 1000:0 /usr/share/elasticsearch/{data,logs} + fi +fi + +run_as_other_user_if_needed /usr/share/elasticsearch/bin/elasticsearch "${es_opts[@]}" diff --git a/distribution/docker/src/docker/config/elasticsearch.yml b/distribution/docker/src/docker/config/elasticsearch.yml new file mode 100644 index 00000000000..50b154702b9 --- /dev/null +++ b/distribution/docker/src/docker/config/elasticsearch.yml @@ -0,0 +1,2 @@ +cluster.name: "docker-cluster" +network.host: 0.0.0.0 diff --git a/distribution/docker/src/docker/config/log4j2.properties b/distribution/docker/src/docker/config/log4j2.properties new file mode 100644 index 00000000000..9ad290ad826 --- /dev/null +++ b/distribution/docker/src/docker/config/log4j2.properties @@ -0,0 +1,9 @@ +status = error + +appender.console.type = Console +appender.console.name = console +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n + +rootLogger.level = info +rootLogger.appenderRef.console.ref = console diff --git a/docs/java-rest/high-level/document/multi-term-vectors.asciidoc b/docs/java-rest/high-level/document/multi-term-vectors.asciidoc index d2c4666130b..52d633b2d59 100644 --- a/docs/java-rest/high-level/document/multi-term-vectors.asciidoc +++ b/docs/java-rest/high-level/document/multi-term-vectors.asciidoc @@ -27,7 +27,7 @@ include-tagged::{doc-tests-file}[{api}-request] The second way can be used when all term vectors requests share the same -arguments, such as index, type, and other settings. In this case, a template +arguments, such as index and other settings. In this case, a template +{tvrequest}+ can be created with all necessary settings set, and this template request can be passed to +{request}+ along with all documents' ids for which to execute these requests. diff --git a/docs/reference/ccr/requirements.asciidoc b/docs/reference/ccr/requirements.asciidoc index 57f3f59eb35..14ac66a8b9c 100644 --- a/docs/reference/ccr/requirements.asciidoc +++ b/docs/reference/ccr/requirements.asciidoc @@ -42,4 +42,26 @@ The number of soft deletes to retain. Soft deletes are collected during merges on the underlying Lucene index yet retained up to the number of operations configured by this setting. The default value is `0`. -For more information about index settings, see {ref}/index-modules.html[Index modules]. \ No newline at end of file +For more information about index settings, see {ref}/index-modules.html[Index modules]. + +[float] +[[ccr-overview-beats]] +==== Setting soft deletes on indices created by APM Server or Beats + +If you want to replicate indices created by APM Server or Beats, and are +allowing APM Server or Beats to manage index templates, you need to enable +soft deletes on the underlying index templates. To enable soft deletes on the +underlying index templates, add the following changes to the relevant APM Server +or Beats configuration file. + +["source","yaml"] +---------------------------------------------------------------------- +setup.template.overwrite: true +setup.template.settings: + index.soft_deletes.enabled: true + index.soft_deletes.retention.operations: 1024 +---------------------------------------------------------------------- + +For additional information on controlling the index templates managed by APM +Server or Beats, see the relevant documentation on loading the Elasticsearch +index template. diff --git a/docs/reference/docs/multi-termvectors.asciidoc b/docs/reference/docs/multi-termvectors.asciidoc index 3e87d1d3c97..6d947d2d403 100644 --- a/docs/reference/docs/multi-termvectors.asciidoc +++ b/docs/reference/docs/multi-termvectors.asciidoc @@ -2,8 +2,8 @@ == Multi termvectors API Multi termvectors API allows to get multiple termvectors at once. The -documents from which to retrieve the term vectors are specified by an index, -type and id. But the documents could also be artificially provided in the request itself. +documents from which to retrieve the term vectors are specified by an index and id. +But the documents could also be artificially provided in the request itself. The response includes a `docs` array with all the fetched termvectors, each element having the structure @@ -17,13 +17,11 @@ POST /_mtermvectors "docs": [ { "_index": "twitter", - "_type": "_doc", "_id": "2", "term_statistics": true }, { "_index": "twitter", - "_type": "_doc", "_id": "1", "fields": [ "message" @@ -43,31 +41,6 @@ is not required in the body): [source,js] -------------------------------------------------- POST /twitter/_mtermvectors -{ - "docs": [ - { - "_type": "_doc", - "_id": "2", - "fields": [ - "message" - ], - "term_statistics": true - }, - { - "_type": "_doc", - "_id": "1" - } - ] -} --------------------------------------------------- -// CONSOLE -// TEST[setup:twitter] - -And type: - -[source,js] --------------------------------------------------- -POST /twitter/_doc/_mtermvectors { "docs": [ { @@ -86,11 +59,11 @@ POST /twitter/_doc/_mtermvectors // CONSOLE // TEST[setup:twitter] -If all requested documents are on same index and have same type and also the parameters are the same, the request can be simplified: +If all requested documents are on same index and also the parameters are the same, the request can be simplified: [source,js] -------------------------------------------------- -POST /twitter/_doc/_mtermvectors +POST /twitter/_mtermvectors { "ids" : ["1", "2"], "parameters": { @@ -105,8 +78,8 @@ POST /twitter/_doc/_mtermvectors // TEST[setup:twitter] Additionally, just like for the <> -API, term vectors could be generated for user provided documents. The mapping used is -determined by `_index` and `_type`. +API, term vectors could be generated for user provided documents. +The mapping used is determined by `_index`. [source,js] -------------------------------------------------- @@ -115,7 +88,6 @@ POST /_mtermvectors "docs": [ { "_index": "twitter", - "_type": "_doc", "doc" : { "user" : "John Doe", "message" : "twitter test test test" @@ -123,7 +95,6 @@ POST /_mtermvectors }, { "_index": "twitter", - "_type": "_doc", "doc" : { "user" : "Jane Doe", "message" : "Another twitter test ..." diff --git a/docs/reference/docs/termvectors.asciidoc b/docs/reference/docs/termvectors.asciidoc index 11de3e5a27f..9ef08a7e774 100644 --- a/docs/reference/docs/termvectors.asciidoc +++ b/docs/reference/docs/termvectors.asciidoc @@ -8,7 +8,7 @@ realtime. This can be changed by setting `realtime` parameter to `false`. [source,js] -------------------------------------------------- -GET /twitter/_doc/1/_termvectors +GET /twitter/_termvectors/1 -------------------------------------------------- // CONSOLE // TEST[setup:twitter] @@ -18,7 +18,7 @@ retrieved either with a parameter in the url [source,js] -------------------------------------------------- -GET /twitter/_doc/1/_termvectors?fields=message +GET /twitter/_termvectors/1?fields=message -------------------------------------------------- // CONSOLE // TEST[setup:twitter] @@ -189,7 +189,7 @@ The following request returns all information and statistics for field [source,js] -------------------------------------------------- -GET /twitter/_doc/1/_termvectors +GET /twitter/_termvectors/1 { "fields" : ["text"], "offsets" : true, @@ -277,7 +277,7 @@ Note that for the field `text`, the terms are not re-generated. [source,js] -------------------------------------------------- -GET /twitter/_doc/1/_termvectors +GET /twitter/_termvectors/1 { "fields" : ["text", "some_field_without_term_vectors"], "offsets" : true, @@ -295,15 +295,14 @@ GET /twitter/_doc/1/_termvectors Term vectors can also be generated for artificial documents, that is for documents not present in the index. For example, the following request would -return the same results as in example 1. The mapping used is determined by the -`index` and `type`. +return the same results as in example 1. The mapping used is determined by the `index`. *If dynamic mapping is turned on (default), the document fields not in the original mapping will be dynamically created.* [source,js] -------------------------------------------------- -GET /twitter/_doc/_termvectors +GET /twitter/_termvectors { "doc" : { "fullname" : "John Doe", @@ -326,7 +325,7 @@ vectors, the term vectors will be re-generated. [source,js] -------------------------------------------------- -GET /twitter/_doc/_termvectors +GET /twitter/_termvectors { "doc" : { "fullname" : "John Doe", @@ -393,7 +392,7 @@ their tf-idf must be too low. [source,js] -------------------------------------------------- -GET /imdb/_doc/_termvectors +GET /imdb/_termvectors { "doc": { "plot": "When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil." diff --git a/docs/reference/getting-started.asciidoc b/docs/reference/getting-started.asciidoc index 382d881a46e..a0466290696 100755 --- a/docs/reference/getting-started.asciidoc +++ b/docs/reference/getting-started.asciidoc @@ -16,6 +16,7 @@ Here are a few sample use-cases that Elasticsearch could be used for: For the rest of this tutorial, you will be guided through the process of getting Elasticsearch up and running, taking a peek inside it, and performing basic operations like indexing, searching, and modifying your data. At the end of this tutorial, you should have a good idea of what Elasticsearch is, how it works, and hopefully be inspired to see how you can use it to either build sophisticated search applications or to mine intelligence from your data. -- +[[getting-started-concepts]] == Basic Concepts There are a few concepts that are core to Elasticsearch. Understanding these concepts from the outset will tremendously help ease the learning process. @@ -103,6 +104,7 @@ You can monitor shard sizes using the {ref}/cat-shards.html[`_cat/shards`] API. With that out of the way, let's get started with the fun part... +[[getting-started-install]] == Installation [TIP] @@ -266,6 +268,7 @@ As mentioned previously, we can override either the cluster or node name. This c Also note the line marked http with information about the HTTP address (`192.168.8.112`) and port (`9200`) that our node is reachable from. By default, Elasticsearch uses port `9200` to provide access to its REST API. This port is configurable if necessary. +[[getting-started-explore]] == Exploring Your Cluster [float] @@ -278,6 +281,7 @@ Now that we have our node (and cluster) up and running, the next step is to unde * Perform CRUD (Create, Read, Update, and Delete) and search operations against your indexes * Execute advanced search operations such as paging, sorting, filtering, scripting, aggregations, and many others +[[getting-started-cluster-health]] === Cluster Health Let's start with a basic health check, which we can use to see how our cluster is doing. We'll be using curl to do this but you can use any tool that allows you to make HTTP/REST calls. Let's assume that we are still on the same node where we started Elasticsearch on and open another command shell window. @@ -336,6 +340,7 @@ ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master Here, we can see our one node named "PB2SGZY", which is the single node that is currently in our cluster. +[[getting-started-list-indices]] === List All Indices Now let's take a peek at our indices: @@ -356,6 +361,7 @@ health status index uuid pri rep docs.count docs.deleted store.size pri.store.si Which simply means we have no indices yet in the cluster. +[[getting-started-create-index]] === Create an Index Now let's create an index named "customer" and then list all the indexes again: @@ -382,6 +388,7 @@ The results of the second command tells us that we now have one index named cust You might also notice that the customer index has a yellow health tagged to it. Recall from our previous discussion that yellow means that some replicas are not (yet) allocated. The reason this happens for this index is because Elasticsearch by default created one replica for this index. Since we only have one node running at the moment, that one replica cannot yet be allocated (for high availability) until a later point in time when another node joins the cluster. Once that replica gets allocated onto a second node, the health status for this index will turn to green. +[[getting-started-query-document]] === Index and Query a Document Let's now put something into our customer index. We'll index a simple customer document into the customer index, with an ID of 1 as follows: @@ -446,6 +453,7 @@ And the response: Nothing out of the ordinary here other than a field, `found`, stating that we found a document with the requested ID 1 and another field, `_source`, which returns the full JSON document that we indexed from the previous step. +[[getting-started-delete-index]] === Delete an Index Now let's delete the index that we just created and then list all the indexes again: @@ -492,6 +500,7 @@ If we study the above commands carefully, we can actually see a pattern of how w This REST access pattern is so pervasive throughout all the API commands that if you can simply remember it, you will have a good head start at mastering Elasticsearch. +[[getting-started-modify-data]] == Modifying Your Data Elasticsearch provides data manipulation and search capabilities in near real time. By default, you can expect a one second delay (refresh interval) from the time you index/update/delete your data until the time that it appears in your search results. This is an important distinction from other platforms like SQL wherein data is immediately available after a transaction is completed. @@ -552,6 +561,7 @@ POST /customer/_doc?pretty Note that in the above case, we are using the `POST` verb instead of PUT since we didn't specify an ID. +[[getting-started-update-documents]] === Updating Documents In addition to being able to index and replace documents, we can also update documents. Note though that Elasticsearch does not actually do in-place updates under the hood. Whenever we do an update, Elasticsearch deletes the old document and then indexes a new document with the update applied to it in one shot. @@ -596,6 +606,7 @@ In the above example, `ctx._source` refers to the current source document that i Elasticsearch provides the ability to update multiple documents given a query condition (like an `SQL UPDATE-WHERE` statement). See {ref}/docs-update-by-query.html[`docs-update-by-query` API] +[[getting-started-delete-documents]] === Deleting Documents Deleting a document is fairly straightforward. This example shows how to delete our previous customer with the ID of 2: @@ -611,6 +622,7 @@ See the {ref}/docs-delete-by-query.html[`_delete_by_query` API] to delete all do It is worth noting that it is much more efficient to delete a whole index instead of deleting all documents with the Delete By Query API. +[[getting-started-batch-processing]] === Batch Processing In addition to being able to index, update, and delete individual documents, Elasticsearch also provides the ability to perform any of the above operations in batches using the {ref}/docs-bulk.html[`_bulk` API]. This functionality is important in that it provides a very efficient mechanism to do multiple operations as fast as possible with as few network roundtrips as possible. @@ -643,6 +655,7 @@ Note above that for the delete action, there is no corresponding source document The Bulk API does not fail due to failures in one of the actions. If a single action fails for whatever reason, it will continue to process the remainder of the actions after it. When the bulk API returns, it will provide a status for each action (in the same order it was sent in) so that you can check if a specific action failed or not. +[[getting-started-explore-data]] == Exploring Your Data [float] @@ -706,6 +719,7 @@ yellow open bank l7sSYV2cQXmu6_4rJWVIww 5 1 1000 0 12 Which means that we just successfully bulk indexed 1000 documents into the bank index (under the `_doc` type). +[[getting-started-search-API]] === The Search API Now let's start with some simple searches. There are two basic ways to run searches: one is by sending search parameters through the {ref}/search-uri-request.html[REST request URI] and the other by sending them through the {ref}/search-request-body.html[REST request body]. The request body method allows you to be more expressive and also to define your searches in a more readable JSON format. We'll try one example of the request URI method but for the remainder of this tutorial, we will exclusively be using the request body method. @@ -843,6 +857,7 @@ to clutter the docs with it: It is important to understand that once you get your search results back, Elasticsearch is completely done with the request and does not maintain any kind of server-side resources or open cursors into your results. This is in stark contrast to many other platforms such as SQL wherein you may initially get a partial subset of your query results up-front and then you have to continuously go back to the server if you want to fetch (or page through) the rest of the results using some kind of stateful server-side cursor. +[[getting-started-query-lang]] === Introducing the Query Language Elasticsearch provides a JSON-style domain-specific language that you can use to execute queries. This is referred to as the {ref}/query-dsl.html[Query DSL]. The query language is quite comprehensive and can be intimidating at first glance but the best way to actually learn it is to start with a few basic examples. @@ -907,6 +922,7 @@ GET /bank/_search // CONSOLE // TEST[continued] +[[getting-started-search]] === Executing Searches Now that we have seen a few of the basic search parameters, let's dig in some more into the Query DSL. Let's first take a look at the returned document fields. By default, the full JSON document is returned as part of all searches. This is referred to as the source (`_source` field in the search hits). If we don't want the entire source document returned, we have the ability to request only a few fields from within source to be returned. @@ -1066,6 +1082,7 @@ GET /bank/_search // CONSOLE // TEST[continued] +[[getting-started-filters]] === Executing Filters In the previous section, we skipped over a little detail called the document score (`_score` field in the search results). The score is a numeric value that is a relative measure of how well the document matches the search query that we specified. The higher the score, the more relevant the document is, the lower the score, the less relevant the document is. @@ -1102,6 +1119,7 @@ Dissecting the above, the bool query contains a `match_all` query (the query par In addition to the `match_all`, `match`, `bool`, and `range` queries, there are a lot of other query types that are available and we won't go into them here. Since we already have a basic understanding of how they work, it shouldn't be too difficult to apply this knowledge in learning and experimenting with the other query types. +[[getting-started-aggregations]] === Executing Aggregations Aggregations provide the ability to group and extract statistics from your data. The easiest way to think about aggregations is by roughly equating it to the SQL GROUP BY and the SQL aggregate functions. In Elasticsearch, you have the ability to execute searches returning hits and at the same time return aggregated results separate from the hits all in one response. This is very powerful and efficient in the sense that you can run queries and multiple aggregations and get the results back of both (or either) operations in one shot avoiding network roundtrips using a concise and simplified API. @@ -1305,6 +1323,7 @@ GET /bank/_search There are many other aggregations capabilities that we won't go into detail here. The {ref}/search-aggregations.html[aggregations reference guide] is a great starting point if you want to do further experimentation. +[[getting-started-conclusion]] == Conclusion Elasticsearch is both a simple and complex product. We've so far learned the basics of what it is, how to look inside of it, and how to work with it using some of the REST APIs. Hopefully this tutorial has given you a better understanding of what Elasticsearch is and more importantly, inspired you to further experiment with the rest of its great features! diff --git a/docs/reference/ilm/policy-definitions.asciidoc b/docs/reference/ilm/policy-definitions.asciidoc index 7b7008d613f..9b674689e7a 100644 --- a/docs/reference/ilm/policy-definitions.asciidoc +++ b/docs/reference/ilm/policy-definitions.asciidoc @@ -74,6 +74,19 @@ relative to when data was written last to a rolled over index. The previous phase's actions must complete before {ILM} will check `min_age` and transition into the next phase. +=== Phase Execution + +beta[] + +The current phase definition, of an index's policy being executed, is stored +in the index's metadata. The phase and its actions are compiled into a series +of discrete steps that are executed sequentially. Since some {ILM} actions are +more complex and involve multiple operations against an index, each of these +operations are done in isolation in a unit called a "step". The +<> exposes this information to us +to see which step our index is either to execute next, or is currently +executing. + === Actions beta[] diff --git a/docs/reference/migration/migrate_7_0/indices.asciidoc b/docs/reference/migration/migrate_7_0/indices.asciidoc index 634a00e1f44..e977652693d 100644 --- a/docs/reference/migration/migrate_7_0/indices.asciidoc +++ b/docs/reference/migration/migrate_7_0/indices.asciidoc @@ -2,6 +2,11 @@ [[breaking_70_indices_changes]] === Indices changes +[float] +==== Index creation no longer defaults to five shards +Previous versions of Elasticsearch defaulted to creating five shards per index. +Starting with 7.0.0, the default is now one shard per index. + [float] ==== `:` is no longer allowed in index name diff --git a/docs/reference/modules/node.asciidoc b/docs/reference/modules/node.asciidoc index 2d0cee85e29..9287e171129 100644 --- a/docs/reference/modules/node.asciidoc +++ b/docs/reference/modules/node.asciidoc @@ -165,7 +165,7 @@ PUT _cluster/settings } ---------------------------- // CONSOLE -// TEST[catch:/cannot set discovery.zen.minimum_master_nodes to more than the current master nodes/] +// TEST[skip:Test use Zen2 now so we can't test Zen1 behaviour here] TIP: An advantage of splitting the master and data roles between dedicated nodes is that you can have just three master-eligible nodes and set diff --git a/libs/nio/src/main/java/org/elasticsearch/nio/BytesChannelContext.java b/libs/nio/src/main/java/org/elasticsearch/nio/BytesChannelContext.java index 9984f1a18e5..8b174eac468 100644 --- a/libs/nio/src/main/java/org/elasticsearch/nio/BytesChannelContext.java +++ b/libs/nio/src/main/java/org/elasticsearch/nio/BytesChannelContext.java @@ -38,19 +38,12 @@ public class BytesChannelContext extends SocketChannelContext { @Override public int read() throws IOException { - if (channelBuffer.getRemaining() == 0) { - // Requiring one additional byte will ensure that a new page is allocated. - channelBuffer.ensureCapacity(channelBuffer.getCapacity() + 1); - } - - int bytesRead = readFromChannel(channelBuffer.sliceBuffersFrom(channelBuffer.getIndex())); + int bytesRead = readFromChannel(channelBuffer); if (bytesRead == 0) { return 0; } - channelBuffer.incrementIndex(bytesRead); - handleReadBytes(); return bytesRead; @@ -91,8 +84,7 @@ public class BytesChannelContext extends SocketChannelContext { * Returns a boolean indicating if the operation was fully flushed. */ private boolean singleFlush(FlushOperation flushOperation) throws IOException { - int written = flushToChannel(flushOperation.getBuffersToWrite()); - flushOperation.incrementIndex(written); + flushToChannel(flushOperation); return flushOperation.isFullyFlushed(); } } diff --git a/libs/nio/src/main/java/org/elasticsearch/nio/NioSelector.java b/libs/nio/src/main/java/org/elasticsearch/nio/NioSelector.java index 9f82cc2c50d..6820b6a0718 100644 --- a/libs/nio/src/main/java/org/elasticsearch/nio/NioSelector.java +++ b/libs/nio/src/main/java/org/elasticsearch/nio/NioSelector.java @@ -21,6 +21,7 @@ package org.elasticsearch.nio; import java.io.Closeable; import java.io.IOException; +import java.nio.ByteBuffer; import java.nio.channels.CancelledKeyException; import java.nio.channels.ClosedChannelException; import java.nio.channels.ClosedSelectorException; @@ -51,6 +52,7 @@ public class NioSelector implements Closeable { private final ConcurrentLinkedQueue> channelsToRegister = new ConcurrentLinkedQueue<>(); private final EventHandler eventHandler; private final Selector selector; + private final ByteBuffer ioBuffer; private final ReentrantLock runLock = new ReentrantLock(); private final CountDownLatch exitedLoop = new CountDownLatch(1); @@ -65,6 +67,18 @@ public class NioSelector implements Closeable { public NioSelector(EventHandler eventHandler, Selector selector) { this.selector = selector; this.eventHandler = eventHandler; + this.ioBuffer = ByteBuffer.allocateDirect(1 << 16); + } + + /** + * Returns a cached direct byte buffer for network operations. It is cleared on every get call. + * + * @return the byte buffer + */ + public ByteBuffer getIoBuffer() { + assertOnSelectorThread(); + ioBuffer.clear(); + return ioBuffer; } public Selector rawSelector() { diff --git a/libs/nio/src/main/java/org/elasticsearch/nio/SocketChannelContext.java b/libs/nio/src/main/java/org/elasticsearch/nio/SocketChannelContext.java index 2c63529d73b..864fe793fdf 100644 --- a/libs/nio/src/main/java/org/elasticsearch/nio/SocketChannelContext.java +++ b/libs/nio/src/main/java/org/elasticsearch/nio/SocketChannelContext.java @@ -44,7 +44,7 @@ import java.util.function.Predicate; */ public abstract class SocketChannelContext extends ChannelContext { - public static final Predicate ALWAYS_ALLOW_CHANNEL = (c) -> true; + protected static final Predicate ALWAYS_ALLOW_CHANNEL = (c) -> true; protected final NioSocketChannel channel; protected final InboundChannelBuffer channelBuffer; @@ -234,49 +234,113 @@ public abstract class SocketChannelContext extends ChannelContext return closeNow; } + + // When you read or write to a nio socket in java, the heap memory passed down must be copied to/from + // direct memory. The JVM internally does some buffering of the direct memory, however we can save space + // by reusing a thread-local direct buffer (provided by the NioSelector). + // + // Each network event loop is given a 64kb DirectByteBuffer. When we read we use this buffer and copy the + // data after the read. When we go to write, we copy the data to the direct memory before calling write. + // The choice of 64KB is rather arbitrary. We can explore different sizes in the future. However, any + // data that is copied to the buffer for a write, but not successfully flushed immediately, must be + // copied again on the next call. + protected int readFromChannel(ByteBuffer buffer) throws IOException { + ByteBuffer ioBuffer = getSelector().getIoBuffer(); + ioBuffer.limit(Math.min(buffer.remaining(), ioBuffer.limit())); + int bytesRead; try { - int bytesRead = rawChannel.read(buffer); - if (bytesRead < 0) { - closeNow = true; - bytesRead = 0; - } - return bytesRead; + bytesRead = rawChannel.read(ioBuffer); } catch (IOException e) { closeNow = true; throw e; } + if (bytesRead < 0) { + closeNow = true; + return 0; + } else { + ioBuffer.flip(); + buffer.put(ioBuffer); + return bytesRead; + } } - protected int readFromChannel(ByteBuffer[] buffers) throws IOException { + protected int readFromChannel(InboundChannelBuffer channelBuffer) throws IOException { + ByteBuffer ioBuffer = getSelector().getIoBuffer(); + int bytesRead; try { - int bytesRead = (int) rawChannel.read(buffers); - if (bytesRead < 0) { - closeNow = true; - bytesRead = 0; - } - return bytesRead; + bytesRead = rawChannel.read(ioBuffer); } catch (IOException e) { closeNow = true; throw e; } + if (bytesRead < 0) { + closeNow = true; + return 0; + } else { + ioBuffer.flip(); + channelBuffer.ensureCapacity(channelBuffer.getIndex() + ioBuffer.remaining()); + ByteBuffer[] buffers = channelBuffer.sliceBuffersFrom(channelBuffer.getIndex()); + int j = 0; + while (j < buffers.length && ioBuffer.remaining() > 0) { + ByteBuffer buffer = buffers[j++]; + copyBytes(ioBuffer, buffer); + } + channelBuffer.incrementIndex(bytesRead); + return bytesRead; + } } protected int flushToChannel(ByteBuffer buffer) throws IOException { + int initialPosition = buffer.position(); + ByteBuffer ioBuffer = getSelector().getIoBuffer(); + copyBytes(buffer, ioBuffer); + ioBuffer.flip(); + int bytesWritten; try { - return rawChannel.write(buffer); + bytesWritten = rawChannel.write(ioBuffer); } catch (IOException e) { closeNow = true; + buffer.position(initialPosition); throw e; } + buffer.position(initialPosition + bytesWritten); + return bytesWritten; } - protected int flushToChannel(ByteBuffer[] buffers) throws IOException { - try { - return (int) rawChannel.write(buffers); - } catch (IOException e) { - closeNow = true; - throw e; + protected int flushToChannel(FlushOperation flushOperation) throws IOException { + ByteBuffer ioBuffer = getSelector().getIoBuffer(); + + boolean continueFlush = flushOperation.isFullyFlushed() == false; + int totalBytesFlushed = 0; + while (continueFlush) { + ioBuffer.clear(); + int j = 0; + ByteBuffer[] buffers = flushOperation.getBuffersToWrite(); + while (j < buffers.length && ioBuffer.remaining() > 0) { + ByteBuffer buffer = buffers[j++]; + copyBytes(buffer, ioBuffer); + } + ioBuffer.flip(); + int bytesFlushed; + try { + bytesFlushed = rawChannel.write(ioBuffer); + } catch (IOException e) { + closeNow = true; + throw e; + } + flushOperation.incrementIndex(bytesFlushed); + totalBytesFlushed += bytesFlushed; + continueFlush = ioBuffer.hasRemaining() == false && flushOperation.isFullyFlushed() == false; } + return totalBytesFlushed; + } + + private void copyBytes(ByteBuffer from, ByteBuffer to) { + int nBytesToCopy = Math.min(to.remaining(), from.remaining()); + int initialLimit = from.limit(); + from.limit(from.position() + nBytesToCopy); + to.put(from); + from.limit(initialLimit); } } diff --git a/libs/nio/src/test/java/org/elasticsearch/nio/BytesChannelContextTests.java b/libs/nio/src/test/java/org/elasticsearch/nio/BytesChannelContextTests.java index 2ab20522db6..22a90a32d65 100644 --- a/libs/nio/src/test/java/org/elasticsearch/nio/BytesChannelContextTests.java +++ b/libs/nio/src/test/java/org/elasticsearch/nio/BytesChannelContextTests.java @@ -31,7 +31,7 @@ import java.util.function.BiConsumer; import java.util.function.Consumer; import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -64,14 +64,19 @@ public class BytesChannelContextTests extends ESTestCase { context = new BytesChannelContext(channel, selector, mock(Consumer.class), handler, channelBuffer); when(selector.isOnCurrentThread()).thenReturn(true); + ByteBuffer buffer = ByteBuffer.allocate(1 << 14); + when(selector.getIoBuffer()).thenAnswer(invocationOnMock -> { + buffer.clear(); + return buffer; + }); } public void testSuccessfulRead() throws IOException { byte[] bytes = createMessage(messageLength); - when(rawChannel.read(any(ByteBuffer[].class), anyInt(), anyInt())).thenAnswer(invocationOnMock -> { - ByteBuffer[] buffers = (ByteBuffer[]) invocationOnMock.getArguments()[0]; - buffers[0].put(bytes); + when(rawChannel.read(any(ByteBuffer.class))).thenAnswer(invocationOnMock -> { + ByteBuffer buffer = (ByteBuffer) invocationOnMock.getArguments()[0]; + buffer.put(bytes); return bytes.length; }); @@ -87,9 +92,9 @@ public class BytesChannelContextTests extends ESTestCase { public void testMultipleReadsConsumed() throws IOException { byte[] bytes = createMessage(messageLength * 2); - when(rawChannel.read(any(ByteBuffer[].class), anyInt(), anyInt())).thenAnswer(invocationOnMock -> { - ByteBuffer[] buffers = (ByteBuffer[]) invocationOnMock.getArguments()[0]; - buffers[0].put(bytes); + when(rawChannel.read(any(ByteBuffer.class))).thenAnswer(invocationOnMock -> { + ByteBuffer buffer = (ByteBuffer) invocationOnMock.getArguments()[0]; + buffer.put(bytes); return bytes.length; }); @@ -105,9 +110,9 @@ public class BytesChannelContextTests extends ESTestCase { public void testPartialRead() throws IOException { byte[] bytes = createMessage(messageLength); - when(rawChannel.read(any(ByteBuffer[].class), anyInt(), anyInt())).thenAnswer(invocationOnMock -> { - ByteBuffer[] buffers = (ByteBuffer[]) invocationOnMock.getArguments()[0]; - buffers[0].put(bytes); + when(rawChannel.read(any(ByteBuffer.class))).thenAnswer(invocationOnMock -> { + ByteBuffer buffer = (ByteBuffer) invocationOnMock.getArguments()[0]; + buffer.put(bytes); return bytes.length; }); @@ -130,14 +135,14 @@ public class BytesChannelContextTests extends ESTestCase { public void testReadThrowsIOException() throws IOException { IOException ioException = new IOException(); - when(rawChannel.read(any(ByteBuffer[].class), anyInt(), anyInt())).thenThrow(ioException); + when(rawChannel.read(any(ByteBuffer.class))).thenThrow(ioException); IOException ex = expectThrows(IOException.class, () -> context.read()); assertSame(ioException, ex); } public void testReadThrowsIOExceptionMeansReadyForClose() throws IOException { - when(rawChannel.read(any(ByteBuffer[].class), anyInt(), anyInt())).thenThrow(new IOException()); + when(rawChannel.read(any(ByteBuffer.class))).thenThrow(new IOException()); assertFalse(context.selectorShouldClose()); expectThrows(IOException.class, () -> context.read()); @@ -145,7 +150,7 @@ public class BytesChannelContextTests extends ESTestCase { } public void testReadLessThanZeroMeansReadyForClose() throws IOException { - when(rawChannel.read(any(ByteBuffer[].class), anyInt(), anyInt())).thenReturn(-1L); + when(rawChannel.read(any(ByteBuffer.class))).thenReturn(-1); assertEquals(0, context.read()); @@ -164,11 +169,13 @@ public class BytesChannelContextTests extends ESTestCase { assertTrue(context.readyForFlush()); when(flushOperation.getBuffersToWrite()).thenReturn(buffers); - when(flushOperation.isFullyFlushed()).thenReturn(true); + when(flushOperation.isFullyFlushed()).thenReturn(false, true); when(flushOperation.getListener()).thenReturn(listener); context.flushChannel(); - verify(rawChannel).write(buffers, 0, buffers.length); + ByteBuffer buffer = buffers[0].duplicate(); + buffer.flip(); + verify(rawChannel).write(eq(buffer)); verify(selector).executeListener(listener, null); assertFalse(context.readyForFlush()); } @@ -180,7 +187,7 @@ public class BytesChannelContextTests extends ESTestCase { assertTrue(context.readyForFlush()); when(flushOperation.isFullyFlushed()).thenReturn(false); - when(flushOperation.getBuffersToWrite()).thenReturn(new ByteBuffer[0]); + when(flushOperation.getBuffersToWrite()).thenReturn(new ByteBuffer[] {ByteBuffer.allocate(3)}); context.flushChannel(); verify(listener, times(0)).accept(null, null); @@ -194,8 +201,8 @@ public class BytesChannelContextTests extends ESTestCase { BiConsumer listener2 = mock(BiConsumer.class); FlushReadyWrite flushOperation1 = mock(FlushReadyWrite.class); FlushReadyWrite flushOperation2 = mock(FlushReadyWrite.class); - when(flushOperation1.getBuffersToWrite()).thenReturn(new ByteBuffer[0]); - when(flushOperation2.getBuffersToWrite()).thenReturn(new ByteBuffer[0]); + when(flushOperation1.getBuffersToWrite()).thenReturn(new ByteBuffer[] {ByteBuffer.allocate(3)}); + when(flushOperation2.getBuffersToWrite()).thenReturn(new ByteBuffer[] {ByteBuffer.allocate(3)}); when(flushOperation1.getListener()).thenReturn(listener); when(flushOperation2.getListener()).thenReturn(listener2); @@ -204,7 +211,7 @@ public class BytesChannelContextTests extends ESTestCase { assertTrue(context.readyForFlush()); - when(flushOperation1.isFullyFlushed()).thenReturn(true); + when(flushOperation1.isFullyFlushed()).thenReturn(false, true); when(flushOperation2.isFullyFlushed()).thenReturn(false); context.flushChannel(); @@ -212,7 +219,7 @@ public class BytesChannelContextTests extends ESTestCase { verify(listener2, times(0)).accept(null, null); assertTrue(context.readyForFlush()); - when(flushOperation2.isFullyFlushed()).thenReturn(true); + when(flushOperation2.isFullyFlushed()).thenReturn(false, true); context.flushChannel(); @@ -231,7 +238,7 @@ public class BytesChannelContextTests extends ESTestCase { IOException exception = new IOException(); when(flushOperation.getBuffersToWrite()).thenReturn(buffers); - when(rawChannel.write(buffers, 0, buffers.length)).thenThrow(exception); + when(rawChannel.write(any(ByteBuffer.class))).thenThrow(exception); when(flushOperation.getListener()).thenReturn(listener); expectThrows(IOException.class, () -> context.flushChannel()); @@ -246,7 +253,7 @@ public class BytesChannelContextTests extends ESTestCase { IOException exception = new IOException(); when(flushOperation.getBuffersToWrite()).thenReturn(buffers); - when(rawChannel.write(buffers, 0, buffers.length)).thenThrow(exception); + when(rawChannel.write(any(ByteBuffer.class))).thenThrow(exception); assertFalse(context.selectorShouldClose()); expectThrows(IOException.class, () -> context.flushChannel()); diff --git a/libs/nio/src/test/java/org/elasticsearch/nio/SocketChannelContextTests.java b/libs/nio/src/test/java/org/elasticsearch/nio/SocketChannelContextTests.java index 9dbf483107b..2654928e8fb 100644 --- a/libs/nio/src/test/java/org/elasticsearch/nio/SocketChannelContextTests.java +++ b/libs/nio/src/test/java/org/elasticsearch/nio/SocketChannelContextTests.java @@ -22,6 +22,7 @@ package org.elasticsearch.nio; import org.elasticsearch.test.ESTestCase; import org.junit.Before; import org.mockito.ArgumentCaptor; +import org.mockito.stubbing.Answer; import java.io.IOException; import java.nio.ByteBuffer; @@ -54,6 +55,7 @@ public class SocketChannelContextTests extends ESTestCase { private BiConsumer listener; private NioSelector selector; private ReadWriteHandler readWriteHandler; + private ByteBuffer ioBuffer = ByteBuffer.allocate(1024); @SuppressWarnings("unchecked") @Before @@ -71,6 +73,10 @@ public class SocketChannelContextTests extends ESTestCase { context = new TestSocketChannelContext(channel, selector, exceptionHandler, readWriteHandler, channelBuffer); when(selector.isOnCurrentThread()).thenReturn(true); + when(selector.getIoBuffer()).thenAnswer(invocationOnMock -> { + ioBuffer.clear(); + return ioBuffer; + }); } public void testIOExceptionSetIfEncountered() throws IOException { @@ -90,7 +96,6 @@ public class SocketChannelContextTests extends ESTestCase { } public void testSignalWhenPeerClosed() throws IOException { - when(rawChannel.read(any(ByteBuffer[].class), anyInt(), anyInt())).thenReturn(-1L); when(rawChannel.read(any(ByteBuffer.class))).thenReturn(-1); assertFalse(context.closeNow()); context.read(); @@ -289,6 +294,153 @@ public class SocketChannelContextTests extends ESTestCase { } } + public void testReadToBufferLimitsToPassedBuffer() throws IOException { + ByteBuffer buffer = ByteBuffer.allocate(10); + when(rawChannel.read(any(ByteBuffer.class))).thenAnswer(completelyFillBufferAnswer()); + + int bytesRead = context.readFromChannel(buffer); + assertEquals(bytesRead, 10); + assertEquals(0, buffer.remaining()); + } + + public void testReadToBufferHandlesIOException() throws IOException { + when(rawChannel.read(any(ByteBuffer.class))).thenThrow(new IOException()); + + expectThrows(IOException.class, () -> context.readFromChannel(ByteBuffer.allocate(10))); + assertTrue(context.closeNow()); + } + + public void testReadToBufferHandlesEOF() throws IOException { + when(rawChannel.read(any(ByteBuffer.class))).thenReturn(-1); + + context.readFromChannel(ByteBuffer.allocate(10)); + assertTrue(context.closeNow()); + } + + public void testReadToChannelBufferWillReadAsMuchAsIOBufferAllows() throws IOException { + when(rawChannel.read(any(ByteBuffer.class))).thenAnswer(completelyFillBufferAnswer()); + + InboundChannelBuffer channelBuffer = InboundChannelBuffer.allocatingInstance(); + int bytesRead = context.readFromChannel(channelBuffer); + assertEquals(ioBuffer.capacity(), bytesRead); + assertEquals(ioBuffer.capacity(), channelBuffer.getIndex()); + } + + public void testReadToChannelBufferHandlesIOException() throws IOException { + when(rawChannel.read(any(ByteBuffer.class))).thenThrow(new IOException()); + + InboundChannelBuffer channelBuffer = InboundChannelBuffer.allocatingInstance(); + expectThrows(IOException.class, () -> context.readFromChannel(channelBuffer)); + assertTrue(context.closeNow()); + assertEquals(0, channelBuffer.getIndex()); + } + + public void testReadToChannelBufferHandlesEOF() throws IOException { + when(rawChannel.read(any(ByteBuffer.class))).thenReturn(-1); + + InboundChannelBuffer channelBuffer = InboundChannelBuffer.allocatingInstance(); + context.readFromChannel(channelBuffer); + assertTrue(context.closeNow()); + assertEquals(0, channelBuffer.getIndex()); + } + + public void testFlushBufferHandlesPartialFlush() throws IOException { + int bytesToConsume = 3; + when(rawChannel.write(any(ByteBuffer.class))).thenAnswer(consumeBufferAnswer(bytesToConsume)); + + ByteBuffer buffer = ByteBuffer.allocate(10); + context.flushToChannel(buffer); + assertEquals(10 - bytesToConsume, buffer.remaining()); + } + + public void testFlushBufferHandlesFullFlush() throws IOException { + int bytesToConsume = 10; + when(rawChannel.write(any(ByteBuffer.class))).thenAnswer(consumeBufferAnswer(bytesToConsume)); + + ByteBuffer buffer = ByteBuffer.allocate(10); + context.flushToChannel(buffer); + assertEquals(0, buffer.remaining()); + } + + public void testFlushBufferHandlesIOException() throws IOException { + when(rawChannel.write(any(ByteBuffer.class))).thenThrow(new IOException()); + + ByteBuffer buffer = ByteBuffer.allocate(10); + expectThrows(IOException.class, () -> context.flushToChannel(buffer)); + assertTrue(context.closeNow()); + assertEquals(10, buffer.remaining()); + } + + public void testFlushBuffersHandlesZeroFlush() throws IOException { + when(rawChannel.write(any(ByteBuffer.class))).thenAnswer(consumeBufferAnswer(0)); + + ByteBuffer[] buffers = {ByteBuffer.allocate(1023), ByteBuffer.allocate(1023)}; + FlushOperation flushOperation = new FlushOperation(buffers, listener); + context.flushToChannel(flushOperation); + assertEquals(2, flushOperation.getBuffersToWrite().length); + assertEquals(0, flushOperation.getBuffersToWrite()[0].position()); + } + + public void testFlushBuffersHandlesPartialFlush() throws IOException { + AtomicBoolean first = new AtomicBoolean(true); + when(rawChannel.write(any(ByteBuffer.class))).thenAnswer(invocationOnMock -> { + if (first.compareAndSet(true, false)) { + return consumeBufferAnswer(1024).answer(invocationOnMock); + } else { + return consumeBufferAnswer(3).answer(invocationOnMock); + } + }); + + ByteBuffer[] buffers = {ByteBuffer.allocate(1023), ByteBuffer.allocate(1023)}; + FlushOperation flushOperation = new FlushOperation(buffers, listener); + context.flushToChannel(flushOperation); + assertEquals(1, flushOperation.getBuffersToWrite().length); + assertEquals(4, flushOperation.getBuffersToWrite()[0].position()); + } + + public void testFlushBuffersHandlesFullFlush() throws IOException { + AtomicBoolean first = new AtomicBoolean(true); + when(rawChannel.write(any(ByteBuffer.class))).thenAnswer(invocationOnMock -> { + if (first.compareAndSet(true, false)) { + return consumeBufferAnswer(1024).answer(invocationOnMock); + } else { + return consumeBufferAnswer(1022).answer(invocationOnMock); + } + }); + + ByteBuffer[] buffers = {ByteBuffer.allocate(1023), ByteBuffer.allocate(1023)}; + FlushOperation flushOperation = new FlushOperation(buffers, listener); + context.flushToChannel(flushOperation); + assertTrue(flushOperation.isFullyFlushed()); + } + + public void testFlushBuffersHandlesIOException() throws IOException { + when(rawChannel.write(any(ByteBuffer.class))).thenThrow(new IOException()); + + ByteBuffer[] buffers = {ByteBuffer.allocate(10), ByteBuffer.allocate(10)}; + FlushOperation flushOperation = new FlushOperation(buffers, listener); + expectThrows(IOException.class, () -> context.flushToChannel(flushOperation)); + assertTrue(context.closeNow()); + } + + public void testFlushBuffersHandlesIOExceptionSecondTimeThroughLoop() throws IOException { + AtomicBoolean first = new AtomicBoolean(true); + when(rawChannel.write(any(ByteBuffer.class))).thenAnswer(invocationOnMock -> { + if (first.compareAndSet(true, false)) { + return consumeBufferAnswer(1024).answer(invocationOnMock); + } else { + throw new IOException(); + } + }); + + ByteBuffer[] buffers = {ByteBuffer.allocate(1023), ByteBuffer.allocate(1023)}; + FlushOperation flushOperation = new FlushOperation(buffers, listener); + expectThrows(IOException.class, () -> context.flushToChannel(flushOperation)); + assertTrue(context.closeNow()); + assertEquals(1, flushOperation.getBuffersToWrite().length); + assertEquals(1, flushOperation.getBuffersToWrite()[0].position()); + } + private static class TestSocketChannelContext extends SocketChannelContext { private TestSocketChannelContext(NioSocketChannel channel, NioSelector selector, Consumer exceptionHandler, @@ -305,8 +457,8 @@ public class SocketChannelContextTests extends ESTestCase { @Override public int read() throws IOException { if (randomBoolean()) { - ByteBuffer[] byteBuffers = {ByteBuffer.allocate(10)}; - return readFromChannel(byteBuffers); + InboundChannelBuffer channelBuffer = InboundChannelBuffer.allocatingInstance(); + return readFromChannel(channelBuffer); } else { return readFromChannel(ByteBuffer.allocate(10)); } @@ -316,7 +468,7 @@ public class SocketChannelContextTests extends ESTestCase { public void flushChannel() throws IOException { if (randomBoolean()) { ByteBuffer[] byteBuffers = {ByteBuffer.allocate(10)}; - flushToChannel(byteBuffers); + flushToChannel(new FlushOperation(byteBuffers, (v, e) -> {})); } else { flushToChannel(ByteBuffer.allocate(10)); } @@ -345,4 +497,23 @@ public class SocketChannelContextTests extends ESTestCase { } return bytes; } + + private Answer completelyFillBufferAnswer() { + return invocationOnMock -> { + ByteBuffer b = (ByteBuffer) invocationOnMock.getArguments()[0]; + int bytesRead = b.remaining(); + while (b.hasRemaining()) { + b.put((byte) 1); + } + return bytesRead; + }; + } + + private Answer consumeBufferAnswer(int bytesToConsume) { + return invocationOnMock -> { + ByteBuffer b = (ByteBuffer) invocationOnMock.getArguments()[0]; + b.position(b.position() + bytesToConsume); + return bytesToConsume; + }; + } } diff --git a/modules/lang-expression/licenses/lucene-expressions-8.0.0-snapshot-aaa64d70159.jar.sha1 b/modules/lang-expression/licenses/lucene-expressions-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..77cec85170e --- /dev/null +++ b/modules/lang-expression/licenses/lucene-expressions-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +7c72e9fe3c987151d04a12025b41465f5b21ba00 \ No newline at end of file diff --git a/modules/lang-expression/licenses/lucene-expressions-8.0.0-snapshot-c78429a554.jar.sha1 b/modules/lang-expression/licenses/lucene-expressions-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index 2ec671dd1f6..00000000000 --- a/modules/lang-expression/licenses/lucene-expressions-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -4a1574a3d3fcb950b440e36b3035f90885794bbf \ No newline at end of file diff --git a/plugins/analysis-icu/licenses/lucene-analyzers-icu-8.0.0-snapshot-aaa64d70159.jar.sha1 b/plugins/analysis-icu/licenses/lucene-analyzers-icu-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..b5b8677d2c8 --- /dev/null +++ b/plugins/analysis-icu/licenses/lucene-analyzers-icu-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +a8681d864406ad5b50076157d800320c95a17e01 \ No newline at end of file diff --git a/plugins/analysis-icu/licenses/lucene-analyzers-icu-8.0.0-snapshot-c78429a554.jar.sha1 b/plugins/analysis-icu/licenses/lucene-analyzers-icu-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index 0cb9c86ebb3..00000000000 --- a/plugins/analysis-icu/licenses/lucene-analyzers-icu-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -428b4a9e84b4e903dfadb4dd1e1ef2cdd98cce08 \ No newline at end of file diff --git a/plugins/analysis-kuromoji/licenses/lucene-analyzers-kuromoji-8.0.0-snapshot-aaa64d70159.jar.sha1 b/plugins/analysis-kuromoji/licenses/lucene-analyzers-kuromoji-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..37868e7f103 --- /dev/null +++ b/plugins/analysis-kuromoji/licenses/lucene-analyzers-kuromoji-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +4e02f20bf005f8aa0d3e182e5446736557d35723 \ No newline at end of file diff --git a/plugins/analysis-kuromoji/licenses/lucene-analyzers-kuromoji-8.0.0-snapshot-c78429a554.jar.sha1 b/plugins/analysis-kuromoji/licenses/lucene-analyzers-kuromoji-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index ee7c0750b0b..00000000000 --- a/plugins/analysis-kuromoji/licenses/lucene-analyzers-kuromoji-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -d08ee1049d04f672175ea9ba3132f7eaa98d9742 \ No newline at end of file diff --git a/plugins/analysis-nori/licenses/lucene-analyzers-nori-8.0.0-snapshot-aaa64d70159.jar.sha1 b/plugins/analysis-nori/licenses/lucene-analyzers-nori-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..8a8144a2192 --- /dev/null +++ b/plugins/analysis-nori/licenses/lucene-analyzers-nori-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +fd8de205837d3177d2f8ff454e74badf8a7c20a1 \ No newline at end of file diff --git a/plugins/analysis-nori/licenses/lucene-analyzers-nori-8.0.0-snapshot-c78429a554.jar.sha1 b/plugins/analysis-nori/licenses/lucene-analyzers-nori-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index 744f66706c5..00000000000 --- a/plugins/analysis-nori/licenses/lucene-analyzers-nori-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -841a9bd3a0e12b15b700c0655a76e4035d3128ae \ No newline at end of file diff --git a/plugins/analysis-phonetic/licenses/lucene-analyzers-phonetic-8.0.0-snapshot-aaa64d70159.jar.sha1 b/plugins/analysis-phonetic/licenses/lucene-analyzers-phonetic-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..d40d1ecfaf6 --- /dev/null +++ b/plugins/analysis-phonetic/licenses/lucene-analyzers-phonetic-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +b32e8b29e9533d7e7f832a093d68b294c8f43bee \ No newline at end of file diff --git a/plugins/analysis-phonetic/licenses/lucene-analyzers-phonetic-8.0.0-snapshot-c78429a554.jar.sha1 b/plugins/analysis-phonetic/licenses/lucene-analyzers-phonetic-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index 1fac0de6e74..00000000000 --- a/plugins/analysis-phonetic/licenses/lucene-analyzers-phonetic-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -e9bfd4935d1a5d55154cb99a066a03797174bc33 \ No newline at end of file diff --git a/plugins/analysis-smartcn/licenses/lucene-analyzers-smartcn-8.0.0-snapshot-aaa64d70159.jar.sha1 b/plugins/analysis-smartcn/licenses/lucene-analyzers-smartcn-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..f99c48f23c4 --- /dev/null +++ b/plugins/analysis-smartcn/licenses/lucene-analyzers-smartcn-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +03f342981ccdb176bb34e95bbce8d5ff7b00a711 \ No newline at end of file diff --git a/plugins/analysis-smartcn/licenses/lucene-analyzers-smartcn-8.0.0-snapshot-c78429a554.jar.sha1 b/plugins/analysis-smartcn/licenses/lucene-analyzers-smartcn-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index e860760a0b4..00000000000 --- a/plugins/analysis-smartcn/licenses/lucene-analyzers-smartcn-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -6a933a5113a708229177463c94d53ea544414a53 \ No newline at end of file diff --git a/plugins/analysis-stempel/licenses/lucene-analyzers-stempel-8.0.0-snapshot-aaa64d70159.jar.sha1 b/plugins/analysis-stempel/licenses/lucene-analyzers-stempel-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..fa052756380 --- /dev/null +++ b/plugins/analysis-stempel/licenses/lucene-analyzers-stempel-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +67c740d5304a22b062acc54b4fcf5314186c013e \ No newline at end of file diff --git a/plugins/analysis-stempel/licenses/lucene-analyzers-stempel-8.0.0-snapshot-c78429a554.jar.sha1 b/plugins/analysis-stempel/licenses/lucene-analyzers-stempel-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index c01b637789d..00000000000 --- a/plugins/analysis-stempel/licenses/lucene-analyzers-stempel-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -7709b470601b0c1a77fdcd5dd9ce9f48aba3db78 \ No newline at end of file diff --git a/plugins/analysis-ukrainian/licenses/lucene-analyzers-morfologik-8.0.0-snapshot-aaa64d70159.jar.sha1 b/plugins/analysis-ukrainian/licenses/lucene-analyzers-morfologik-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..063189b0281 --- /dev/null +++ b/plugins/analysis-ukrainian/licenses/lucene-analyzers-morfologik-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +ab4cf17ec2d41ae62e249faba5ee584d75e23131 \ No newline at end of file diff --git a/plugins/analysis-ukrainian/licenses/lucene-analyzers-morfologik-8.0.0-snapshot-c78429a554.jar.sha1 b/plugins/analysis-ukrainian/licenses/lucene-analyzers-morfologik-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index 33dafb0fa6f..00000000000 --- a/plugins/analysis-ukrainian/licenses/lucene-analyzers-morfologik-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -00062c609614d7229c5869d7d8988674ffaea350 \ No newline at end of file diff --git a/plugins/repository-gcs/qa/google-cloud-storage/src/test/resources/rest-api-spec/test/repository_gcs/10_repository.yml b/plugins/repository-gcs/qa/google-cloud-storage/src/test/resources/rest-api-spec/test/repository_gcs/10_repository.yml index bb8f148fc8a..ac649229001 100644 --- a/plugins/repository-gcs/qa/google-cloud-storage/src/test/resources/rest-api-spec/test/repository_gcs/10_repository.yml +++ b/plugins/repository-gcs/qa/google-cloud-storage/src/test/resources/rest-api-spec/test/repository_gcs/10_repository.yml @@ -13,6 +13,19 @@ setup: client: "integration_test" base_path: "${base_path}" + # Remove the snapshots, if a previous test failed to delete them. This is + # useful for third party tests that runs the test against a real external service. + - do: + snapshot.delete: + repository: repository + snapshot: snapshot-one + ignore: 404 + - do: + snapshot.delete: + repository: repository + snapshot: snapshot-two + ignore: 404 + --- "Snapshot/Restore with repository-gcs": diff --git a/plugins/repository-s3/build.gradle b/plugins/repository-s3/build.gradle index 48c2a9e6ff1..e814529e052 100644 --- a/plugins/repository-s3/build.gradle +++ b/plugins/repository-s3/build.gradle @@ -74,6 +74,7 @@ task testRepositoryCreds(type: RandomizedTestingTask) { include '**/S3BlobStoreRepositoryTests.class' systemProperty 'es.allow_insecure_settings', 'true' } +project.check.dependsOn(testRepositoryCreds) test { // these are tested explicitly in separate test tasks @@ -106,20 +107,12 @@ String s3ECSBasePath = System.getenv("amazon_s3_base_path_ecs") // If all these variables are missing then we are testing against the internal fixture instead, which has the following // credentials hard-coded in. -if (!s3PermanentAccessKey && !s3PermanentSecretKey && !s3PermanentBucket && !s3PermanentBasePath - && !s3EC2Bucket && !s3EC2BasePath - && !s3ECSBucket && !s3ECSBasePath) { +if (!s3PermanentAccessKey && !s3PermanentSecretKey && !s3PermanentBucket && !s3PermanentBasePath) { s3PermanentAccessKey = 's3_integration_test_permanent_access_key' s3PermanentSecretKey = 's3_integration_test_permanent_secret_key' s3PermanentBucket = 'permanent-bucket-test' s3PermanentBasePath = 'integration_test' - s3EC2Bucket = 'ec2-bucket-test' - s3EC2BasePath = 'integration_test' - - s3ECSBucket = 'ecs-bucket-test' - s3ECSBasePath = 'integration_test' - useFixture = true } else if (!s3PermanentAccessKey || !s3PermanentSecretKey || !s3PermanentBucket || !s3PermanentBasePath) { @@ -137,6 +130,16 @@ if (!s3TemporaryAccessKey && !s3TemporarySecretKey && !s3TemporaryBucket && !s3T throw new IllegalArgumentException("not all options specified to run against external S3 service as temporary credentials are present") } +if (!s3EC2Bucket && !s3EC2BasePath && !s3ECSBucket && !s3ECSBasePath) { + s3EC2Bucket = 'ec2-bucket-test' + s3EC2BasePath = 'integration_test' + s3ECSBucket = 'ecs-bucket-test' + s3ECSBasePath = 'integration_test' +} else if (!s3EC2Bucket || !s3EC2BasePath || !s3ECSBucket || !s3ECSBasePath) { + throw new IllegalArgumentException("not all options specified to run EC2/ECS tests are present") +} + + final String minioVersion = 'RELEASE.2018-06-22T23-48-46Z' final String minioBinDir = "${buildDir}/minio/bin" final String minioDataDir = "${buildDir}/minio/data" diff --git a/plugins/repository-s3/src/test/resources/rest-api-spec/test/repository_s3/20_repository_permanent_credentials.yml b/plugins/repository-s3/src/test/resources/rest-api-spec/test/repository_s3/20_repository_permanent_credentials.yml index 275b1fcedd0..1c64b66be3a 100644 --- a/plugins/repository-s3/src/test/resources/rest-api-spec/test/repository_s3/20_repository_permanent_credentials.yml +++ b/plugins/repository-s3/src/test/resources/rest-api-spec/test/repository_s3/20_repository_permanent_credentials.yml @@ -16,6 +16,19 @@ setup: canned_acl: private storage_class: standard + # Remove the snapshots, if a previous test failed to delete them. This is + # useful for third party tests that runs the test against a real external service. + - do: + snapshot.delete: + repository: repository_permanent + snapshot: snapshot-one + ignore: 404 + - do: + snapshot.delete: + repository: repository_permanent + snapshot: snapshot-two + ignore: 404 + --- "Snapshot and Restore with repository-s3 using permanent credentials": diff --git a/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java b/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java index ef6ed913854..d251995f6ca 100644 --- a/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java +++ b/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java @@ -953,6 +953,56 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase { } } + public void testSoftDeletes() throws Exception { + if (isRunningAgainstOldCluster()) { + XContentBuilder mappingsAndSettings = jsonBuilder(); + mappingsAndSettings.startObject(); + { + mappingsAndSettings.startObject("settings"); + mappingsAndSettings.field("number_of_shards", 1); + mappingsAndSettings.field("number_of_replicas", 1); + if (getOldClusterVersion().onOrAfter(Version.V_6_5_0)) { + mappingsAndSettings.field("soft_deletes.enabled", true); + } + mappingsAndSettings.endObject(); + } + mappingsAndSettings.endObject(); + Request createIndex = new Request("PUT", "/" + index); + createIndex.setJsonEntity(Strings.toString(mappingsAndSettings)); + client().performRequest(createIndex); + int numDocs = between(10, 100); + for (int i = 0; i < numDocs; i++) { + String doc = Strings.toString(JsonXContent.contentBuilder().startObject().field("field", "v1").endObject()); + Request request = new Request("POST", "/" + index + "/doc/" + i); + request.setJsonEntity(doc); + client().performRequest(request); + if (rarely()) { + refresh(); + } + } + client().performRequest(new Request("POST", "/" + index + "/_flush")); + int liveDocs = numDocs; + assertTotalHits(liveDocs, entityAsMap(client().performRequest(new Request("GET", "/" + index + "/_search")))); + for (int i = 0; i < numDocs; i++) { + if (randomBoolean()) { + String doc = Strings.toString(JsonXContent.contentBuilder().startObject().field("field", "v2").endObject()); + Request request = new Request("POST", "/" + index + "/doc/" + i); + request.setJsonEntity(doc); + client().performRequest(request); + } else if (randomBoolean()) { + client().performRequest(new Request("DELETE", "/" + index + "/doc/" + i)); + liveDocs--; + } + } + refresh(); + assertTotalHits(liveDocs, entityAsMap(client().performRequest(new Request("GET", "/" + index + "/_search")))); + saveInfoDocument("doc_count", Integer.toString(liveDocs)); + } else { + int liveDocs = Integer.parseInt(loadInfoDocument("doc_count")); + assertTotalHits(liveDocs, entityAsMap(client().performRequest(new Request("GET", "/" + index + "/_search")))); + } + } + private void checkSnapshot(String snapshotName, int count, Version tookOnVersion) throws IOException { // Check the snapshot metadata, especially the version Request listSnapshotRequest = new Request("GET", "/_snapshot/repo/" + snapshotName); diff --git a/qa/rolling-upgrade/build.gradle b/qa/rolling-upgrade/build.gradle index a75b906e123..f1a2afe86f6 100644 --- a/qa/rolling-upgrade/build.gradle +++ b/qa/rolling-upgrade/build.gradle @@ -83,6 +83,8 @@ for (Version version : bwcVersions.wireCompatible) { dataDir = { nodeNumber -> oldClusterTest.nodes[stopNode].dataDir } setting 'repositories.url.allowed_urls', 'http://snapshot.test*' setting 'node.name', "upgraded-node-${stopNode}" + // TODO: Move to Zen2 once we support rolling upgrade with Zen2 + setting 'discovery.type', 'zen' } } diff --git a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/RecoveryIT.java b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/RecoveryIT.java index a0e33350417..4d9f1fd9add 100644 --- a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/RecoveryIT.java +++ b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/RecoveryIT.java @@ -26,6 +26,7 @@ import org.elasticsearch.client.ResponseException; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.AbstractRunnable; +import org.elasticsearch.index.IndexSettings; import org.elasticsearch.test.rest.yaml.ObjectPath; import java.io.IOException; @@ -272,4 +273,35 @@ public class RecoveryIT extends AbstractRollingTestCase { ensureGreen(index); } + public void testRecoveryWithSoftDeletes() throws Exception { + final String index = "recover_with_soft_deletes"; + if (CLUSTER_TYPE == ClusterType.OLD) { + Settings.Builder settings = Settings.builder() + .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) + .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1) + // if the node with the replica is the first to be restarted, while a replica is still recovering + // then delayed allocation will kick in. When the node comes back, the master will search for a copy + // but the recovering copy will be seen as invalid and the cluster health won't return to GREEN + // before timing out + .put(INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "100ms") + .put(SETTING_ALLOCATION_MAX_RETRY.getKey(), "0"); // fail faster + if (getNodeId(v -> v.onOrAfter(Version.V_6_5_0)) != null) { + settings.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true); + } + createIndex(index, settings.build()); + int numDocs = randomInt(10); + indexDocs(index, 0, numDocs); + if (randomBoolean()) { + client().performRequest(new Request("POST", "/" + index + "/_flush")); + } + for (int i = 0; i < numDocs; i++) { + if (randomBoolean()) { + indexDocs(index, i, 1); // update + } else if (randomBoolean()) { + client().performRequest(new Request("DELETE", index + "/test/" + i)); + } + } + } + ensureGreen(index); + } } diff --git a/qa/unconfigured-node-name/build.gradle b/qa/unconfigured-node-name/build.gradle index dcc3e7c6a16..3e411189647 100644 --- a/qa/unconfigured-node-name/build.gradle +++ b/qa/unconfigured-node-name/build.gradle @@ -22,6 +22,8 @@ apply plugin: 'elasticsearch.rest-test' integTestCluster { setting 'node.name', null + // TODO: Run this using zen2 + setting 'discovery.type', 'zen' } integTestRunner { diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/termvectors.json b/rest-api-spec/src/main/resources/rest-api-spec/api/termvectors.json index f5d8b6bd08d..3485c7a6cc1 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/termvectors.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/termvectors.json @@ -3,8 +3,9 @@ "documentation" : "http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html", "methods" : ["GET", "POST"], "url" : { - "path" : "/{index}/{type}/_termvectors", - "paths" : ["/{index}/{type}/_termvectors", "/{index}/{type}/{id}/_termvectors"], + "path" : "/{index}/_termvectors/{id}", + "paths" : ["/{index}/_termvectors/{id}", "/{index}/_termvectors/", + "/{index}/{type}/{id}/_termvectors", "/{index}/{type}/_termvectors"], "parts" : { "index" : { "type" : "string", @@ -14,7 +15,7 @@ "type" : { "type" : "string", "description" : "The type of the document.", - "required" : true + "required" : false }, "id" : { "type" : "string", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/mtermvectors/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/mtermvectors/10_basic.yml index 27fa94e85a4..cb61bbed9d7 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/mtermvectors/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/mtermvectors/10_basic.yml @@ -1,10 +1,13 @@ setup: + - skip: + version: " - 6.99.99" + reason: types are required in requests before 7.0.0 - do: indices.create: index: testidx body: mappings: - testtype: + _doc: properties: text: type : "text" @@ -12,7 +15,7 @@ setup: - do: index: index: testidx - type: testtype + type: _doc id: testing_document body: {"text" : "The quick brown fox is brown."} @@ -22,19 +25,6 @@ setup: --- "Basic tests for multi termvector get": - - do: - mtermvectors: - "term_statistics" : true - "body" : - "docs": - - - "_index" : "testidx" - "_type" : "testtype" - "_id" : "testing_document" - - - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} - - match: {docs.0.term_vectors.text.terms.brown.ttf: 2} - - do: mtermvectors: "term_statistics" : true @@ -42,7 +32,6 @@ setup: "docs": - "_index" : "testidx" - "_type" : "testtype" "_id" : "testing_document" - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} @@ -55,7 +44,6 @@ setup: "body" : "docs": - - "_type" : "testtype" "_id" : "testing_document" - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} @@ -65,20 +53,6 @@ setup: mtermvectors: "term_statistics" : true "index" : "testidx" - "type" : "testtype" - "body" : - "docs": - - - "_id" : "testing_document" - - - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} - - match: {docs.0.term_vectors.text.terms.brown.ttf: 2} - - - do: - mtermvectors: - "term_statistics" : true - "index" : "testidx" - "type" : "testtype" "ids" : ["testing_document"] - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/mtermvectors/11_basic_with_types.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/mtermvectors/11_basic_with_types.yml new file mode 100644 index 00000000000..27fa94e85a4 --- /dev/null +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/mtermvectors/11_basic_with_types.yml @@ -0,0 +1,85 @@ +setup: + - do: + indices.create: + index: testidx + body: + mappings: + testtype: + properties: + text: + type : "text" + term_vector : "with_positions_offsets" + - do: + index: + index: testidx + type: testtype + id: testing_document + body: {"text" : "The quick brown fox is brown."} + + - do: + indices.refresh: {} + +--- +"Basic tests for multi termvector get": + + - do: + mtermvectors: + "term_statistics" : true + "body" : + "docs": + - + "_index" : "testidx" + "_type" : "testtype" + "_id" : "testing_document" + + - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} + - match: {docs.0.term_vectors.text.terms.brown.ttf: 2} + + - do: + mtermvectors: + "term_statistics" : true + "body" : + "docs": + - + "_index" : "testidx" + "_type" : "testtype" + "_id" : "testing_document" + + - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} + - match: {docs.0.term_vectors.text.terms.brown.ttf: 2} + + - do: + mtermvectors: + "term_statistics" : true + "index" : "testidx" + "body" : + "docs": + - + "_type" : "testtype" + "_id" : "testing_document" + + - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} + - match: {docs.0.term_vectors.text.terms.brown.ttf: 2} + + - do: + mtermvectors: + "term_statistics" : true + "index" : "testidx" + "type" : "testtype" + "body" : + "docs": + - + "_id" : "testing_document" + + - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} + - match: {docs.0.term_vectors.text.terms.brown.ttf: 2} + + - do: + mtermvectors: + "term_statistics" : true + "index" : "testidx" + "type" : "testtype" + "ids" : ["testing_document"] + + - match: {docs.0.term_vectors.text.terms.brown.term_freq: 2} + - match: {docs.0.term_vectors.text.terms.brown.ttf: 2} diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/mtermvectors/20_deprecated.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/mtermvectors/20_deprecated.yml index 3ee06780a1f..758c09e79a8 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/mtermvectors/20_deprecated.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/mtermvectors/20_deprecated.yml @@ -1,3 +1,7 @@ +setup: + - skip: + version: " - 6.99.99" + reason: types are required in requests before 7.0.0 --- "Deprecated camel case and _ parameters should fail in Term Vectors query": @@ -12,7 +16,7 @@ index: testidx body: mappings: - testtype: + _doc: properties: text: type : "text" @@ -21,7 +25,7 @@ - do: index: index: testidx - type: testtype + type: _doc id: testing_document body: {"text" : "The quick brown fox is brown."} @@ -33,7 +37,6 @@ "docs": - "_index" : "testidx" - "_type" : "testtype" "_id" : "testing_document" "version" : 1 "versionType" : "external" @@ -46,7 +49,7 @@ "docs": - "_index" : "testidx" - "_type" : "testtype" + "_type" : "_doc" "_id" : "testing_document" "version" : 1 "_version_type" : "external" diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/mtermvectors/21_deprecated_with_types.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/mtermvectors/21_deprecated_with_types.yml new file mode 100644 index 00000000000..3ee06780a1f --- /dev/null +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/mtermvectors/21_deprecated_with_types.yml @@ -0,0 +1,52 @@ + +--- +"Deprecated camel case and _ parameters should fail in Term Vectors query": + + - skip: + version: " - 6.99.99" + reason: camel case and _ parameters (e.g. versionType, _version_type) should fail from 7.0 + features: "warnings" + + - do: + indices.create: + index: testidx + body: + mappings: + testtype: + properties: + text: + type : "text" + term_vector : "with_positions_offsets" + + - do: + index: + index: testidx + type: testtype + id: testing_document + body: {"text" : "The quick brown fox is brown."} + + - do: + catch: bad_request + mtermvectors: + "term_statistics" : true + "body" : + "docs": + - + "_index" : "testidx" + "_type" : "testtype" + "_id" : "testing_document" + "version" : 1 + "versionType" : "external" + + - do: + catch: bad_request + mtermvectors: + "term_statistics" : true + "body" : + "docs": + - + "_index" : "testidx" + "_type" : "testtype" + "_id" : "testing_document" + "version" : 1 + "_version_type" : "external" diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/10_basic.yml index 2fbcb815d87..053237f428e 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/10_basic.yml @@ -1,10 +1,14 @@ setup: + - skip: + version: " - 6.99.99" + reason: types are required in requests before 7.0.0 + - do: indices.create: index: testidx body: mappings: - testtype: + _doc: "properties": "text": "type" : "text" @@ -12,7 +16,7 @@ setup: - do: index: index: testidx - type: testtype + type: _doc id: testing_document body: "text" : "The quick brown fox is brown." @@ -25,7 +29,6 @@ setup: - do: termvectors: index: testidx - type: testtype id: testing_document "term_statistics" : true diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/11_basic_with_types.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/11_basic_with_types.yml new file mode 100644 index 00000000000..2fbcb815d87 --- /dev/null +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/11_basic_with_types.yml @@ -0,0 +1,35 @@ +setup: + - do: + indices.create: + index: testidx + body: + mappings: + testtype: + "properties": + "text": + "type" : "text" + "term_vector" : "with_positions_offsets" + - do: + index: + index: testidx + type: testtype + id: testing_document + body: + "text" : "The quick brown fox is brown." + - do: + indices.refresh: {} + +--- +"Basic tests for termvector get": + + - do: + termvectors: + index: testidx + type: testtype + id: testing_document + "term_statistics" : true + + + - match: {term_vectors.text.field_statistics.sum_doc_freq: 5} + - match: {term_vectors.text.terms.brown.doc_freq: 1} + - match: {term_vectors.text.terms.brown.tokens.0.start_offset: 10} diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/20_issue7121.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/20_issue7121.yml index 168c913b75c..47ba48a5f45 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/20_issue7121.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/20_issue7121.yml @@ -1,3 +1,9 @@ +setup: + - skip: + version: " - 6.99.99" + reason: types are required in requests before 7.0.0 + +--- "Term vector API should return 'found: false' for docs between index and refresh": - do: indices.create: @@ -10,7 +16,7 @@ number_of_replicas: 0 refresh_interval: -1 mappings: - doc: + _doc: properties: text: type : "text" @@ -23,7 +29,7 @@ - do: index: index: testidx - type: doc + type: _doc id: 1 body: text : "foo bar" @@ -31,11 +37,10 @@ - do: termvectors: index: testidx - type: doc id: 1 realtime: false - match: { _index: "testidx" } - - match: { _type: "doc" } + - match: { _type: "_doc" } - match: { _id: "1" } - is_false: found diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/21_issue7121_with_types.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/21_issue7121_with_types.yml new file mode 100644 index 00000000000..168c913b75c --- /dev/null +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/21_issue7121_with_types.yml @@ -0,0 +1,41 @@ +"Term vector API should return 'found: false' for docs between index and refresh": + - do: + indices.create: + index: testidx + body: + settings: + index: + translog.flush_threshold_size: "512MB" + number_of_shards: 1 + number_of_replicas: 0 + refresh_interval: -1 + mappings: + doc: + properties: + text: + type : "text" + term_vector : "with_positions_offsets" + + - do: + cluster.health: + wait_for_status: green + + - do: + index: + index: testidx + type: doc + id: 1 + body: + text : "foo bar" + + - do: + termvectors: + index: testidx + type: doc + id: 1 + realtime: false + + - match: { _index: "testidx" } + - match: { _type: "doc" } + - match: { _id: "1" } + - is_false: found diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/30_realtime.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/30_realtime.yml index 26f441207ac..4e98f281baf 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/30_realtime.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/30_realtime.yml @@ -1,3 +1,8 @@ +setup: + - skip: + version: " - 6.99.99" + reason: types are required in requests before 7.0.0 + --- "Realtime Term Vectors": @@ -17,14 +22,13 @@ - do: index: index: test_1 - type: test + type: _doc id: 1 body: { foo: bar } - do: termvectors: index: test_1 - type: test id: 1 realtime: false @@ -33,7 +37,6 @@ - do: termvectors: index: test_1 - type: test id: 1 realtime: true diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/31_realtime_with_types.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/31_realtime_with_types.yml new file mode 100644 index 00000000000..26f441207ac --- /dev/null +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/31_realtime_with_types.yml @@ -0,0 +1,40 @@ +--- +"Realtime Term Vectors": + + - do: + indices.create: + index: test_1 + body: + settings: + index: + refresh_interval: -1 + number_of_replicas: 0 + + - do: + cluster.health: + wait_for_status: green + + - do: + index: + index: test_1 + type: test + id: 1 + body: { foo: bar } + + - do: + termvectors: + index: test_1 + type: test + id: 1 + realtime: false + + - is_false: found + + - do: + termvectors: + index: test_1 + type: test + id: 1 + realtime: true + + - is_true: found diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/40_versions.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/40_versions.yml deleted file mode 100644 index e255ce510ed..00000000000 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/termvectors/40_versions.yml +++ /dev/null @@ -1,88 +0,0 @@ ---- -"Versions": - - - do: - index: - index: test_1 - type: test - id: 1 - body: { foo: bar } - - match: { _version: 1} - - - do: - index: - index: test_1 - type: test - id: 1 - body: { foo: bar } - - match: { _version: 2} - - - do: - get: - index: test_1 - type: test - id: 1 - version: 2 - - match: { _id: "1" } - - - do: - catch: conflict - get: - index: test_1 - type: test - id: 1 - version: 1 - - - do: - get: - index: test_1 - type: test - id: 1 - version: 2 - version_type: external - - match: { _id: "1" } - - - do: - catch: conflict - get: - index: test_1 - type: test - id: 1 - version: 10 - version_type: external - - - do: - catch: conflict - get: - index: test_1 - type: test - id: 1 - version: 1 - version_type: external - - - do: - get: - index: test_1 - type: test - id: 1 - version: 2 - version_type: external_gte - - match: { _id: "1" } - - - do: - catch: conflict - get: - index: test_1 - type: test - id: 1 - version: 10 - version_type: external_gte - - - do: - catch: conflict - get: - index: test_1 - type: test - id: 1 - version: 1 - version_type: external_gte diff --git a/server/build.gradle b/server/build.gradle index 647362ef3c0..c879ec68d7a 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -322,4 +322,6 @@ if (isEclipse == false || project.path == ":server-tests") { dependsOn: test.dependsOn) { include '**/*IT.class' } + check.dependsOn integTest + integTest.mustRunAfter test } diff --git a/server/licenses/lucene-analyzers-common-8.0.0-snapshot-aaa64d70159.jar.sha1 b/server/licenses/lucene-analyzers-common-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..13a5d6d7915 --- /dev/null +++ b/server/licenses/lucene-analyzers-common-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +c93cb302ae55231fa31df9f0261218c7c28220f9 \ No newline at end of file diff --git a/server/licenses/lucene-analyzers-common-8.0.0-snapshot-c78429a554.jar.sha1 b/server/licenses/lucene-analyzers-common-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index 32402660ab4..00000000000 --- a/server/licenses/lucene-analyzers-common-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -ada03def6399ef5606a77c93ee45514701b98987 \ No newline at end of file diff --git a/server/licenses/lucene-backward-codecs-8.0.0-snapshot-aaa64d70159.jar.sha1 b/server/licenses/lucene-backward-codecs-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..a66e3efb305 --- /dev/null +++ b/server/licenses/lucene-backward-codecs-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +472592ca23575c81e4d9afb5a96a4cd0011a1eec \ No newline at end of file diff --git a/server/licenses/lucene-backward-codecs-8.0.0-snapshot-c78429a554.jar.sha1 b/server/licenses/lucene-backward-codecs-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index 5b461a82bf0..00000000000 --- a/server/licenses/lucene-backward-codecs-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -c21b7cb3d2a3f34ea73b915cc15c67f203876ddf \ No newline at end of file diff --git a/server/licenses/lucene-core-8.0.0-snapshot-aaa64d70159.jar.sha1 b/server/licenses/lucene-core-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..06ff778cdf4 --- /dev/null +++ b/server/licenses/lucene-core-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +4367ce6eeceb1aefd34909dd54f37e5ba1d19155 \ No newline at end of file diff --git a/server/licenses/lucene-core-8.0.0-snapshot-c78429a554.jar.sha1 b/server/licenses/lucene-core-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index ad0dba43211..00000000000 --- a/server/licenses/lucene-core-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -a6149ea94d695ebad4e5037f2926ca20c768777d \ No newline at end of file diff --git a/server/licenses/lucene-grouping-8.0.0-snapshot-aaa64d70159.jar.sha1 b/server/licenses/lucene-grouping-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..d4cbca015e5 --- /dev/null +++ b/server/licenses/lucene-grouping-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +da31530f4b6e6af93d0bc48b5340f807dee4a674 \ No newline at end of file diff --git a/server/licenses/lucene-grouping-8.0.0-snapshot-c78429a554.jar.sha1 b/server/licenses/lucene-grouping-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index 448cbcc2e5c..00000000000 --- a/server/licenses/lucene-grouping-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -88de707d0913f9240114091a22bc178627792de3 \ No newline at end of file diff --git a/server/licenses/lucene-highlighter-8.0.0-snapshot-aaa64d70159.jar.sha1 b/server/licenses/lucene-highlighter-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..5f0cf0a9933 --- /dev/null +++ b/server/licenses/lucene-highlighter-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +a518c74fed29756129bd9d269a4e91608dc1f18a \ No newline at end of file diff --git a/server/licenses/lucene-highlighter-8.0.0-snapshot-c78429a554.jar.sha1 b/server/licenses/lucene-highlighter-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index bb1ca361034..00000000000 --- a/server/licenses/lucene-highlighter-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -9812a19bdccd3646fde3db3ed53ce17c8ecd2c72 \ No newline at end of file diff --git a/server/licenses/lucene-join-8.0.0-snapshot-aaa64d70159.jar.sha1 b/server/licenses/lucene-join-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..5813f16630c --- /dev/null +++ b/server/licenses/lucene-join-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +373ecf6b3d3327d39447fe5cbea4a7d39da45c96 \ No newline at end of file diff --git a/server/licenses/lucene-join-8.0.0-snapshot-c78429a554.jar.sha1 b/server/licenses/lucene-join-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index c007480abf5..00000000000 --- a/server/licenses/lucene-join-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -9877d38f3f966352812888014b9dd0fcd861b418 \ No newline at end of file diff --git a/server/licenses/lucene-memory-8.0.0-snapshot-aaa64d70159.jar.sha1 b/server/licenses/lucene-memory-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..aa72d2515e4 --- /dev/null +++ b/server/licenses/lucene-memory-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +6d06db3ebf77daf78d2e7bcddbc88939e3e4f209 \ No newline at end of file diff --git a/server/licenses/lucene-memory-8.0.0-snapshot-c78429a554.jar.sha1 b/server/licenses/lucene-memory-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index 60fa982ba6c..00000000000 --- a/server/licenses/lucene-memory-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -2ae87d38ad6b9f349de1a14c9fa2bc36d1e1126e \ No newline at end of file diff --git a/server/licenses/lucene-misc-8.0.0-snapshot-aaa64d70159.jar.sha1 b/server/licenses/lucene-misc-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..de50b0db279 --- /dev/null +++ b/server/licenses/lucene-misc-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +69daf0820f3765f09cd6ac58b0bd735cd715b36d \ No newline at end of file diff --git a/server/licenses/lucene-misc-8.0.0-snapshot-c78429a554.jar.sha1 b/server/licenses/lucene-misc-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index 426ded776cf..00000000000 --- a/server/licenses/lucene-misc-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -cb167b153ee422e222b314fb1aacf07742079b18 \ No newline at end of file diff --git a/server/licenses/lucene-queries-8.0.0-snapshot-aaa64d70159.jar.sha1 b/server/licenses/lucene-queries-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..859b30d8757 --- /dev/null +++ b/server/licenses/lucene-queries-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +ec1f69fab1272640930e837c52dd7e7ece9eac02 \ No newline at end of file diff --git a/server/licenses/lucene-queries-8.0.0-snapshot-c78429a554.jar.sha1 b/server/licenses/lucene-queries-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index beb09114c5d..00000000000 --- a/server/licenses/lucene-queries-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -5461afee0210ce1d2e9336e0a3f94ea7da64e491 \ No newline at end of file diff --git a/server/licenses/lucene-queryparser-8.0.0-snapshot-aaa64d70159.jar.sha1 b/server/licenses/lucene-queryparser-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..6a441fea88b --- /dev/null +++ b/server/licenses/lucene-queryparser-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +391c592312e63b9b3a524aaa7cd332fbd835a2d4 \ No newline at end of file diff --git a/server/licenses/lucene-queryparser-8.0.0-snapshot-c78429a554.jar.sha1 b/server/licenses/lucene-queryparser-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index 8d102a13b0b..00000000000 --- a/server/licenses/lucene-queryparser-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -28fd369ca80e1bee4a9830723348363850f25f91 \ No newline at end of file diff --git a/server/licenses/lucene-sandbox-8.0.0-snapshot-aaa64d70159.jar.sha1 b/server/licenses/lucene-sandbox-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..f6402714f12 --- /dev/null +++ b/server/licenses/lucene-sandbox-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +dbf82d3776adb6eedf79758b6f190dee177a4a48 \ No newline at end of file diff --git a/server/licenses/lucene-sandbox-8.0.0-snapshot-c78429a554.jar.sha1 b/server/licenses/lucene-sandbox-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index d7fb138ee28..00000000000 --- a/server/licenses/lucene-sandbox-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -7139424ecadad80df8127497f06d08d037c5e9cd \ No newline at end of file diff --git a/server/licenses/lucene-spatial-8.0.0-snapshot-aaa64d70159.jar.sha1 b/server/licenses/lucene-spatial-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..47cf0f7edef --- /dev/null +++ b/server/licenses/lucene-spatial-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +4be46166d77909b2cd77f4fcd799a6aa27653525 \ No newline at end of file diff --git a/server/licenses/lucene-spatial-8.0.0-snapshot-c78429a554.jar.sha1 b/server/licenses/lucene-spatial-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index e635dd5d365..00000000000 --- a/server/licenses/lucene-spatial-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -82f9b91f2e288af0b9cee8ccc561655f9d07ed70 \ No newline at end of file diff --git a/server/licenses/lucene-spatial-extras-8.0.0-snapshot-aaa64d70159.jar.sha1 b/server/licenses/lucene-spatial-extras-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..b6c84051e9f --- /dev/null +++ b/server/licenses/lucene-spatial-extras-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +c59ab3fead635dc8072b5baa8324f8449b66043d \ No newline at end of file diff --git a/server/licenses/lucene-spatial-extras-8.0.0-snapshot-c78429a554.jar.sha1 b/server/licenses/lucene-spatial-extras-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index 49365fd331c..00000000000 --- a/server/licenses/lucene-spatial-extras-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -add9ee3e5c59c0544c3c88a4c92695a630a20693 \ No newline at end of file diff --git a/server/licenses/lucene-spatial3d-8.0.0-snapshot-aaa64d70159.jar.sha1 b/server/licenses/lucene-spatial3d-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..187a3a2e833 --- /dev/null +++ b/server/licenses/lucene-spatial3d-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +06b279804b2acf70b1261f5df2dfc0a5fb316654 \ No newline at end of file diff --git a/server/licenses/lucene-spatial3d-8.0.0-snapshot-c78429a554.jar.sha1 b/server/licenses/lucene-spatial3d-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index 9d52029475a..00000000000 --- a/server/licenses/lucene-spatial3d-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -1b926af192edb666840bf23cfb2d8e72fc7373e7 \ No newline at end of file diff --git a/server/licenses/lucene-suggest-8.0.0-snapshot-aaa64d70159.jar.sha1 b/server/licenses/lucene-suggest-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..6ee9af8bf28 --- /dev/null +++ b/server/licenses/lucene-suggest-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +283aa39e821e030604efa261c414b78ddfa662d1 \ No newline at end of file diff --git a/server/licenses/lucene-suggest-8.0.0-snapshot-c78429a554.jar.sha1 b/server/licenses/lucene-suggest-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index 4802ff7908a..00000000000 --- a/server/licenses/lucene-suggest-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -e1926831397ff98ac0c68b3632b5d3365ee5062b \ No newline at end of file diff --git a/server/src/main/java/org/elasticsearch/action/support/DelegatingActionListener.java b/server/src/main/java/org/elasticsearch/action/support/DelegatingActionListener.java deleted file mode 100644 index ab37f81b076..00000000000 --- a/server/src/main/java/org/elasticsearch/action/support/DelegatingActionListener.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * A Simple class to handle wrapping a response with another response - */ -package org.elasticsearch.action.support; - -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.ActionResponse; - -public abstract class DelegatingActionListener - implements ActionListener { - - ActionListener delegatedActionListener; - - protected DelegatingActionListener(final ActionListener listener) { - this.delegatedActionListener = listener; - } - - protected abstract Delegated getDelegatedFromInstigator(Instigator response); - - @Override - public final void onResponse(Instigator response) { - delegatedActionListener.onResponse(getDelegatedFromInstigator(response)); - } - - @Override - public final void onFailure(Exception e) { - delegatedActionListener.onFailure(e); - } -} diff --git a/server/src/main/java/org/elasticsearch/action/termvectors/MultiTermVectorsResponse.java b/server/src/main/java/org/elasticsearch/action/termvectors/MultiTermVectorsResponse.java index 8508c834a9f..97a2007410e 100644 --- a/server/src/main/java/org/elasticsearch/action/termvectors/MultiTermVectorsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/termvectors/MultiTermVectorsResponse.java @@ -62,7 +62,10 @@ public class MultiTermVectorsResponse extends ActionResponse implements Iterable /** * The type of the action. + * + * @deprecated Types are in the process of being removed. */ + @Deprecated public String getType() { return type; } diff --git a/server/src/main/java/org/elasticsearch/action/termvectors/TermVectorsRequest.java b/server/src/main/java/org/elasticsearch/action/termvectors/TermVectorsRequest.java index dc849ca3d13..d7ee23c9a23 100644 --- a/server/src/main/java/org/elasticsearch/action/termvectors/TermVectorsRequest.java +++ b/server/src/main/java/org/elasticsearch/action/termvectors/TermVectorsRequest.java @@ -19,6 +19,7 @@ package org.elasticsearch.action.termvectors; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.Version; import org.elasticsearch.action.ActionRequestValidationException; @@ -32,6 +33,7 @@ import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.lucene.uid.Versions; import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -39,6 +41,7 @@ import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.index.VersionType; +import org.elasticsearch.rest.action.document.RestTermVectorsAction; import java.io.IOException; import java.util.ArrayList; @@ -60,6 +63,8 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; * required. */ public class TermVectorsRequest extends SingleShardRequest implements RealtimeRequest { + private static final DeprecationLogger deprecationLogger = new DeprecationLogger( + LogManager.getLogger(TermVectorsRequest.class)); private static final ParseField INDEX = new ParseField("_index"); private static final ParseField TYPE = new ParseField("_type"); @@ -621,6 +626,7 @@ public class TermVectorsRequest extends SingleShardRequest i termVectorsRequest.index = parser.text(); } else if (TYPE.match(currentFieldName, parser.getDeprecationHandler())) { termVectorsRequest.type = parser.text(); + deprecationLogger.deprecated(RestTermVectorsAction.TYPES_DEPRECATION_MESSAGE); } else if (ID.match(currentFieldName, parser.getDeprecationHandler())) { if (termVectorsRequest.doc != null) { throw new ElasticsearchParseException("failed to parse term vectors request. " + diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterBootstrapService.java b/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterBootstrapService.java index 093d3a2bf0e..e6e31d6d773 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterBootstrapService.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterBootstrapService.java @@ -72,7 +72,7 @@ public class ClusterBootstrapService { assert running == false; running = true; - if (initialMasterNodeCount > 0 && transportService.getLocalNode().isMasterNode()) { + if ((initialMasterNodeCount > 0 || initialMasterNodes.isEmpty() == false) && transportService.getLocalNode().isMasterNode()) { logger.debug("unsafely waiting for discovery of [{}] master-eligible nodes", initialMasterNodeCount); final ThreadContext threadContext = transportService.getThreadPool().getThreadContext(); @@ -80,7 +80,9 @@ public class ClusterBootstrapService { threadContext.markAsSystemContext(); final GetDiscoveredNodesRequest request = new GetDiscoveredNodesRequest(); - request.setWaitForNodes(initialMasterNodeCount); + if (initialMasterNodeCount > 0) { + request.setWaitForNodes(initialMasterNodeCount); + } request.setRequiredNodes(initialMasterNodes); request.setTimeout(null); logger.trace("sending {}", request); diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/Coordinator.java b/server/src/main/java/org/elasticsearch/cluster/coordination/Coordinator.java index 4869ace4946..0f2b44bdd92 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/Coordinator.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/Coordinator.java @@ -652,7 +652,7 @@ public class Coordinator extends AbstractLifecycleComponent implements Discovery .lastCommittedConfiguration(votingConfiguration) .build(); - MetaData.Builder metaDataBuilder = MetaData.builder(); + MetaData.Builder metaDataBuilder = MetaData.builder(currentState.metaData()); // automatically generate a UID for the metadata if we need to metaDataBuilder.generateClusterUuidIfNeeded(); // TODO generate UUID in bootstrapping tool? metaDataBuilder.coordinationMetaData(coordinationMetaData); diff --git a/test/framework/src/main/java/org/elasticsearch/cluster/coordination/InMemoryPersistedState.java b/server/src/main/java/org/elasticsearch/cluster/coordination/InMemoryPersistedState.java similarity index 100% rename from test/framework/src/main/java/org/elasticsearch/cluster/coordination/InMemoryPersistedState.java rename to server/src/main/java/org/elasticsearch/cluster/coordination/InMemoryPersistedState.java diff --git a/server/src/main/java/org/elasticsearch/discovery/DiscoveryModule.java b/server/src/main/java/org/elasticsearch/discovery/DiscoveryModule.java index e63e03fd87c..1d01b2d3cf6 100644 --- a/server/src/main/java/org/elasticsearch/discovery/DiscoveryModule.java +++ b/server/src/main/java/org/elasticsearch/discovery/DiscoveryModule.java @@ -22,10 +22,13 @@ package org.elasticsearch.discovery; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; import org.elasticsearch.cluster.ClusterState; +import org.elasticsearch.cluster.coordination.Coordinator; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.allocation.AllocationService; import org.elasticsearch.cluster.service.ClusterApplier; +import org.elasticsearch.cluster.service.ClusterApplierService; import org.elasticsearch.cluster.service.MasterService; +import org.elasticsearch.common.Randomness; import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.settings.ClusterSettings; @@ -58,14 +61,19 @@ import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collectors; +import static org.elasticsearch.node.Node.NODE_NAME_SETTING; + /** * A module for loading classes for node discovery. */ public class DiscoveryModule { private static final Logger logger = LogManager.getLogger(DiscoveryModule.class); + public static final String ZEN_DISCOVERY_TYPE = "zen"; + public static final String ZEN2_DISCOVERY_TYPE = "zen2"; + public static final Setting DISCOVERY_TYPE_SETTING = - new Setting<>("discovery.type", "zen", Function.identity(), Property.NodeScope); + new Setting<>("discovery.type", ZEN_DISCOVERY_TYPE, Function.identity(), Property.NodeScope); public static final Setting> DISCOVERY_HOSTS_PROVIDER_SETTING = Setting.listSetting("discovery.zen.hosts_provider", Collections.emptyList(), Function.identity(), Property.NodeScope); @@ -75,14 +83,14 @@ public class DiscoveryModule { NamedWriteableRegistry namedWriteableRegistry, NetworkService networkService, MasterService masterService, ClusterApplier clusterApplier, ClusterSettings clusterSettings, List plugins, AllocationService allocationService, Path configFile, GatewayMetaState gatewayMetaState) { - final Collection> joinValidators = new ArrayList<>(); + final Collection> joinValidators = new ArrayList<>(); final Map> hostProviders = new HashMap<>(); hostProviders.put("settings", () -> new SettingsBasedHostsProvider(settings, transportService)); hostProviders.put("file", () -> new FileBasedUnicastHostsProvider(configFile)); for (DiscoveryPlugin plugin : plugins) { - plugin.getZenHostsProviders(transportService, networkService).entrySet().forEach(entry -> { - if (hostProviders.put(entry.getKey(), entry.getValue()) != null) { - throw new IllegalArgumentException("Cannot register zen hosts provider [" + entry.getKey() + "] twice"); + plugin.getZenHostsProviders(transportService, networkService).forEach((key, value) -> { + if (hostProviders.put(key, value) != null) { + throw new IllegalArgumentException("Cannot register zen hosts provider [" + key + "] twice"); } }); BiConsumer joinValidator = plugin.getJoinValidator(); @@ -117,18 +125,21 @@ public class DiscoveryModule { }; Map> discoveryTypes = new HashMap<>(); - discoveryTypes.put("zen", + discoveryTypes.put(ZEN_DISCOVERY_TYPE, () -> new ZenDiscovery(settings, threadPool, transportService, namedWriteableRegistry, masterService, clusterApplier, clusterSettings, hostsProvider, allocationService, Collections.unmodifiableCollection(joinValidators), gatewayMetaState)); + discoveryTypes.put(ZEN2_DISCOVERY_TYPE, () -> new Coordinator(NODE_NAME_SETTING.get(settings), settings, clusterSettings, + transportService, namedWriteableRegistry, allocationService, masterService, + () -> gatewayMetaState.getPersistedState(settings, (ClusterApplierService) clusterApplier), hostsProvider, clusterApplier, + Randomness.get())); discoveryTypes.put("single-node", () -> new SingleNodeDiscovery(settings, transportService, masterService, clusterApplier)); for (DiscoveryPlugin plugin : plugins) { - plugin.getDiscoveryTypes(threadPool, transportService, namedWriteableRegistry, - masterService, clusterApplier, clusterSettings, hostsProvider, allocationService, gatewayMetaState).entrySet() - .forEach(entry -> { - if (discoveryTypes.put(entry.getKey(), entry.getValue()) != null) { - throw new IllegalArgumentException("Cannot register discovery type [" + entry.getKey() + "] twice"); - } - }); + plugin.getDiscoveryTypes(threadPool, transportService, namedWriteableRegistry, masterService, clusterApplier, clusterSettings, + hostsProvider, allocationService, gatewayMetaState).forEach((key, value) -> { + if (discoveryTypes.put(key, value) != null) { + throw new IllegalArgumentException("Cannot register discovery type [" + key + "] twice"); + } + }); } String discoveryType = DISCOVERY_TYPE_SETTING.get(settings); Supplier discoverySupplier = discoveryTypes.get(discoveryType); diff --git a/server/src/main/java/org/elasticsearch/gateway/GatewayMetaState.java b/server/src/main/java/org/elasticsearch/gateway/GatewayMetaState.java index 9b137070cb8..7d3a905d30e 100644 --- a/server/src/main/java/org/elasticsearch/gateway/GatewayMetaState.java +++ b/server/src/main/java/org/elasticsearch/gateway/GatewayMetaState.java @@ -22,6 +22,7 @@ package org.elasticsearch.gateway; import com.carrotsearch.hppc.cursors.ObjectObjectCursor; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.Version; import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.ClusterName; @@ -29,6 +30,8 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateApplier; import org.elasticsearch.cluster.block.ClusterBlocks; import org.elasticsearch.cluster.coordination.CoordinationState; +import org.elasticsearch.cluster.coordination.CoordinationState.PersistedState; +import org.elasticsearch.cluster.coordination.InMemoryPersistedState; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.Manifest; import org.elasticsearch.cluster.metadata.MetaData; @@ -36,6 +39,7 @@ import org.elasticsearch.cluster.metadata.MetaDataIndexUpgradeService; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.RoutingNode; import org.elasticsearch.cluster.routing.ShardRouting; +import org.elasticsearch.cluster.service.ClusterApplierService; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.collect.Tuple; @@ -108,6 +112,17 @@ public class GatewayMetaState implements ClusterStateApplier, CoordinationState. incrementalWrite = false; } + public PersistedState getPersistedState(Settings settings, ClusterApplierService clusterApplierService) { + applyClusterStateUpdaters(); + if (DiscoveryNode.isMasterNode(settings) == false) { + // use Zen1 way of writing cluster state for non-master-eligible nodes + // this avoids concurrent manipulating of IndexMetadata with IndicesStore + clusterApplierService.addLowPriorityApplier(this); + return new InMemoryPersistedState(getCurrentTerm(), getLastAcceptedState()); + } + return this; + } + private void initializeClusterState(ClusterName clusterName) throws IOException { long startNS = System.nanoTime(); Tuple manifestAndMetaData = metaStateService.loadFullState(); @@ -235,8 +250,8 @@ public class GatewayMetaState implements ClusterStateApplier, CoordinationState. try { innerSetCurrentTerm(currentTerm); } catch (WriteStateException e) { - logger.warn("Exception occurred when setting current term", e); - //TODO re-throw exception + logger.error(new ParameterizedMessage("Failed to set current term to {}", currentTerm), e); + e.rethrowAsErrorOrUncheckedException(); } } @@ -253,8 +268,8 @@ public class GatewayMetaState implements ClusterStateApplier, CoordinationState. incrementalWrite = previousClusterState.term() == clusterState.term(); updateClusterState(clusterState, previousClusterState); } catch (WriteStateException e) { - logger.warn("Exception occurred when setting last accepted state", e); - //TODO re-throw exception + logger.error(new ParameterizedMessage("Failed to set last accepted state with version {}", clusterState.version()), e); + e.rethrowAsErrorOrUncheckedException(); } } diff --git a/server/src/main/java/org/elasticsearch/gateway/WriteStateException.java b/server/src/main/java/org/elasticsearch/gateway/WriteStateException.java index aeb9bffc671..29699be2c16 100644 --- a/server/src/main/java/org/elasticsearch/gateway/WriteStateException.java +++ b/server/src/main/java/org/elasticsearch/gateway/WriteStateException.java @@ -18,7 +18,9 @@ */ package org.elasticsearch.gateway; +import java.io.IOError; import java.io.IOException; +import java.io.UncheckedIOException; /** * This exception is thrown when there is a problem of writing state to disk. @@ -38,4 +40,16 @@ public class WriteStateException extends IOException { public boolean isDirty() { return dirty; } + + /** + * Rethrows this {@link WriteStateException} as {@link IOError} if dirty flag is set, which will lead to JVM shutdown. + * If dirty flag is not set, this exception is wrapped into {@link UncheckedIOException}. + */ + public void rethrowAsErrorOrUncheckedException() { + if (isDirty()) { + throw new IOError(this); + } else { + throw new UncheckedIOException(this); + } + } } diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java index f8dc2c01670..4ce5956ce38 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java @@ -19,12 +19,14 @@ package org.elasticsearch.rest.action.document; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.action.termvectors.MultiTermVectorsRequest; -import org.elasticsearch.action.termvectors.MultiTermVectorsResponse; import org.elasticsearch.action.termvectors.TermVectorsRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; @@ -36,6 +38,11 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestMultiTermVectorsAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = new DeprecationLogger( + LogManager.getLogger(RestTermVectorsAction.class)); + static final String TYPES_DEPRECATION_MESSAGE = "[types removal] " + + "Specifying types in multi term vector requests is deprecated."; + public RestMultiTermVectorsAction(Settings settings, RestController controller) { super(settings); controller.registerHandler(GET, "/_mtermvectors", this); @@ -54,14 +61,21 @@ public class RestMultiTermVectorsAction extends BaseRestHandler { @Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { MultiTermVectorsRequest multiTermVectorsRequest = new MultiTermVectorsRequest(); - TermVectorsRequest template = new TermVectorsRequest(); - template.index(request.param("index")); - template.type(request.param("type")); + TermVectorsRequest template = new TermVectorsRequest() + .index(request.param("index")); + + if (request.hasParam("type")) { + deprecationLogger.deprecated(TYPES_DEPRECATION_MESSAGE); + template.type(request.param("type")); + } else { + template.type(MapperService.SINGLE_MAPPING_NAME); + } + RestTermVectorsAction.readURIParameters(template, request); multiTermVectorsRequest.ids(Strings.commaDelimitedListToStringArray(request.param("ids"))); request.withContentOrSourceParamParserOrNull(p -> multiTermVectorsRequest.add(template, p)); - return channel -> client.multiTermVectors(multiTermVectorsRequest, new RestToXContentListener(channel)); + return channel -> client.multiTermVectors(multiTermVectorsRequest, new RestToXContentListener<>(channel)); } } diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java index 89b8b9267f6..39c1fb922e9 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java @@ -19,12 +19,15 @@ package org.elasticsearch.rest.action.document; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.action.termvectors.TermVectorsRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.VersionType; +import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; @@ -43,13 +46,23 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; * TermVectorsRequest. */ public class RestTermVectorsAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = new DeprecationLogger( + LogManager.getLogger(RestTermVectorsAction.class)); + public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] " + + "Specifying types in term vector requests is deprecated."; public RestTermVectorsAction(Settings settings, RestController controller) { super(settings); + controller.registerHandler(GET, "/{index}/{type}/_termvectors", this); controller.registerHandler(POST, "/{index}/{type}/_termvectors", this); controller.registerHandler(GET, "/{index}/{type}/{id}/_termvectors", this); controller.registerHandler(POST, "/{index}/{type}/{id}/_termvectors", this); + + controller.registerHandler(GET, "/{index}/_termvectors", this); + controller.registerHandler(POST, "/{index}/_termvectors", this); + controller.registerHandler(GET, "/{index}/_termvectors/{id}", this); + controller.registerHandler(POST, "/{index}/_termvectors/{id}", this); } @Override @@ -59,7 +72,18 @@ public class RestTermVectorsAction extends BaseRestHandler { @Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { - TermVectorsRequest termVectorsRequest = new TermVectorsRequest(request.param("index"), request.param("type"), request.param("id")); + TermVectorsRequest termVectorsRequest; + if (request.hasParam("type")) { + deprecationLogger.deprecated(TYPES_DEPRECATION_MESSAGE); + termVectorsRequest = new TermVectorsRequest(request.param("index"), + request.param("type"), + request.param("id")); + } else { + termVectorsRequest = new TermVectorsRequest(request.param("index"), + MapperService.SINGLE_MAPPING_NAME, + request.param("id")); + } + if (request.hasContentOrSourceParam()) { try (XContentParser parser = request.contentOrSourceParamParser()) { TermVectorsRequest.parseRequest(termVectorsRequest, parser); diff --git a/server/src/main/java/org/elasticsearch/script/ScriptService.java b/server/src/main/java/org/elasticsearch/script/ScriptService.java index 6eea53a9b7d..f1472afba93 100644 --- a/server/src/main/java/org/elasticsearch/script/ScriptService.java +++ b/server/src/main/java/org/elasticsearch/script/ScriptService.java @@ -139,8 +139,9 @@ public class ScriptService implements Closeable, ClusterStateApplier { this.contexts = Objects.requireNonNull(contexts); if (Strings.hasLength(settings.get(DISABLE_DYNAMIC_SCRIPTING_SETTING))) { - throw new IllegalArgumentException(DISABLE_DYNAMIC_SCRIPTING_SETTING + " is not a supported setting, replace with fine-grained script settings. \n" + - "Dynamic scripts can be enabled for all languages and all operations not using `script.disable_dynamic: false` in elasticsearch.yml"); + throw new IllegalArgumentException(DISABLE_DYNAMIC_SCRIPTING_SETTING + " is not a supported setting, replace with " + + "fine-grained script settings. \n Dynamic scripts can be enabled for all languages and all operations not " + + "using `script.disable_dynamic: false` in elasticsearch.yml"); } this.typesAllowed = TYPES_ALLOWED_SETTING.exists(settings) ? new HashSet<>() : null; @@ -357,7 +358,8 @@ public class ScriptService implements Closeable, ClusterStateApplier { // TODO: remove this try-catch completely, when all script engines have good exceptions! throw good; // its already good } catch (Exception exception) { - throw new GeneralScriptException("Failed to compile " + type + " script [" + id + "] using lang [" + lang + "]", exception); + throw new GeneralScriptException("Failed to compile " + type + " script [" + id + "] using lang [" + lang + "]", + exception); } // Since the cache key is the script content itself we don't need to diff --git a/server/src/main/java/org/elasticsearch/search/MultiValueMode.java b/server/src/main/java/org/elasticsearch/search/MultiValueMode.java index 249a110b01d..8803a2a91d8 100644 --- a/server/src/main/java/org/elasticsearch/search/MultiValueMode.java +++ b/server/src/main/java/org/elasticsearch/search/MultiValueMode.java @@ -63,7 +63,8 @@ public enum MultiValueMode implements Writeable { } @Override - protected long pick(SortedNumericDocValues values, long missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, int maxChildren) throws IOException { + protected long pick(SortedNumericDocValues values, long missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, + int maxChildren) throws IOException { int totalCount = 0; long totalValue = 0; int count = 0; @@ -94,7 +95,8 @@ public enum MultiValueMode implements Writeable { } @Override - protected double pick(SortedNumericDoubleValues values, double missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, int maxChildren) throws IOException { + protected double pick(SortedNumericDoubleValues values, double missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, + int maxChildren) throws IOException { int totalCount = 0; double totalValue = 0; int count = 0; @@ -130,7 +132,8 @@ public enum MultiValueMode implements Writeable { } @Override - protected long pick(SortedNumericDocValues values, long missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, int maxChildren) throws IOException { + protected long pick(SortedNumericDocValues values, long missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, + int maxChildren) throws IOException { int totalCount = 0; long totalValue = 0; int count = 0; @@ -163,7 +166,8 @@ public enum MultiValueMode implements Writeable { } @Override - protected double pick(SortedNumericDoubleValues values, double missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, int maxChildren) throws IOException { + protected double pick(SortedNumericDoubleValues values, double missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, + int maxChildren) throws IOException { int totalCount = 0; double totalValue = 0; int count = 0; @@ -227,7 +231,8 @@ public enum MultiValueMode implements Writeable { } @Override - protected long pick(SortedNumericDocValues values, long missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, int maxChildren) throws IOException { + protected long pick(SortedNumericDocValues values, long missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, + int maxChildren) throws IOException { boolean hasValue = false; long minValue = Long.MAX_VALUE; int count = 0; @@ -249,7 +254,8 @@ public enum MultiValueMode implements Writeable { } @Override - protected double pick(SortedNumericDoubleValues values, double missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, int maxChildren) throws IOException { + protected double pick(SortedNumericDoubleValues values, double missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, + int maxChildren) throws IOException { boolean hasValue = false; double minValue = Double.POSITIVE_INFINITY; int count = 0; @@ -271,7 +277,8 @@ public enum MultiValueMode implements Writeable { } @Override - protected BytesRef pick(BinaryDocValues values, BytesRefBuilder builder, DocIdSetIterator docItr, int startDoc, int endDoc, int maxChildren) throws IOException { + protected BytesRef pick(BinaryDocValues values, BytesRefBuilder builder, DocIdSetIterator docItr, int startDoc, int endDoc, + int maxChildren) throws IOException { BytesRefBuilder bytesRefBuilder = null; int count = 0; for (int doc = startDoc; doc < endDoc; doc = docItr.nextDoc()) { @@ -333,7 +340,8 @@ public enum MultiValueMode implements Writeable { } @Override - protected long pick(SortedNumericDocValues values, long missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, int maxChildren) throws IOException { + protected long pick(SortedNumericDocValues values, long missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, + int maxChildren) throws IOException { boolean hasValue = false; long maxValue = Long.MIN_VALUE; int count = 0; @@ -363,7 +371,8 @@ public enum MultiValueMode implements Writeable { } @Override - protected double pick(SortedNumericDoubleValues values, double missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, int maxChildren) throws IOException { + protected double pick(SortedNumericDoubleValues values, double missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, + int maxChildren) throws IOException { boolean hasValue = false; double maxValue = Double.NEGATIVE_INFINITY; int count = 0; @@ -393,7 +402,8 @@ public enum MultiValueMode implements Writeable { } @Override - protected BytesRef pick(BinaryDocValues values, BytesRefBuilder builder, DocIdSetIterator docItr, int startDoc, int endDoc, int maxChildren) throws IOException { + protected BytesRef pick(BinaryDocValues values, BytesRefBuilder builder, DocIdSetIterator docItr, int startDoc, int endDoc, + int maxChildren) throws IOException { BytesRefBuilder bytesRefBuilder = null; int count = 0; for (int doc = startDoc; doc < endDoc; doc = docItr.nextDoc()) { @@ -508,7 +518,8 @@ public enum MultiValueMode implements Writeable { * NOTE: Calling the returned instance on docs that are not root docs is illegal * The returned instance can only be evaluate the current and upcoming docs */ - public NumericDocValues select(final SortedNumericDocValues values, final long missingValue, final BitSet parentDocs, final DocIdSetIterator childDocs, int maxDoc, int maxChildren) throws IOException { + public NumericDocValues select(final SortedNumericDocValues values, final long missingValue, final BitSet parentDocs, + final DocIdSetIterator childDocs, int maxDoc, int maxChildren) throws IOException { if (parentDocs == null || childDocs == null) { return FieldData.replaceMissing(DocValues.emptyNumeric(), missingValue); } @@ -552,7 +563,8 @@ public enum MultiValueMode implements Writeable { }; } - protected long pick(SortedNumericDocValues values, long missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, int maxChildren) throws IOException { + protected long pick(SortedNumericDocValues values, long missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, + int maxChildren) throws IOException { throw new IllegalArgumentException("Unsupported sort mode: " + this); } @@ -605,7 +617,8 @@ public enum MultiValueMode implements Writeable { * NOTE: Calling the returned instance on docs that are not root docs is illegal * The returned instance can only be evaluate the current and upcoming docs */ - public NumericDoubleValues select(final SortedNumericDoubleValues values, final double missingValue, final BitSet parentDocs, final DocIdSetIterator childDocs, int maxDoc, int maxChildren) throws IOException { + public NumericDoubleValues select(final SortedNumericDoubleValues values, final double missingValue, final BitSet parentDocs, + final DocIdSetIterator childDocs, int maxDoc, int maxChildren) throws IOException { if (parentDocs == null || childDocs == null) { return FieldData.replaceMissing(FieldData.emptyNumericDouble(), missingValue); } @@ -641,7 +654,8 @@ public enum MultiValueMode implements Writeable { }; } - protected double pick(SortedNumericDoubleValues values, double missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, int maxChildren) throws IOException { + protected double pick(SortedNumericDoubleValues values, double missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, + int maxChildren) throws IOException { throw new IllegalArgumentException("Unsupported sort mode: " + this); } @@ -713,7 +727,8 @@ public enum MultiValueMode implements Writeable { * NOTE: Calling the returned instance on docs that are not root docs is illegal * The returned instance can only be evaluate the current and upcoming docs */ - public BinaryDocValues select(final SortedBinaryDocValues values, final BytesRef missingValue, final BitSet parentDocs, final DocIdSetIterator childDocs, int maxDoc, int maxChildren) throws IOException { + public BinaryDocValues select(final SortedBinaryDocValues values, final BytesRef missingValue, final BitSet parentDocs, + final DocIdSetIterator childDocs, int maxDoc, int maxChildren) throws IOException { if (parentDocs == null || childDocs == null) { return select(FieldData.emptySortedBinary(), missingValue); } @@ -756,7 +771,8 @@ public enum MultiValueMode implements Writeable { }; } - protected BytesRef pick(BinaryDocValues values, BytesRefBuilder builder, DocIdSetIterator docItr, int startDoc, int endDoc, int maxChildren) throws IOException { + protected BytesRef pick(BinaryDocValues values, BytesRefBuilder builder, DocIdSetIterator docItr, int startDoc, int endDoc, + int maxChildren) throws IOException { throw new IllegalArgumentException("Unsupported sort mode: " + this); } @@ -768,7 +784,8 @@ public enum MultiValueMode implements Writeable { */ public SortedDocValues select(final SortedSetDocValues values) { if (values.getValueCount() >= Integer.MAX_VALUE) { - throw new UnsupportedOperationException("fields containing more than " + (Integer.MAX_VALUE - 1) + " unique terms are unsupported"); + throw new UnsupportedOperationException("fields containing more than " + (Integer.MAX_VALUE - 1) + + " unique terms are unsupported"); } final SortedDocValues singleton = DocValues.unwrapSingleton(values); @@ -829,7 +846,8 @@ public enum MultiValueMode implements Writeable { * NOTE: Calling the returned instance on docs that are not root docs is illegal * The returned instance can only be evaluate the current and upcoming docs */ - public SortedDocValues select(final SortedSetDocValues values, final BitSet parentDocs, final DocIdSetIterator childDocs, int maxChildren) throws IOException { + public SortedDocValues select(final SortedSetDocValues values, final BitSet parentDocs, final DocIdSetIterator childDocs, + int maxChildren) throws IOException { if (parentDocs == null || childDocs == null) { return select(DocValues.emptySortedSet()); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/AggregatorFactories.java b/server/src/main/java/org/elasticsearch/search/aggregations/AggregatorFactories.java index 5bfb575bee8..d6eb73514d9 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/AggregatorFactories.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/AggregatorFactories.java @@ -394,7 +394,8 @@ public class AggregatorFactories { } // Check the pipeline sub-aggregator factories if (!foundSubBuilder && (i == bucketsPathElements.size() - 1)) { - Collection subPipelineBuilders = aggBuilder.factoriesBuilder.pipelineAggregatorBuilders; + Collection subPipelineBuilders = aggBuilder.factoriesBuilder + .pipelineAggregatorBuilders; for (PipelineAggregationBuilder subFactory : subPipelineBuilders) { if (aggName.equals(subFactory.getName())) { foundSubBuilder = true; diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/InternalMultiBucketAggregation.java b/server/src/main/java/org/elasticsearch/search/aggregations/InternalMultiBucketAggregation.java index 9084f415d77..00a5271f7f5 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/InternalMultiBucketAggregation.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/InternalMultiBucketAggregation.java @@ -29,8 +29,10 @@ import java.io.IOException; import java.util.List; import java.util.Map; -public abstract class InternalMultiBucketAggregation +public abstract class InternalMultiBucketAggregation extends InternalAggregation implements MultiBucketsAggregation { + public InternalMultiBucketAggregation(String name, List pipelineAggregators, Map metaData) { super(name, pipelineAggregators, metaData); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/BucketsAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/BucketsAggregator.java index 7b09ac9d618..71dacc698be 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/BucketsAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/BucketsAggregator.java @@ -116,8 +116,8 @@ public abstract class BucketsAggregator extends AggregatorBase { if (bucketOrd >= docCounts.size()) { // This may happen eg. if no document in the highest buckets is accepted by a sub aggregator. // For example, if there is a long terms agg on 3 terms 1,2,3 with a sub filter aggregator and if no document with 3 as a value - // matches the filter, then the filter will never collect bucket ord 3. However, the long terms agg will call bucketAggregations(3) - // on the filter aggregator anyway to build sub-aggregations. + // matches the filter, then the filter will never collect bucket ord 3. However, the long terms agg will call + // bucketAggregations(3) on the filter aggregator anyway to build sub-aggregations. return 0; } else { return docCounts.get(bucketOrd); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregator.java index 700145b94fa..f43cfae61ba 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregator.java @@ -48,8 +48,8 @@ public class GeoHashGridAggregator extends BucketsAggregator { private final LongHash bucketOrds; GeoHashGridAggregator(String name, AggregatorFactories factories, GeoGridAggregationBuilder.CellIdSource valuesSource, - int requiredSize, int shardSize, SearchContext aggregationContext, Aggregator parent, List pipelineAggregators, - Map metaData) throws IOException { + int requiredSize, int shardSize, SearchContext aggregationContext, Aggregator parent, + List pipelineAggregators, Map metaData) throws IOException { super(name, factories, aggregationContext, parent, pipelineAggregators, metaData); this.valuesSource = valuesSource; this.requiredSize = requiredSize; diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregator.java index e72b609494b..1295cec2e4b 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregator.java @@ -150,7 +150,8 @@ class HistogramAggregator extends BucketsAggregator { if (minDocCount == 0) { emptyBucketInfo = new EmptyBucketInfo(interval, offset, minBound, maxBound, buildEmptySubAggregations()); } - return new InternalHistogram(name, buckets, order, minDocCount, emptyBucketInfo, formatter, keyed, pipelineAggregators(), metaData()); + return new InternalHistogram(name, buckets, order, minDocCount, emptyBucketInfo, formatter, keyed, pipelineAggregators(), + metaData()); } @Override @@ -159,7 +160,8 @@ class HistogramAggregator extends BucketsAggregator { if (minDocCount == 0) { emptyBucketInfo = new EmptyBucketInfo(interval, offset, minBound, maxBound, buildEmptySubAggregations()); } - return new InternalHistogram(name, Collections.emptyList(), order, minDocCount, emptyBucketInfo, formatter, keyed, pipelineAggregators(), metaData()); + return new InternalHistogram(name, Collections.emptyList(), order, minDocCount, emptyBucketInfo, formatter, keyed, + pipelineAggregators(), metaData()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/missing/MissingAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/missing/MissingAggregator.java index c4be1eef808..e6ff14de31d 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/missing/MissingAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/missing/MissingAggregator.java @@ -72,8 +72,8 @@ public class MissingAggregator extends BucketsAggregator implements SingleBucket @Override public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException { - return new InternalMissing(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), pipelineAggregators(), - metaData()); + return new InternalMissing(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), + pipelineAggregators(), metaData()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/ReverseNestedAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/ReverseNestedAggregator.java index 338093af377..415ae39c71e 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/ReverseNestedAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/ReverseNestedAggregator.java @@ -94,8 +94,8 @@ public class ReverseNestedAggregator extends BucketsAggregator implements Single @Override public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException { - return new InternalReverseNested(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), pipelineAggregators(), - metaData()); + return new InternalReverseNested(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), + pipelineAggregators(), metaData()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregator.java index 9050f1e49f1..c4e2d1fc439 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregator.java @@ -333,7 +333,8 @@ public class RangeAggregator extends BucketsAggregator { Range range = ranges[i]; final long bucketOrd = subBucketOrdinal(owningBucketOrdinal, i); org.elasticsearch.search.aggregations.bucket.range.Range.Bucket bucket = - rangeFactory.createBucket(range.key, range.from, range.to, bucketDocCount(bucketOrd), bucketAggregations(bucketOrd), keyed, format); + rangeFactory.createBucket(range.key, range.from, range.to, bucketDocCount(bucketOrd), + bucketAggregations(bucketOrd), keyed, format); buckets.add(bucket); } // value source can be null in the case of unmapped fields @@ -361,9 +362,8 @@ public class RangeAggregator extends BucketsAggregator { private final InternalRange.Factory factory; private final DocValueFormat format; - public Unmapped(String name, R[] ranges, boolean keyed, DocValueFormat format, - SearchContext context, - Aggregator parent, InternalRange.Factory factory, List pipelineAggregators, Map metaData) + public Unmapped(String name, R[] ranges, boolean keyed, DocValueFormat format, SearchContext context, Aggregator parent, + InternalRange.Factory factory, List pipelineAggregators, Map metaData) throws IOException { super(name, context, parent, pipelineAggregators, metaData); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorFactory.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorFactory.java index 4054f3796d9..7fe41407af4 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorFactory.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorFactory.java @@ -214,8 +214,9 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac DocValueFormat format = config.format(); if ((includeExclude != null) && (includeExclude.isRegexBased()) && format != DocValueFormat.RAW) { - throw new AggregationExecutionException("Aggregation [" + name + "] cannot support regular expression style include/exclude " - + "settings as they can only be applied to string fields. Use an array of values for include/exclude clauses"); + throw new AggregationExecutionException("Aggregation [" + name + "] cannot support regular expression style " + + "include/exclude settings as they can only be applied to string fields. Use an array of values for " + + "include/exclude clauses"); } return execution.create(name, factories, valuesSource, format, bucketCountThresholds, includeExclude, context, parent, @@ -224,7 +225,8 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac if ((includeExclude != null) && (includeExclude.isRegexBased())) { throw new AggregationExecutionException("Aggregation [" + name + "] cannot support regular expression style include/exclude " - + "settings as they can only be applied to string fields. Use an array of numeric values for include/exclude clauses used to filter numeric fields"); + + "settings as they can only be applied to string fields. Use an array of numeric values for include/exclude clauses " + + "used to filter numeric fields"); } if (valuesSource instanceof ValuesSource.Numeric) { @@ -301,7 +303,8 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac } return new GlobalOrdinalsSignificantTermsAggregator(name, factories, (ValuesSource.Bytes.WithOrdinals.FieldData) valuesSource, format, bucketCountThresholds, filter, - aggregationContext, parent, remapGlobalOrd, significanceHeuristic, termsAggregatorFactory, pipelineAggregators, metaData); + aggregationContext, parent, remapGlobalOrd, significanceHeuristic, termsAggregatorFactory, pipelineAggregators, + metaData); } }; diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/GND.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/GND.java index f0347f9248b..66b45b54f64 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/GND.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/GND.java @@ -121,7 +121,8 @@ public class GND extends NXYSignificanceHeuristic { parser.nextToken(); backgroundIsSuperset = parser.booleanValue(); } else { - throw new ElasticsearchParseException("failed to parse [{}] significance heuristic. unknown field [{}]", givenName, parser.currentName()); + throw new ElasticsearchParseException("failed to parse [{}] significance heuristic. unknown field [{}]", + givenName, parser.currentName()); } token = parser.nextToken(); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/NXYSignificanceHeuristic.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/NXYSignificanceHeuristic.java index 5da082537bc..b01bc8c1650 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/NXYSignificanceHeuristic.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/NXYSignificanceHeuristic.java @@ -37,7 +37,8 @@ public abstract class NXYSignificanceHeuristic extends SignificanceHeuristic { protected static final ParseField INCLUDE_NEGATIVES_FIELD = new ParseField("include_negatives"); - protected static final String SCORE_ERROR_MESSAGE = ", does your background filter not include all documents in the bucket? If so and it is intentional, set \"" + BACKGROUND_IS_SUPERSET.getPreferredName() + "\": false"; + protected static final String SCORE_ERROR_MESSAGE = ", does your background filter not include all documents in the bucket? " + + "If so and it is intentional, set \"" + BACKGROUND_IS_SUPERSET.getPreferredName() + "\": false"; protected final boolean backgroundIsSuperset; @@ -176,7 +177,8 @@ public abstract class NXYSignificanceHeuristic extends SignificanceHeuristic { parser.nextToken(); backgroundIsSuperset = parser.booleanValue(); } else { - throw new ElasticsearchParseException("failed to parse [{}] significance heuristic. unknown field [{}]", givenName, parser.currentName()); + throw new ElasticsearchParseException("failed to parse [{}] significance heuristic. unknown field [{}]", + givenName, parser.currentName()); } token = parser.nextToken(); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/PercentageScore.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/PercentageScore.java index 9220adf87d2..80f1fece739 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/PercentageScore.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/PercentageScore.java @@ -59,7 +59,8 @@ public class PercentageScore extends SignificanceHeuristic { throws IOException, QueryShardException { // move to the closing bracket if (!parser.nextToken().equals(XContentParser.Token.END_OBJECT)) { - throw new ElasticsearchParseException("failed to parse [percentage] significance heuristic. expected an empty object, but got [{}] instead", parser.currentToken()); + throw new ElasticsearchParseException("failed to parse [percentage] significance heuristic. expected an empty object, " + + "but got [{}] instead", parser.currentToken()); } return new PercentageScore(); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/ScriptHeuristic.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/ScriptHeuristic.java index 05415cf7d19..3d142742b5c 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/ScriptHeuristic.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/ScriptHeuristic.java @@ -95,14 +95,16 @@ public class ScriptHeuristic extends SignificanceHeuristic { @Override public SignificanceHeuristic rewrite(InternalAggregation.ReduceContext context) { - SignificantTermsHeuristicScoreScript.Factory factory = context.scriptService().compile(script, SignificantTermsHeuristicScoreScript.CONTEXT); + SignificantTermsHeuristicScoreScript.Factory factory = context.scriptService().compile(script, + SignificantTermsHeuristicScoreScript.CONTEXT); return new ExecutableScriptHeuristic(script, factory.newInstance()); } @Override public SignificanceHeuristic rewrite(SearchContext context) { QueryShardContext shardContext = context.getQueryShardContext(); - SignificantTermsHeuristicScoreScript.Factory compiledScript = shardContext.getScriptService().compile(script, SignificantTermsHeuristicScoreScript.CONTEXT); + SignificantTermsHeuristicScoreScript.Factory compiledScript = shardContext.getScriptService().compile(script, + SignificantTermsHeuristicScoreScript.CONTEXT); return new ExecutableScriptHeuristic(script, compiledScript.newInstance()); } @@ -118,7 +120,8 @@ public class ScriptHeuristic extends SignificanceHeuristic { */ @Override public double getScore(long subsetFreq, long subsetSize, long supersetFreq, long supersetSize) { - throw new UnsupportedOperationException("This scoring heuristic must have 'rewrite' called on it to provide a version ready for use"); + throw new UnsupportedOperationException("This scoring heuristic must have 'rewrite' called on it to provide a version ready " + + "for use"); } @Override @@ -165,13 +168,15 @@ public class ScriptHeuristic extends SignificanceHeuristic { if (Script.SCRIPT_PARSE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { script = Script.parse(parser); } else { - throw new ElasticsearchParseException("failed to parse [{}] significance heuristic. unknown object [{}]", heuristicName, currentFieldName); + throw new ElasticsearchParseException("failed to parse [{}] significance heuristic. unknown object [{}]", + heuristicName, currentFieldName); } } } if (script == null) { - throw new ElasticsearchParseException("failed to parse [{}] significance heuristic. no script found in script_heuristic", heuristicName); + throw new ElasticsearchParseException("failed to parse [{}] significance heuristic. no script found in script_heuristic", + heuristicName); } return new ScriptHeuristic(script); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/SignificanceHeuristic.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/SignificanceHeuristic.java index 4b5d8b3a30d..def7c0234b2 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/SignificanceHeuristic.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/SignificanceHeuristic.java @@ -38,9 +38,11 @@ public abstract class SignificanceHeuristic implements NamedWriteable, ToXConten */ public abstract double getScore(long subsetFreq, long subsetSize, long supersetFreq, long supersetSize); - protected void checkFrequencyValidity(long subsetFreq, long subsetSize, long supersetFreq, long supersetSize, String scoreFunctionName) { + protected void checkFrequencyValidity(long subsetFreq, long subsetSize, long supersetFreq, long supersetSize, + String scoreFunctionName) { if (subsetFreq < 0 || subsetSize < 0 || supersetFreq < 0 || supersetSize < 0) { - throw new IllegalArgumentException("Frequencies of subset and superset must be positive in " + scoreFunctionName + ".getScore()"); + throw new IllegalArgumentException("Frequencies of subset and superset must be positive in " + scoreFunctionName + + ".getScore()"); } if (subsetFreq > subsetSize) { throw new IllegalArgumentException("subsetFreq > subsetSize, in " + scoreFunctionName); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsAggregator.java index 90aa633ffc5..69539e8a11b 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsAggregator.java @@ -54,7 +54,8 @@ public class LongTermsAggregator extends TermsAggregator { BucketOrder order, BucketCountThresholds bucketCountThresholds, SearchContext aggregationContext, Aggregator parent, SubAggCollectionMode subAggCollectMode, boolean showTermDocCountError, IncludeExclude.LongFilter longFilter, List pipelineAggregators, Map metaData) throws IOException { - super(name, factories, aggregationContext, parent, bucketCountThresholds, order, format, subAggCollectMode, pipelineAggregators, metaData); + super(name, factories, aggregationContext, parent, bucketCountThresholds, order, format, subAggCollectMode, pipelineAggregators, + metaData); this.valuesSource = valuesSource; this.showTermDocCountError = showTermDocCountError; this.longFilter = longFilter; @@ -110,7 +111,8 @@ public class LongTermsAggregator extends TermsAggregator { public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException { assert owningBucketOrdinal == 0; - if (bucketCountThresholds.getMinDocCount() == 0 && (InternalOrder.isCountDesc(order) == false || bucketOrds.size() < bucketCountThresholds.getRequiredSize())) { + if (bucketCountThresholds.getMinDocCount() == 0 && (InternalOrder.isCountDesc(order) == false || + bucketOrds.size() < bucketCountThresholds.getRequiredSize())) { // we need to fill-in the blanks for (LeafReaderContext ctx : context.searcher().getTopReaderContext().leaves()) { final SortedNumericDocValues values = getValues(valuesSource, ctx); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsAggregator.java index 6458b0066da..20162fd1bc7 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsAggregator.java @@ -114,7 +114,8 @@ public class StringTermsAggregator extends AbstractStringTermsAggregator { public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException { assert owningBucketOrdinal == 0; - if (bucketCountThresholds.getMinDocCount() == 0 && (InternalOrder.isCountDesc(order) == false || bucketOrds.size() < bucketCountThresholds.getRequiredSize())) { + if (bucketCountThresholds.getMinDocCount() == 0 && (InternalOrder.isCountDesc(order) == false || + bucketOrds.size() < bucketCountThresholds.getRequiredSize())) { // we need to fill-in the blanks for (LeafReaderContext ctx : context.searcher().getTopReaderContext().leaves()) { final SortedBinaryDocValues values = valuesSource.bytesValues(ctx); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregator.java index c1bdc85fb02..189c2ee796e 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregator.java @@ -92,12 +92,14 @@ public abstract class TermsAggregator extends DeferableBucketAggregator { public void ensureValidity() { - // shard_size cannot be smaller than size as we need to at least fetch entries from every shards in order to return + // shard_size cannot be smaller than size as we need to at least fetch entries from every shards in order to return + // if (shardSize < requiredSize) { setShardSize(requiredSize); } - // shard_min_doc_count should not be larger than min_doc_count because this can cause buckets to be removed that would match the min_doc_count criteria + // shard_min_doc_count should not be larger than min_doc_count because this can cause buckets to be removed that would match + // the min_doc_count criteria if (shardMinDocCount > minDocCount) { setShardMinDocCount(minDocCount); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java index 2864ffe2fce..25f552075de 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java @@ -148,8 +148,9 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactorycount distinct entries - * would be counted with linear counting. + * Compute the required precision so that count distinct entries would be counted with linear counting. */ public static int precisionFromThreshold(long count) { final long hashTableEntries = (long) Math.ceil(count / MAX_LOAD_FACTOR); @@ -86,74 +81,675 @@ public final class HyperLogLogPlusPlus implements Releasable { // these static tables come from the appendix of the paper private static final double[][] RAW_ESTIMATE_DATA = { - // precision 4 - { 11, 11.717, 12.207, 12.7896, 13.2882, 13.8204, 14.3772, 14.9342, 15.5202, 16.161, 16.7722, 17.4636, 18.0396, 18.6766, 19.3566, 20.0454, 20.7936, 21.4856, 22.2666, 22.9946, 23.766, 24.4692, 25.3638, 26.0764, 26.7864, 27.7602, 28.4814, 29.433, 30.2926, 31.0664, 31.9996, 32.7956, 33.5366, 34.5894, 35.5738, 36.2698, 37.3682, 38.0544, 39.2342, 40.0108, 40.7966, 41.9298, 42.8704, 43.6358, 44.5194, 45.773, 46.6772, 47.6174, 48.4888, 49.3304, 50.2506, 51.4996, 52.3824, 53.3078, 54.3984, 55.5838, 56.6618, 57.2174, 58.3514, 59.0802, 60.1482, 61.0376, 62.3598, 62.8078, 63.9744, 64.914, 65.781, 67.1806, 68.0594, 68.8446, 69.7928, 70.8248, 71.8324, 72.8598, 73.6246, 74.7014, 75.393, 76.6708, 77.2394, }, - // precision 5 - { 23, 23.1194, 23.8208, 24.2318, 24.77, 25.2436, 25.7774, 26.2848, 26.8224, 27.3742, 27.9336, 28.503, 29.0494, 29.6292, 30.2124, 30.798, 31.367, 31.9728, 32.5944, 33.217, 33.8438, 34.3696, 35.0956, 35.7044, 36.324, 37.0668, 37.6698, 38.3644, 39.049, 39.6918, 40.4146, 41.082, 41.687, 42.5398, 43.2462, 43.857, 44.6606, 45.4168, 46.1248, 46.9222, 47.6804, 48.447, 49.3454, 49.9594, 50.7636, 51.5776, 52.331, 53.19, 53.9676, 54.7564, 55.5314, 56.4442, 57.3708, 57.9774, 58.9624, 59.8796, 60.755, 61.472, 62.2076, 63.1024, 63.8908, 64.7338, 65.7728, 66.629, 67.413, 68.3266, 69.1524, 70.2642, 71.1806, 72.0566, 72.9192, 73.7598, 74.3516, 75.5802, 76.4386, 77.4916, 78.1524, 79.1892, 79.8414, 80.8798, 81.8376, 82.4698, 83.7656, 84.331, 85.5914, 86.6012, 87.7016, 88.5582, 89.3394, 90.3544, 91.4912, 92.308, 93.3552, 93.9746, 95.2052, 95.727, 97.1322, 98.3944, 98.7588, 100.242, 101.1914, 102.2538, 102.8776, 103.6292, 105.1932, 105.9152, 107.0868, 107.6728, 108.7144, 110.3114, 110.8716, 111.245, 112.7908, 113.7064, 114.636, 115.7464, 116.1788, 117.7464, 118.4896, 119.6166, 120.5082, 121.7798, 122.9028, 123.4426, 124.8854, 125.705, 126.4652, 128.3464, 128.3462, 130.0398, 131.0342, 131.0042, 132.4766, 133.511, 134.7252, 135.425, 136.5172, 138.0572, 138.6694, 139.3712, 140.8598, 141.4594, 142.554, 143.4006, 144.7374, 146.1634, 146.8994, 147.605, 147.9304, 149.1636, 150.2468, 151.5876, 152.2096, 153.7032, 154.7146, 155.807, 156.9228, 157.0372, 158.5852, }, - // precision 6 - { 46, 46.1902, 47.271, 47.8358, 48.8142, 49.2854, 50.317, 51.354, 51.8924, 52.9436, 53.4596, 54.5262, 55.6248, 56.1574, 57.2822, 57.837, 58.9636, 60.074, 60.7042, 61.7976, 62.4772, 63.6564, 64.7942, 65.5004, 66.686, 67.291, 68.5672, 69.8556, 70.4982, 71.8204, 72.4252, 73.7744, 75.0786, 75.8344, 77.0294, 77.8098, 79.0794, 80.5732, 81.1878, 82.5648, 83.2902, 84.6784, 85.3352, 86.8946, 88.3712, 89.0852, 90.499, 91.2686, 92.6844, 94.2234, 94.9732, 96.3356, 97.2286, 98.7262, 100.3284, 101.1048, 102.5962, 103.3562, 105.1272, 106.4184, 107.4974, 109.0822, 109.856, 111.48, 113.2834, 114.0208, 115.637, 116.5174, 118.0576, 119.7476, 120.427, 122.1326, 123.2372, 125.2788, 126.6776, 127.7926, 129.1952, 129.9564, 131.6454, 133.87, 134.5428, 136.2, 137.0294, 138.6278, 139.6782, 141.792, 143.3516, 144.2832, 146.0394, 147.0748, 148.4912, 150.849, 151.696, 153.5404, 154.073, 156.3714, 157.7216, 158.7328, 160.4208, 161.4184, 163.9424, 165.2772, 166.411, 168.1308, 168.769, 170.9258, 172.6828, 173.7502, 175.706, 176.3886, 179.0186, 180.4518, 181.927, 183.4172, 184.4114, 186.033, 188.5124, 189.5564, 191.6008, 192.4172, 193.8044, 194.997, 197.4548, 198.8948, 200.2346, 202.3086, 203.1548, 204.8842, 206.6508, 206.6772, 209.7254, 210.4752, 212.7228, 214.6614, 215.1676, 217.793, 218.0006, 219.9052, 221.66, 223.5588, 225.1636, 225.6882, 227.7126, 229.4502, 231.1978, 232.9756, 233.1654, 236.727, 238.1974, 237.7474, 241.1346, 242.3048, 244.1948, 245.3134, 246.879, 249.1204, 249.853, 252.6792, 253.857, 254.4486, 257.2362, 257.9534, 260.0286, 260.5632, 262.663, 264.723, 265.7566, 267.2566, 267.1624, 270.62, 272.8216, 273.2166, 275.2056, 276.2202, 278.3726, 280.3344, 281.9284, 283.9728, 284.1924, 286.4872, 287.587, 289.807, 291.1206, 292.769, 294.8708, 296.665, 297.1182, 299.4012, 300.6352, 302.1354, 304.1756, 306.1606, 307.3462, 308.5214, 309.4134, 310.8352, 313.9684, 315.837, 316.7796, 318.9858, }, - // precision 7 - { 92, 93.4934, 94.9758, 96.4574, 97.9718, 99.4954, 101.5302, 103.0756, 104.6374, 106.1782, 107.7888, 109.9522, 111.592, 113.2532, 114.9086, 116.5938, 118.9474, 120.6796, 122.4394, 124.2176, 125.9768, 128.4214, 130.2528, 132.0102, 133.8658, 135.7278, 138.3044, 140.1316, 142.093, 144.0032, 145.9092, 148.6306, 150.5294, 152.5756, 154.6508, 156.662, 159.552, 161.3724, 163.617, 165.5754, 167.7872, 169.8444, 172.7988, 174.8606, 177.2118, 179.3566, 181.4476, 184.5882, 186.6816, 189.0824, 191.0258, 193.6048, 196.4436, 198.7274, 200.957, 203.147, 205.4364, 208.7592, 211.3386, 213.781, 215.8028, 218.656, 221.6544, 223.996, 226.4718, 229.1544, 231.6098, 234.5956, 237.0616, 239.5758, 242.4878, 244.5244, 248.2146, 250.724, 252.8722, 255.5198, 258.0414, 261.941, 264.9048, 266.87, 269.4304, 272.028, 274.4708, 278.37, 281.0624, 283.4668, 286.5532, 289.4352, 293.2564, 295.2744, 298.2118, 300.7472, 304.1456, 307.2928, 309.7504, 312.5528, 315.979, 318.2102, 322.1834, 324.3494, 327.325, 330.6614, 332.903, 337.2544, 339.9042, 343.215, 345.2864, 348.0814, 352.6764, 355.301, 357.139, 360.658, 363.1732, 366.5902, 369.9538, 373.0828, 375.922, 378.9902, 382.7328, 386.4538, 388.1136, 391.2234, 394.0878, 396.708, 401.1556, 404.1852, 406.6372, 409.6822, 412.7796, 416.6078, 418.4916, 422.131, 424.5376, 428.1988, 432.211, 434.4502, 438.5282, 440.912, 444.0448, 447.7432, 450.8524, 453.7988, 456.7858, 458.8868, 463.9886, 466.5064, 468.9124, 472.6616, 475.4682, 478.582, 481.304, 485.2738, 488.6894, 490.329, 496.106, 497.6908, 501.1374, 504.5322, 506.8848, 510.3324, 513.4512, 516.179, 520.4412, 522.6066, 526.167, 528.7794, 533.379, 536.067, 538.46, 542.9116, 545.692, 547.9546, 552.493, 555.2722, 557.335, 562.449, 564.2014, 569.0738, 571.0974, 574.8564, 578.2996, 581.409, 583.9704, 585.8098, 589.6528, 594.5998, 595.958, 600.068, 603.3278, 608.2016, 609.9632, 612.864, 615.43, 620.7794, 621.272, 625.8644, 629.206, 633.219, 634.5154, 638.6102, }, - // precision 8 - { 184.2152, 187.2454, 190.2096, 193.6652, 196.6312, 199.6822, 203.249, 206.3296, 210.0038, 213.2074, 216.4612, 220.27, 223.5178, 227.4412, 230.8032, 234.1634, 238.1688, 241.6074, 245.6946, 249.2664, 252.8228, 257.0432, 260.6824, 264.9464, 268.6268, 272.2626, 276.8376, 280.4034, 284.8956, 288.8522, 292.7638, 297.3552, 301.3556, 305.7526, 309.9292, 313.8954, 318.8198, 322.7668, 327.298, 331.6688, 335.9466, 340.9746, 345.1672, 349.3474, 354.3028, 358.8912, 364.114, 368.4646, 372.9744, 378.4092, 382.6022, 387.843, 392.5684, 397.1652, 402.5426, 407.4152, 412.5388, 417.3592, 422.1366, 427.486, 432.3918, 437.5076, 442.509, 447.3834, 453.3498, 458.0668, 463.7346, 469.1228, 473.4528, 479.7, 484.644, 491.0518, 495.5774, 500.9068, 506.432, 512.1666, 517.434, 522.6644, 527.4894, 533.6312, 538.3804, 544.292, 550.5496, 556.0234, 562.8206, 566.6146, 572.4188, 579.117, 583.6762, 590.6576, 595.7864, 601.509, 607.5334, 612.9204, 619.772, 624.2924, 630.8654, 636.1836, 642.745, 649.1316, 655.0386, 660.0136, 666.6342, 671.6196, 678.1866, 684.4282, 689.3324, 695.4794, 702.5038, 708.129, 713.528, 720.3204, 726.463, 732.7928, 739.123, 744.7418, 751.2192, 756.5102, 762.6066, 769.0184, 775.2224, 781.4014, 787.7618, 794.1436, 798.6506, 805.6378, 811.766, 819.7514, 824.5776, 828.7322, 837.8048, 843.6302, 849.9336, 854.4798, 861.3388, 867.9894, 873.8196, 880.3136, 886.2308, 892.4588, 899.0816, 905.4076, 912.0064, 917.3878, 923.619, 929.998, 937.3482, 943.9506, 947.991, 955.1144, 962.203, 968.8222, 975.7324, 981.7826, 988.7666, 994.2648, 1000.3128, 1007.4082, 1013.7536, 1020.3376, 1026.7156, 1031.7478, 1037.4292, 1045.393, 1051.2278, 1058.3434, 1062.8726, 1071.884, 1076.806, 1082.9176, 1089.1678, 1095.5032, 1102.525, 1107.2264, 1115.315, 1120.93, 1127.252, 1134.1496, 1139.0408, 1147.5448, 1153.3296, 1158.1974, 1166.5262, 1174.3328, 1175.657, 1184.4222, 1190.9172, 1197.1292, 1204.4606, 1210.4578, 1218.8728, 1225.3336, 1226.6592, 1236.5768, 1241.363, 1249.4074, 1254.6566, 1260.8014, 1266.5454, 1274.5192, }, - // precision 9 - { 369, 374.8294, 381.2452, 387.6698, 394.1464, 400.2024, 406.8782, 413.6598, 420.462, 427.2826, 433.7102, 440.7416, 447.9366, 455.1046, 462.285, 469.0668, 476.306, 483.8448, 491.301, 498.9886, 506.2422, 513.8138, 521.7074, 529.7428, 537.8402, 545.1664, 553.3534, 561.594, 569.6886, 577.7876, 585.65, 594.228, 602.8036, 611.1666, 620.0818, 628.0824, 637.2574, 646.302, 655.1644, 664.0056, 672.3802, 681.7192, 690.5234, 700.2084, 708.831, 718.485, 728.1112, 737.4764, 746.76, 756.3368, 766.5538, 775.5058, 785.2646, 795.5902, 804.3818, 814.8998, 824.9532, 835.2062, 845.2798, 854.4728, 864.9582, 875.3292, 886.171, 896.781, 906.5716, 916.7048, 927.5322, 937.875, 949.3972, 958.3464, 969.7274, 980.2834, 992.1444, 1003.4264, 1013.0166, 1024.018, 1035.0438, 1046.34, 1057.6856, 1068.9836, 1079.0312, 1091.677, 1102.3188, 1113.4846, 1124.4424, 1135.739, 1147.1488, 1158.9202, 1169.406, 1181.5342, 1193.2834, 1203.8954, 1216.3286, 1226.2146, 1239.6684, 1251.9946, 1262.123, 1275.4338, 1285.7378, 1296.076, 1308.9692, 1320.4964, 1333.0998, 1343.9864, 1357.7754, 1368.3208, 1380.4838, 1392.7388, 1406.0758, 1416.9098, 1428.9728, 1440.9228, 1453.9292, 1462.617, 1476.05, 1490.2996, 1500.6128, 1513.7392, 1524.5174, 1536.6322, 1548.2584, 1562.3766, 1572.423, 1587.1232, 1596.5164, 1610.5938, 1622.5972, 1633.1222, 1647.7674, 1658.5044, 1671.57, 1683.7044, 1695.4142, 1708.7102, 1720.6094, 1732.6522, 1747.841, 1756.4072, 1769.9786, 1782.3276, 1797.5216, 1808.3186, 1819.0694, 1834.354, 1844.575, 1856.2808, 1871.1288, 1880.7852, 1893.9622, 1906.3418, 1920.6548, 1932.9302, 1945.8584, 1955.473, 1968.8248, 1980.6446, 1995.9598, 2008.349, 2019.8556, 2033.0334, 2044.0206, 2059.3956, 2069.9174, 2082.6084, 2093.7036, 2106.6108, 2118.9124, 2132.301, 2144.7628, 2159.8422, 2171.0212, 2183.101, 2193.5112, 2208.052, 2221.3194, 2233.3282, 2247.295, 2257.7222, 2273.342, 2286.5638, 2299.6786, 2310.8114, 2322.3312, 2335.516, 2349.874, 2363.5968, 2373.865, 2387.1918, 2401.8328, 2414.8496, 2424.544, 2436.7592, 2447.1682, 2464.1958, 2474.3438, 2489.0006, 2497.4526, 2513.6586, 2527.19, 2540.7028, 2553.768, }, - // precision 10 - { 738.1256, 750.4234, 763.1064, 775.4732, 788.4636, 801.0644, 814.488, 827.9654, 841.0832, 854.7864, 868.1992, 882.2176, 896.5228, 910.1716, 924.7752, 938.899, 953.6126, 968.6492, 982.9474, 998.5214, 1013.1064, 1028.6364, 1044.2468, 1059.4588, 1075.3832, 1091.0584, 1106.8606, 1123.3868, 1139.5062, 1156.1862, 1172.463, 1189.339, 1206.1936, 1223.1292, 1240.1854, 1257.2908, 1275.3324, 1292.8518, 1310.5204, 1328.4854, 1345.9318, 1364.552, 1381.4658, 1400.4256, 1419.849, 1438.152, 1456.8956, 1474.8792, 1494.118, 1513.62, 1532.5132, 1551.9322, 1570.7726, 1590.6086, 1610.5332, 1630.5918, 1650.4294, 1669.7662, 1690.4106, 1710.7338, 1730.9012, 1750.4486, 1770.1556, 1791.6338, 1812.7312, 1833.6264, 1853.9526, 1874.8742, 1896.8326, 1918.1966, 1939.5594, 1961.07, 1983.037, 2003.1804, 2026.071, 2047.4884, 2070.0848, 2091.2944, 2114.333, 2135.9626, 2158.2902, 2181.0814, 2202.0334, 2224.4832, 2246.39, 2269.7202, 2292.1714, 2314.2358, 2338.9346, 2360.891, 2384.0264, 2408.3834, 2430.1544, 2454.8684, 2476.9896, 2501.4368, 2522.8702, 2548.0408, 2570.6738, 2593.5208, 2617.0158, 2640.2302, 2664.0962, 2687.4986, 2714.2588, 2735.3914, 2759.6244, 2781.8378, 2808.0072, 2830.6516, 2856.2454, 2877.2136, 2903.4546, 2926.785, 2951.2294, 2976.468, 3000.867, 3023.6508, 3049.91, 3073.5984, 3098.162, 3121.5564, 3146.2328, 3170.9484, 3195.5902, 3221.3346, 3242.7032, 3271.6112, 3296.5546, 3317.7376, 3345.072, 3369.9518, 3394.326, 3418.1818, 3444.6926, 3469.086, 3494.2754, 3517.8698, 3544.248, 3565.3768, 3588.7234, 3616.979, 3643.7504, 3668.6812, 3695.72, 3719.7392, 3742.6224, 3770.4456, 3795.6602, 3819.9058, 3844.002, 3869.517, 3895.6824, 3920.8622, 3947.1364, 3973.985, 3995.4772, 4021.62, 4046.628, 4074.65, 4096.2256, 4121.831, 4146.6406, 4173.276, 4195.0744, 4223.9696, 4251.3708, 4272.9966, 4300.8046, 4326.302, 4353.1248, 4374.312, 4403.0322, 4426.819, 4450.0598, 4478.5206, 4504.8116, 4528.8928, 4553.9584, 4578.8712, 4603.8384, 4632.3872, 4655.5128, 4675.821, 4704.6222, 4731.9862, 4755.4174, 4781.2628, 4804.332, 4832.3048, 4862.8752, 4883.4148, 4906.9544, 4935.3516, 4954.3532, 4984.0248, 5011.217, 5035.3258, 5057.3672, 5084.1828, }, - // precision 11 - { 1477, 1501.6014, 1526.5802, 1551.7942, 1577.3042, 1603.2062, 1629.8402, 1656.2292, 1682.9462, 1709.9926, 1737.3026, 1765.4252, 1793.0578, 1821.6092, 1849.626, 1878.5568, 1908.527, 1937.5154, 1967.1874, 1997.3878, 2027.37, 2058.1972, 2089.5728, 2120.1012, 2151.9668, 2183.292, 2216.0772, 2247.8578, 2280.6562, 2313.041, 2345.714, 2380.3112, 2414.1806, 2447.9854, 2481.656, 2516.346, 2551.5154, 2586.8378, 2621.7448, 2656.6722, 2693.5722, 2729.1462, 2765.4124, 2802.8728, 2838.898, 2876.408, 2913.4926, 2951.4938, 2989.6776, 3026.282, 3065.7704, 3104.1012, 3143.7388, 3181.6876, 3221.1872, 3261.5048, 3300.0214, 3339.806, 3381.409, 3421.4144, 3461.4294, 3502.2286, 3544.651, 3586.6156, 3627.337, 3670.083, 3711.1538, 3753.5094, 3797.01, 3838.6686, 3882.1678, 3922.8116, 3967.9978, 4009.9204, 4054.3286, 4097.5706, 4140.6014, 4185.544, 4229.5976, 4274.583, 4316.9438, 4361.672, 4406.2786, 4451.8628, 4496.1834, 4543.505, 4589.1816, 4632.5188, 4678.2294, 4724.8908, 4769.0194, 4817.052, 4861.4588, 4910.1596, 4956.4344, 5002.5238, 5048.13, 5093.6374, 5142.8162, 5187.7894, 5237.3984, 5285.6078, 5331.0858, 5379.1036, 5428.6258, 5474.6018, 5522.7618, 5571.5822, 5618.59, 5667.9992, 5714.88, 5763.454, 5808.6982, 5860.3644, 5910.2914, 5953.571, 6005.9232, 6055.1914, 6104.5882, 6154.5702, 6199.7036, 6251.1764, 6298.7596, 6350.0302, 6398.061, 6448.4694, 6495.933, 6548.0474, 6597.7166, 6646.9416, 6695.9208, 6742.6328, 6793.5276, 6842.1934, 6894.2372, 6945.3864, 6996.9228, 7044.2372, 7094.1374, 7142.2272, 7192.2942, 7238.8338, 7288.9006, 7344.0908, 7394.8544, 7443.5176, 7490.4148, 7542.9314, 7595.6738, 7641.9878, 7694.3688, 7743.0448, 7797.522, 7845.53, 7899.594, 7950.3132, 7996.455, 8050.9442, 8092.9114, 8153.1374, 8197.4472, 8252.8278, 8301.8728, 8348.6776, 8401.4698, 8453.551, 8504.6598, 8553.8944, 8604.1276, 8657.6514, 8710.3062, 8758.908, 8807.8706, 8862.1702, 8910.4668, 8960.77, 9007.2766, 9063.164, 9121.0534, 9164.1354, 9218.1594, 9267.767, 9319.0594, 9372.155, 9419.7126, 9474.3722, 9520.1338, 9572.368, 9622.7702, 9675.8448, 9726.5396, 9778.7378, 9827.6554, 9878.1922, 9928.7782, 9978.3984, 10026.578, 10076.5626, 10137.1618, 10177.5244, 10229.9176, }, - // precision 12 - { 2954, 3003.4782, 3053.3568, 3104.3666, 3155.324, 3206.9598, 3259.648, 3312.539, 3366.1474, 3420.2576, 3474.8376, 3530.6076, 3586.451, 3643.38, 3700.4104, 3757.5638, 3815.9676, 3875.193, 3934.838, 3994.8548, 4055.018, 4117.1742, 4178.4482, 4241.1294, 4304.4776, 4367.4044, 4431.8724, 4496.3732, 4561.4304, 4627.5326, 4693.949, 4761.5532, 4828.7256, 4897.6182, 4965.5186, 5034.4528, 5104.865, 5174.7164, 5244.6828, 5316.6708, 5387.8312, 5459.9036, 5532.476, 5604.8652, 5679.6718, 5753.757, 5830.2072, 5905.2828, 5980.0434, 6056.6264, 6134.3192, 6211.5746, 6290.0816, 6367.1176, 6447.9796, 6526.5576, 6606.1858, 6686.9144, 6766.1142, 6847.0818, 6927.9664, 7010.9096, 7091.0816, 7175.3962, 7260.3454, 7344.018, 7426.4214, 7511.3106, 7596.0686, 7679.8094, 7765.818, 7852.4248, 7936.834, 8022.363, 8109.5066, 8200.4554, 8288.5832, 8373.366, 8463.4808, 8549.7682, 8642.0522, 8728.3288, 8820.9528, 8907.727, 9001.0794, 9091.2522, 9179.988, 9269.852, 9362.6394, 9453.642, 9546.9024, 9640.6616, 9732.6622, 9824.3254, 9917.7484, 10007.9392, 10106.7508, 10196.2152, 10289.8114, 10383.5494, 10482.3064, 10576.8734, 10668.7872, 10764.7156, 10862.0196, 10952.793, 11049.9748, 11146.0702, 11241.4492, 11339.2772, 11434.2336, 11530.741, 11627.6136, 11726.311, 11821.5964, 11918.837, 12015.3724, 12113.0162, 12213.0424, 12306.9804, 12408.4518, 12504.8968, 12604.586, 12700.9332, 12798.705, 12898.5142, 12997.0488, 13094.788, 13198.475, 13292.7764, 13392.9698, 13486.8574, 13590.1616, 13686.5838, 13783.6264, 13887.2638, 13992.0978, 14081.0844, 14189.9956, 14280.0912, 14382.4956, 14486.4384, 14588.1082, 14686.2392, 14782.276, 14888.0284, 14985.1864, 15088.8596, 15187.0998, 15285.027, 15383.6694, 15495.8266, 15591.3736, 15694.2008, 15790.3246, 15898.4116, 15997.4522, 16095.5014, 16198.8514, 16291.7492, 16402.6424, 16499.1266, 16606.2436, 16697.7186, 16796.3946, 16902.3376, 17005.7672, 17100.814, 17206.8282, 17305.8262, 17416.0744, 17508.4092, 17617.0178, 17715.4554, 17816.758, 17920.1748, 18012.9236, 18119.7984, 18223.2248, 18324.2482, 18426.6276, 18525.0932, 18629.8976, 18733.2588, 18831.0466, 18940.1366, 19032.2696, 19131.729, 19243.4864, 19349.6932, 19442.866, 19547.9448, 19653.2798, 19754.4034, 19854.0692, 19965.1224, 20065.1774, 20158.2212, 20253.353, 20366.3264, 20463.22, }, - // precision 13 - { 5908.5052, 6007.2672, 6107.347, 6208.5794, 6311.2622, 6414.5514, 6519.3376, 6625.6952, 6732.5988, 6841.3552, 6950.5972, 7061.3082, 7173.5646, 7287.109, 7401.8216, 7516.4344, 7633.3802, 7751.2962, 7870.3784, 7990.292, 8110.79, 8233.4574, 8356.6036, 8482.2712, 8607.7708, 8735.099, 8863.1858, 8993.4746, 9123.8496, 9255.6794, 9388.5448, 9522.7516, 9657.3106, 9792.6094, 9930.5642, 10068.794, 10206.7256, 10347.81, 10490.3196, 10632.0778, 10775.9916, 10920.4662, 11066.124, 11213.073, 11358.0362, 11508.1006, 11659.1716, 11808.7514, 11959.4884, 12112.1314, 12265.037, 12420.3756, 12578.933, 12734.311, 12890.0006, 13047.2144, 13207.3096, 13368.5144, 13528.024, 13689.847, 13852.7528, 14018.3168, 14180.5372, 14346.9668, 14513.5074, 14677.867, 14846.2186, 15017.4186, 15184.9716, 15356.339, 15529.2972, 15697.3578, 15871.8686, 16042.187, 16216.4094, 16389.4188, 16565.9126, 16742.3272, 16919.0042, 17094.7592, 17273.965, 17451.8342, 17634.4254, 17810.5984, 17988.9242, 18171.051, 18354.7938, 18539.466, 18721.0408, 18904.9972, 19081.867, 19271.9118, 19451.8694, 19637.9816, 19821.2922, 20013.1292, 20199.3858, 20387.8726, 20572.9514, 20770.7764, 20955.1714, 21144.751, 21329.9952, 21520.709, 21712.7016, 21906.3868, 22096.2626, 22286.0524, 22475.051, 22665.5098, 22862.8492, 23055.5294, 23249.6138, 23437.848, 23636.273, 23826.093, 24020.3296, 24213.3896, 24411.7392, 24602.9614, 24805.7952, 24998.1552, 25193.9588, 25389.0166, 25585.8392, 25780.6976, 25981.2728, 26175.977, 26376.5252, 26570.1964, 26773.387, 26962.9812, 27163.0586, 27368.164, 27565.0534, 27758.7428, 27961.1276, 28163.2324, 28362.3816, 28565.7668, 28758.644, 28956.9768, 29163.4722, 29354.7026, 29561.1186, 29767.9948, 29959.9986, 30164.0492, 30366.9818, 30562.5338, 30762.9928, 30976.1592, 31166.274, 31376.722, 31570.3734, 31770.809, 31974.8934, 32179.5286, 32387.5442, 32582.3504, 32794.076, 32989.9528, 33191.842, 33392.4684, 33595.659, 33801.8672, 34000.3414, 34200.0922, 34402.6792, 34610.0638, 34804.0084, 35011.13, 35218.669, 35418.6634, 35619.0792, 35830.6534, 36028.4966, 36229.7902, 36438.6422, 36630.7764, 36833.3102, 37048.6728, 37247.3916, 37453.5904, 37669.3614, 37854.5526, 38059.305, 38268.0936, 38470.2516, 38674.7064, 38876.167, 39068.3794, 39281.9144, 39492.8566, 39684.8628, 39898.4108, 40093.1836, 40297.6858, 40489.7086, 40717.2424, }, - // precision 14 - { 11817.475, 12015.0046, 12215.3792, 12417.7504, 12623.1814, 12830.0086, 13040.0072, 13252.503, 13466.178, 13683.2738, 13902.0344, 14123.9798, 14347.394, 14573.7784, 14802.6894, 15033.6824, 15266.9134, 15502.8624, 15741.4944, 15980.7956, 16223.8916, 16468.6316, 16715.733, 16965.5726, 17217.204, 17470.666, 17727.8516, 17986.7886, 18247.6902, 18510.9632, 18775.304, 19044.7486, 19314.4408, 19587.202, 19862.2576, 20135.924, 20417.0324, 20697.9788, 20979.6112, 21265.0274, 21550.723, 21841.6906, 22132.162, 22428.1406, 22722.127, 23020.5606, 23319.7394, 23620.4014, 23925.2728, 24226.9224, 24535.581, 24845.505, 25155.9618, 25470.3828, 25785.9702, 26103.7764, 26420.4132, 26742.0186, 27062.8852, 27388.415, 27714.6024, 28042.296, 28365.4494, 28701.1526, 29031.8008, 29364.2156, 29704.497, 30037.1458, 30380.111, 30723.8168, 31059.5114, 31404.9498, 31751.6752, 32095.2686, 32444.7792, 32794.767, 33145.204, 33498.4226, 33847.6502, 34209.006, 34560.849, 34919.4838, 35274.9778, 35635.1322, 35996.3266, 36359.1394, 36722.8266, 37082.8516, 37447.7354, 37815.9606, 38191.0692, 38559.4106, 38924.8112, 39294.6726, 39663.973, 40042.261, 40416.2036, 40779.2036, 41161.6436, 41540.9014, 41921.1998, 42294.7698, 42678.5264, 43061.3464, 43432.375, 43818.432, 44198.6598, 44583.0138, 44970.4794, 45353.924, 45729.858, 46118.2224, 46511.5724, 46900.7386, 47280.6964, 47668.1472, 48055.6796, 48446.9436, 48838.7146, 49217.7296, 49613.7796, 50010.7508, 50410.0208, 50793.7886, 51190.2456, 51583.1882, 51971.0796, 52376.5338, 52763.319, 53165.5534, 53556.5594, 53948.2702, 54346.352, 54748.7914, 55138.577, 55543.4824, 55941.1748, 56333.7746, 56745.1552, 57142.7944, 57545.2236, 57935.9956, 58348.5268, 58737.5474, 59158.5962, 59542.6896, 59958.8004, 60349.3788, 60755.0212, 61147.6144, 61548.194, 61946.0696, 62348.6042, 62763.603, 63162.781, 63560.635, 63974.3482, 64366.4908, 64771.5876, 65176.7346, 65597.3916, 65995.915, 66394.0384, 66822.9396, 67203.6336, 67612.2032, 68019.0078, 68420.0388, 68821.22, 69235.8388, 69640.0724, 70055.155, 70466.357, 70863.4266, 71276.2482, 71677.0306, 72080.2006, 72493.0214, 72893.5952, 73314.5856, 73714.9852, 74125.3022, 74521.2122, 74933.6814, 75341.5904, 75743.0244, 76166.0278, 76572.1322, 76973.1028, 77381.6284, 77800.6092, 78189.328, 78607.0962, 79012.2508, 79407.8358, 79825.725, 80238.701, 80646.891, 81035.6436, 81460.0448, 81876.3884, }, - // precision 15 - { 23635.0036, 24030.8034, 24431.4744, 24837.1524, 25246.7928, 25661.326, 26081.3532, 26505.2806, 26933.9892, 27367.7098, 27805.318, 28248.799, 28696.4382, 29148.8244, 29605.5138, 30066.8668, 30534.2344, 31006.32, 31480.778, 31962.2418, 32447.3324, 32938.0232, 33432.731, 33930.728, 34433.9896, 34944.1402, 35457.5588, 35974.5958, 36497.3296, 37021.9096, 37554.326, 38088.0826, 38628.8816, 39171.3192, 39723.2326, 40274.5554, 40832.3142, 41390.613, 41959.5908, 42532.5466, 43102.0344, 43683.5072, 44266.694, 44851.2822, 45440.7862, 46038.0586, 46640.3164, 47241.064, 47846.155, 48454.7396, 49076.9168, 49692.542, 50317.4778, 50939.65, 51572.5596, 52210.2906, 52843.7396, 53481.3996, 54127.236, 54770.406, 55422.6598, 56078.7958, 56736.7174, 57397.6784, 58064.5784, 58730.308, 59404.9784, 60077.0864, 60751.9158, 61444.1386, 62115.817, 62808.7742, 63501.4774, 64187.5454, 64883.6622, 65582.7468, 66274.5318, 66976.9276, 67688.7764, 68402.138, 69109.6274, 69822.9706, 70543.6108, 71265.5202, 71983.3848, 72708.4656, 73433.384, 74158.4664, 74896.4868, 75620.9564, 76362.1434, 77098.3204, 77835.7662, 78582.6114, 79323.9902, 80067.8658, 80814.9246, 81567.0136, 82310.8536, 83061.9952, 83821.4096, 84580.8608, 85335.547, 86092.5802, 86851.6506, 87612.311, 88381.2016, 89146.3296, 89907.8974, 90676.846, 91451.4152, 92224.5518, 92995.8686, 93763.5066, 94551.2796, 95315.1944, 96096.1806, 96881.0918, 97665.679, 98442.68, 99229.3002, 100011.0994, 100790.6386, 101580.1564, 102377.7484, 103152.1392, 103944.2712, 104730.216, 105528.6336, 106324.9398, 107117.6706, 107890.3988, 108695.2266, 109485.238, 110294.7876, 111075.0958, 111878.0496, 112695.2864, 113464.5486, 114270.0474, 115068.608, 115884.3626, 116673.2588, 117483.3716, 118275.097, 119085.4092, 119879.2808, 120687.5868, 121499.9944, 122284.916, 123095.9254, 123912.5038, 124709.0454, 125503.7182, 126323.259, 127138.9412, 127943.8294, 128755.646, 129556.5354, 130375.3298, 131161.4734, 131971.1962, 132787.5458, 133588.1056, 134431.351, 135220.2906, 136023.398, 136846.6558, 137667.0004, 138463.663, 139283.7154, 140074.6146, 140901.3072, 141721.8548, 142543.2322, 143356.1096, 144173.7412, 144973.0948, 145794.3162, 146609.5714, 147420.003, 148237.9784, 149050.5696, 149854.761, 150663.1966, 151494.0754, 152313.1416, 153112.6902, 153935.7206, 154746.9262, 155559.547, 156401.9746, 157228.7036, 158008.7254, 158820.75, 159646.9184, 160470.4458, 161279.5348, 162093.3114, 162918.542, 163729.2842, }, - // precision 16 - { 47271, 48062.3584, 48862.7074, 49673.152, 50492.8416, 51322.9514, 52161.03, 53009.407, 53867.6348, 54734.206, 55610.5144, 56496.2096, 57390.795, 58297.268, 59210.6448, 60134.665, 61068.0248, 62010.4472, 62962.5204, 63923.5742, 64895.0194, 65876.4182, 66862.6136, 67862.6968, 68868.8908, 69882.8544, 70911.271, 71944.0924, 72990.0326, 74040.692, 75100.6336, 76174.7826, 77252.5998, 78340.2974, 79438.2572, 80545.4976, 81657.2796, 82784.6336, 83915.515, 85059.7362, 86205.9368, 87364.4424, 88530.3358, 89707.3744, 90885.9638, 92080.197, 93275.5738, 94479.391, 95695.918, 96919.2236, 98148.4602, 99382.3474, 100625.6974, 101878.0284, 103141.6278, 104409.4588, 105686.2882, 106967.5402, 108261.6032, 109548.1578, 110852.0728, 112162.231, 113479.0072, 114806.2626, 116137.9072, 117469.5048, 118813.5186, 120165.4876, 121516.2556, 122875.766, 124250.5444, 125621.2222, 127003.2352, 128387.848, 129775.2644, 131181.7776, 132577.3086, 133979.9458, 135394.1132, 136800.9078, 138233.217, 139668.5308, 141085.212, 142535.2122, 143969.0684, 145420.2872, 146878.1542, 148332.7572, 149800.3202, 151269.66, 152743.6104, 154213.0948, 155690.288, 157169.4246, 158672.1756, 160160.059, 161650.6854, 163145.7772, 164645.6726, 166159.1952, 167682.1578, 169177.3328, 170700.0118, 172228.8964, 173732.6664, 175265.5556, 176787.799, 178317.111, 179856.6914, 181400.865, 182943.4612, 184486.742, 186033.4698, 187583.7886, 189148.1868, 190688.4526, 192250.1926, 193810.9042, 195354.2972, 196938.7682, 198493.5898, 200079.2824, 201618.912, 203205.5492, 204765.5798, 206356.1124, 207929.3064, 209498.7196, 211086.229, 212675.1324, 214256.7892, 215826.2392, 217412.8474, 218995.6724, 220618.6038, 222207.1166, 223781.0364, 225387.4332, 227005.7928, 228590.4336, 230217.8738, 231805.1054, 233408.9, 234995.3432, 236601.4956, 238190.7904, 239817.2548, 241411.2832, 243002.4066, 244640.1884, 246255.3128, 247849.3508, 249479.9734, 251106.8822, 252705.027, 254332.9242, 255935.129, 257526.9014, 259154.772, 260777.625, 262390.253, 264004.4906, 265643.59, 267255.4076, 268873.426, 270470.7252, 272106.4804, 273722.4456, 275337.794, 276945.7038, 278592.9154, 280204.3726, 281841.1606, 283489.171, 285130.1716, 286735.3362, 288364.7164, 289961.1814, 291595.5524, 293285.683, 294899.6668, 296499.3434, 298128.0462, 299761.8946, 301394.2424, 302997.6748, 304615.1478, 306269.7724, 307886.114, 309543.1028, 311153.2862, 312782.8546, 314421.2008, 316033.2438, 317692.9636, 319305.2648, 320948.7406, 322566.3364, 324228.4224, 325847.1542, }, - // precision 17 - { 94542, 96125.811, 97728.019, 99348.558, 100987.9705, 102646.7565, 104324.5125, 106021.7435, 107736.7865, 109469.272, 111223.9465, 112995.219, 114787.432, 116593.152, 118422.71, 120267.2345, 122134.6765, 124020.937, 125927.2705, 127851.255, 129788.9485, 131751.016, 133726.8225, 135722.592, 137736.789, 139770.568, 141821.518, 143891.343, 145982.1415, 148095.387, 150207.526, 152355.649, 154515.6415, 156696.05, 158887.7575, 161098.159, 163329.852, 165569.053, 167837.4005, 170121.6165, 172420.4595, 174732.6265, 177062.77, 179412.502, 181774.035, 184151.939, 186551.6895, 188965.691, 191402.8095, 193857.949, 196305.0775, 198774.6715, 201271.2585, 203764.78, 206299.3695, 208818.1365, 211373.115, 213946.7465, 216532.076, 219105.541, 221714.5375, 224337.5135, 226977.5125, 229613.0655, 232270.2685, 234952.2065, 237645.3555, 240331.1925, 243034.517, 245756.0725, 248517.6865, 251232.737, 254011.3955, 256785.995, 259556.44, 262368.335, 265156.911, 267965.266, 270785.583, 273616.0495, 276487.4835, 279346.639, 282202.509, 285074.3885, 287942.2855, 290856.018, 293774.0345, 296678.5145, 299603.6355, 302552.6575, 305492.9785, 308466.8605, 311392.581, 314347.538, 317319.4295, 320285.9785, 323301.7325, 326298.3235, 329301.3105, 332301.987, 335309.791, 338370.762, 341382.923, 344431.1265, 347464.1545, 350507.28, 353619.2345, 356631.2005, 359685.203, 362776.7845, 365886.488, 368958.2255, 372060.6825, 375165.4335, 378237.935, 381328.311, 384430.5225, 387576.425, 390683.242, 393839.648, 396977.8425, 400101.9805, 403271.296, 406409.8425, 409529.5485, 412678.7, 415847.423, 419020.8035, 422157.081, 425337.749, 428479.6165, 431700.902, 434893.1915, 438049.582, 441210.5415, 444379.2545, 447577.356, 450741.931, 453959.548, 457137.0935, 460329.846, 463537.4815, 466732.3345, 469960.5615, 473164.681, 476347.6345, 479496.173, 482813.1645, 486025.6995, 489249.4885, 492460.1945, 495675.8805, 498908.0075, 502131.802, 505374.3855, 508550.9915, 511806.7305, 515026.776, 518217.0005, 521523.9855, 524705.9855, 527950.997, 531210.0265, 534472.497, 537750.7315, 540926.922, 544207.094, 547429.4345, 550666.3745, 553975.3475, 557150.7185, 560399.6165, 563662.697, 566916.7395, 570146.1215, 573447.425, 576689.6245, 579874.5745, 583202.337, 586503.0255, 589715.635, 592910.161, 596214.3885, 599488.035, 602740.92, 605983.0685, 609248.67, 612491.3605, 615787.912, 619107.5245, 622307.9555, 625577.333, 628840.4385, 632085.2155, 635317.6135, 638691.7195, 641887.467, 645139.9405, 648441.546, 651666.252, 654941.845, }, - // precision 18 - { 189084, 192250.913, 195456.774, 198696.946, 201977.762, 205294.444, 208651.754, 212042.099, 215472.269, 218941.91, 222443.912, 225996.845, 229568.199, 233193.568, 236844.457, 240543.233, 244279.475, 248044.27, 251854.588, 255693.2, 259583.619, 263494.621, 267445.385, 271454.061, 275468.769, 279549.456, 283646.446, 287788.198, 291966.099, 296181.164, 300431.469, 304718.618, 309024.004, 313393.508, 317760.803, 322209.731, 326675.061, 331160.627, 335654.47, 340241.442, 344841.833, 349467.132, 354130.629, 358819.432, 363574.626, 368296.587, 373118.482, 377914.93, 382782.301, 387680.669, 392601.981, 397544.323, 402529.115, 407546.018, 412593.658, 417638.657, 422762.865, 427886.169, 433017.167, 438213.273, 443441.254, 448692.421, 453937.533, 459239.049, 464529.569, 469910.083, 475274.03, 480684.473, 486070.26, 491515.237, 496995.651, 502476.617, 507973.609, 513497.19, 519083.233, 524726.509, 530305.505, 535945.728, 541584.404, 547274.055, 552967.236, 558667.862, 564360.216, 570128.148, 575965.08, 581701.952, 587532.523, 593361.144, 599246.128, 605033.418, 610958.779, 616837.117, 622772.818, 628672.04, 634675.369, 640574.831, 646585.739, 652574.547, 658611.217, 664642.684, 670713.914, 676737.681, 682797.313, 688837.897, 694917.874, 701009.882, 707173.648, 713257.254, 719415.392, 725636.761, 731710.697, 737906.209, 744103.074, 750313.39, 756504.185, 762712.579, 768876.985, 775167.859, 781359, 787615.959, 793863.597, 800245.477, 806464.582, 812785.294, 819005.925, 825403.057, 831676.197, 837936.284, 844266.968, 850642.711, 856959.756, 863322.774, 869699.931, 876102.478, 882355.787, 888694.463, 895159.952, 901536.143, 907872.631, 914293.672, 920615.14, 927130.974, 933409.404, 939922.178, 946331.47, 952745.93, 959209.264, 965590.224, 972077.284, 978501.961, 984953.19, 991413.271, 997817.479, 1004222.658, 1010725.676, 1017177.138, 1023612.529, 1030098.236, 1036493.719, 1043112.207, 1049537.036, 1056008.096, 1062476.184, 1068942.337, 1075524.95, 1081932.864, 1088426.025, 1094776.005, 1101327.448, 1107901.673, 1114423.639, 1120884.602, 1127324.923, 1133794.24, 1140328.886, 1146849.376, 1153346.682, 1159836.502, 1166478.703, 1172953.304, 1179391.502, 1185950.982, 1192544.052, 1198913.41, 1205430.994, 1212015.525, 1218674.042, 1225121.683, 1231551.101, 1238126.379, 1244673.795, 1251260.649, 1257697.86, 1264320.983, 1270736.319, 1277274.694, 1283804.95, 1290211.514, 1296858.568, 1303455.691, } - }; + // precision 4 + { 11, 11.717, 12.207, 12.7896, 13.2882, 13.8204, 14.3772, 14.9342, 15.5202, 16.161, 16.7722, 17.4636, 18.0396, 18.6766, 19.3566, + 20.0454, 20.7936, 21.4856, 22.2666, 22.9946, 23.766, 24.4692, 25.3638, 26.0764, 26.7864, 27.7602, 28.4814, 29.433, + 30.2926, 31.0664, 31.9996, 32.7956, 33.5366, 34.5894, 35.5738, 36.2698, 37.3682, 38.0544, 39.2342, 40.0108, 40.7966, + 41.9298, 42.8704, 43.6358, 44.5194, 45.773, 46.6772, 47.6174, 48.4888, 49.3304, 50.2506, 51.4996, 52.3824, 53.3078, + 54.3984, 55.5838, 56.6618, 57.2174, 58.3514, 59.0802, 60.1482, 61.0376, 62.3598, 62.8078, 63.9744, 64.914, 65.781, + 67.1806, 68.0594, 68.8446, 69.7928, 70.8248, 71.8324, 72.8598, 73.6246, 74.7014, 75.393, 76.6708, 77.2394, }, + // precision 5 + { 23, 23.1194, 23.8208, 24.2318, 24.77, 25.2436, 25.7774, 26.2848, 26.8224, 27.3742, 27.9336, 28.503, 29.0494, 29.6292, 30.2124, + 30.798, 31.367, 31.9728, 32.5944, 33.217, 33.8438, 34.3696, 35.0956, 35.7044, 36.324, 37.0668, 37.6698, 38.3644, 39.049, + 39.6918, 40.4146, 41.082, 41.687, 42.5398, 43.2462, 43.857, 44.6606, 45.4168, 46.1248, 46.9222, 47.6804, 48.447, + 49.3454, 49.9594, 50.7636, 51.5776, 52.331, 53.19, 53.9676, 54.7564, 55.5314, 56.4442, 57.3708, 57.9774, 58.9624, + 59.8796, 60.755, 61.472, 62.2076, 63.1024, 63.8908, 64.7338, 65.7728, 66.629, 67.413, 68.3266, 69.1524, 70.2642, + 71.1806, 72.0566, 72.9192, 73.7598, 74.3516, 75.5802, 76.4386, 77.4916, 78.1524, 79.1892, 79.8414, 80.8798, 81.8376, + 82.4698, 83.7656, 84.331, 85.5914, 86.6012, 87.7016, 88.5582, 89.3394, 90.3544, 91.4912, 92.308, 93.3552, 93.9746, + 95.2052, 95.727, 97.1322, 98.3944, 98.7588, 100.242, 101.1914, 102.2538, 102.8776, 103.6292, 105.1932, 105.9152, + 107.0868, 107.6728, 108.7144, 110.3114, 110.8716, 111.245, 112.7908, 113.7064, 114.636, 115.7464, 116.1788, 117.7464, + 118.4896, 119.6166, 120.5082, 121.7798, 122.9028, 123.4426, 124.8854, 125.705, 126.4652, 128.3464, 128.3462, 130.0398, + 131.0342, 131.0042, 132.4766, 133.511, 134.7252, 135.425, 136.5172, 138.0572, 138.6694, 139.3712, 140.8598, 141.4594, + 142.554, 143.4006, 144.7374, 146.1634, 146.8994, 147.605, 147.9304, 149.1636, 150.2468, 151.5876, 152.2096, 153.7032, + 154.7146, 155.807, 156.9228, 157.0372, 158.5852, }, + // precision 6 + { 46, 46.1902, 47.271, 47.8358, 48.8142, 49.2854, 50.317, 51.354, 51.8924, 52.9436, 53.4596, 54.5262, 55.6248, 56.1574, 57.2822, + 57.837, 58.9636, 60.074, 60.7042, 61.7976, 62.4772, 63.6564, 64.7942, 65.5004, 66.686, 67.291, 68.5672, 69.8556, + 70.4982, 71.8204, 72.4252, 73.7744, 75.0786, 75.8344, 77.0294, 77.8098, 79.0794, 80.5732, 81.1878, 82.5648, 83.2902, + 84.6784, 85.3352, 86.8946, 88.3712, 89.0852, 90.499, 91.2686, 92.6844, 94.2234, 94.9732, 96.3356, 97.2286, 98.7262, + 100.3284, 101.1048, 102.5962, 103.3562, 105.1272, 106.4184, 107.4974, 109.0822, 109.856, 111.48, 113.2834, 114.0208, + 115.637, 116.5174, 118.0576, 119.7476, 120.427, 122.1326, 123.2372, 125.2788, 126.6776, 127.7926, 129.1952, 129.9564, + 131.6454, 133.87, 134.5428, 136.2, 137.0294, 138.6278, 139.6782, 141.792, 143.3516, 144.2832, 146.0394, 147.0748, + 148.4912, 150.849, 151.696, 153.5404, 154.073, 156.3714, 157.7216, 158.7328, 160.4208, 161.4184, 163.9424, 165.2772, + 166.411, 168.1308, 168.769, 170.9258, 172.6828, 173.7502, 175.706, 176.3886, 179.0186, 180.4518, 181.927, 183.4172, + 184.4114, 186.033, 188.5124, 189.5564, 191.6008, 192.4172, 193.8044, 194.997, 197.4548, 198.8948, 200.2346, 202.3086, + 203.1548, 204.8842, 206.6508, 206.6772, 209.7254, 210.4752, 212.7228, 214.6614, 215.1676, 217.793, 218.0006, 219.9052, + 221.66, 223.5588, 225.1636, 225.6882, 227.7126, 229.4502, 231.1978, 232.9756, 233.1654, 236.727, 238.1974, 237.7474, + 241.1346, 242.3048, 244.1948, 245.3134, 246.879, 249.1204, 249.853, 252.6792, 253.857, 254.4486, 257.2362, 257.9534, + 260.0286, 260.5632, 262.663, 264.723, 265.7566, 267.2566, 267.1624, 270.62, 272.8216, 273.2166, 275.2056, 276.2202, + 278.3726, 280.3344, 281.9284, 283.9728, 284.1924, 286.4872, 287.587, 289.807, 291.1206, 292.769, 294.8708, 296.665, + 297.1182, 299.4012, 300.6352, 302.1354, 304.1756, 306.1606, 307.3462, 308.5214, 309.4134, 310.8352, 313.9684, 315.837, + 316.7796, 318.9858, }, + // precision 7 + { 92, 93.4934, 94.9758, 96.4574, 97.9718, 99.4954, 101.5302, 103.0756, 104.6374, 106.1782, 107.7888, 109.9522, 111.592, + 113.2532, 114.9086, 116.5938, 118.9474, 120.6796, 122.4394, 124.2176, 125.9768, 128.4214, 130.2528, 132.0102, 133.8658, + 135.7278, 138.3044, 140.1316, 142.093, 144.0032, 145.9092, 148.6306, 150.5294, 152.5756, 154.6508, 156.662, 159.552, + 161.3724, 163.617, 165.5754, 167.7872, 169.8444, 172.7988, 174.8606, 177.2118, 179.3566, 181.4476, 184.5882, 186.6816, + 189.0824, 191.0258, 193.6048, 196.4436, 198.7274, 200.957, 203.147, 205.4364, 208.7592, 211.3386, 213.781, 215.8028, + 218.656, 221.6544, 223.996, 226.4718, 229.1544, 231.6098, 234.5956, 237.0616, 239.5758, 242.4878, 244.5244, 248.2146, + 250.724, 252.8722, 255.5198, 258.0414, 261.941, 264.9048, 266.87, 269.4304, 272.028, 274.4708, 278.37, 281.0624, + 283.4668, 286.5532, 289.4352, 293.2564, 295.2744, 298.2118, 300.7472, 304.1456, 307.2928, 309.7504, 312.5528, 315.979, + 318.2102, 322.1834, 324.3494, 327.325, 330.6614, 332.903, 337.2544, 339.9042, 343.215, 345.2864, 348.0814, 352.6764, + 355.301, 357.139, 360.658, 363.1732, 366.5902, 369.9538, 373.0828, 375.922, 378.9902, 382.7328, 386.4538, 388.1136, + 391.2234, 394.0878, 396.708, 401.1556, 404.1852, 406.6372, 409.6822, 412.7796, 416.6078, 418.4916, 422.131, 424.5376, + 428.1988, 432.211, 434.4502, 438.5282, 440.912, 444.0448, 447.7432, 450.8524, 453.7988, 456.7858, 458.8868, 463.9886, + 466.5064, 468.9124, 472.6616, 475.4682, 478.582, 481.304, 485.2738, 488.6894, 490.329, 496.106, 497.6908, 501.1374, + 504.5322, 506.8848, 510.3324, 513.4512, 516.179, 520.4412, 522.6066, 526.167, 528.7794, 533.379, 536.067, 538.46, + 542.9116, 545.692, 547.9546, 552.493, 555.2722, 557.335, 562.449, 564.2014, 569.0738, 571.0974, 574.8564, 578.2996, + 581.409, 583.9704, 585.8098, 589.6528, 594.5998, 595.958, 600.068, 603.3278, 608.2016, 609.9632, 612.864, 615.43, + 620.7794, 621.272, 625.8644, 629.206, 633.219, 634.5154, 638.6102, }, + // precision 8 + { 184.2152, 187.2454, 190.2096, 193.6652, 196.6312, 199.6822, 203.249, 206.3296, 210.0038, 213.2074, 216.4612, 220.27, 223.5178, + 227.4412, 230.8032, 234.1634, 238.1688, 241.6074, 245.6946, 249.2664, 252.8228, 257.0432, 260.6824, 264.9464, 268.6268, + 272.2626, 276.8376, 280.4034, 284.8956, 288.8522, 292.7638, 297.3552, 301.3556, 305.7526, 309.9292, 313.8954, 318.8198, + 322.7668, 327.298, 331.6688, 335.9466, 340.9746, 345.1672, 349.3474, 354.3028, 358.8912, 364.114, 368.4646, 372.9744, + 378.4092, 382.6022, 387.843, 392.5684, 397.1652, 402.5426, 407.4152, 412.5388, 417.3592, 422.1366, 427.486, 432.3918, + 437.5076, 442.509, 447.3834, 453.3498, 458.0668, 463.7346, 469.1228, 473.4528, 479.7, 484.644, 491.0518, 495.5774, + 500.9068, 506.432, 512.1666, 517.434, 522.6644, 527.4894, 533.6312, 538.3804, 544.292, 550.5496, 556.0234, 562.8206, + 566.6146, 572.4188, 579.117, 583.6762, 590.6576, 595.7864, 601.509, 607.5334, 612.9204, 619.772, 624.2924, 630.8654, + 636.1836, 642.745, 649.1316, 655.0386, 660.0136, 666.6342, 671.6196, 678.1866, 684.4282, 689.3324, 695.4794, 702.5038, + 708.129, 713.528, 720.3204, 726.463, 732.7928, 739.123, 744.7418, 751.2192, 756.5102, 762.6066, 769.0184, 775.2224, + 781.4014, 787.7618, 794.1436, 798.6506, 805.6378, 811.766, 819.7514, 824.5776, 828.7322, 837.8048, 843.6302, 849.9336, + 854.4798, 861.3388, 867.9894, 873.8196, 880.3136, 886.2308, 892.4588, 899.0816, 905.4076, 912.0064, 917.3878, 923.619, + 929.998, 937.3482, 943.9506, 947.991, 955.1144, 962.203, 968.8222, 975.7324, 981.7826, 988.7666, 994.2648, 1000.3128, + 1007.4082, 1013.7536, 1020.3376, 1026.7156, 1031.7478, 1037.4292, 1045.393, 1051.2278, 1058.3434, 1062.8726, 1071.884, + 1076.806, 1082.9176, 1089.1678, 1095.5032, 1102.525, 1107.2264, 1115.315, 1120.93, 1127.252, 1134.1496, 1139.0408, + 1147.5448, 1153.3296, 1158.1974, 1166.5262, 1174.3328, 1175.657, 1184.4222, 1190.9172, 1197.1292, 1204.4606, 1210.4578, + 1218.8728, 1225.3336, 1226.6592, 1236.5768, 1241.363, 1249.4074, 1254.6566, 1260.8014, 1266.5454, 1274.5192, }, + // precision 9 + { 369, 374.8294, 381.2452, 387.6698, 394.1464, 400.2024, 406.8782, 413.6598, 420.462, 427.2826, 433.7102, 440.7416, 447.9366, + 455.1046, 462.285, 469.0668, 476.306, 483.8448, 491.301, 498.9886, 506.2422, 513.8138, 521.7074, 529.7428, 537.8402, + 545.1664, 553.3534, 561.594, 569.6886, 577.7876, 585.65, 594.228, 602.8036, 611.1666, 620.0818, 628.0824, 637.2574, + 646.302, 655.1644, 664.0056, 672.3802, 681.7192, 690.5234, 700.2084, 708.831, 718.485, 728.1112, 737.4764, 746.76, + 756.3368, 766.5538, 775.5058, 785.2646, 795.5902, 804.3818, 814.8998, 824.9532, 835.2062, 845.2798, 854.4728, 864.9582, + 875.3292, 886.171, 896.781, 906.5716, 916.7048, 927.5322, 937.875, 949.3972, 958.3464, 969.7274, 980.2834, 992.1444, + 1003.4264, 1013.0166, 1024.018, 1035.0438, 1046.34, 1057.6856, 1068.9836, 1079.0312, 1091.677, 1102.3188, 1113.4846, + 1124.4424, 1135.739, 1147.1488, 1158.9202, 1169.406, 1181.5342, 1193.2834, 1203.8954, 1216.3286, 1226.2146, 1239.6684, + 1251.9946, 1262.123, 1275.4338, 1285.7378, 1296.076, 1308.9692, 1320.4964, 1333.0998, 1343.9864, 1357.7754, 1368.3208, + 1380.4838, 1392.7388, 1406.0758, 1416.9098, 1428.9728, 1440.9228, 1453.9292, 1462.617, 1476.05, 1490.2996, 1500.6128, + 1513.7392, 1524.5174, 1536.6322, 1548.2584, 1562.3766, 1572.423, 1587.1232, 1596.5164, 1610.5938, 1622.5972, 1633.1222, + 1647.7674, 1658.5044, 1671.57, 1683.7044, 1695.4142, 1708.7102, 1720.6094, 1732.6522, 1747.841, 1756.4072, 1769.9786, + 1782.3276, 1797.5216, 1808.3186, 1819.0694, 1834.354, 1844.575, 1856.2808, 1871.1288, 1880.7852, 1893.9622, 1906.3418, + 1920.6548, 1932.9302, 1945.8584, 1955.473, 1968.8248, 1980.6446, 1995.9598, 2008.349, 2019.8556, 2033.0334, 2044.0206, + 2059.3956, 2069.9174, 2082.6084, 2093.7036, 2106.6108, 2118.9124, 2132.301, 2144.7628, 2159.8422, 2171.0212, 2183.101, + 2193.5112, 2208.052, 2221.3194, 2233.3282, 2247.295, 2257.7222, 2273.342, 2286.5638, 2299.6786, 2310.8114, 2322.3312, + 2335.516, 2349.874, 2363.5968, 2373.865, 2387.1918, 2401.8328, 2414.8496, 2424.544, 2436.7592, 2447.1682, 2464.1958, + 2474.3438, 2489.0006, 2497.4526, 2513.6586, 2527.19, 2540.7028, 2553.768, }, + // precision 10 + { 738.1256, 750.4234, 763.1064, 775.4732, 788.4636, 801.0644, 814.488, 827.9654, 841.0832, 854.7864, 868.1992, 882.2176, + 896.5228, 910.1716, 924.7752, 938.899, 953.6126, 968.6492, 982.9474, 998.5214, 1013.1064, 1028.6364, 1044.2468, + 1059.4588, 1075.3832, 1091.0584, 1106.8606, 1123.3868, 1139.5062, 1156.1862, 1172.463, 1189.339, 1206.1936, 1223.1292, + 1240.1854, 1257.2908, 1275.3324, 1292.8518, 1310.5204, 1328.4854, 1345.9318, 1364.552, 1381.4658, 1400.4256, 1419.849, + 1438.152, 1456.8956, 1474.8792, 1494.118, 1513.62, 1532.5132, 1551.9322, 1570.7726, 1590.6086, 1610.5332, 1630.5918, + 1650.4294, 1669.7662, 1690.4106, 1710.7338, 1730.9012, 1750.4486, 1770.1556, 1791.6338, 1812.7312, 1833.6264, 1853.9526, + 1874.8742, 1896.8326, 1918.1966, 1939.5594, 1961.07, 1983.037, 2003.1804, 2026.071, 2047.4884, 2070.0848, 2091.2944, + 2114.333, 2135.9626, 2158.2902, 2181.0814, 2202.0334, 2224.4832, 2246.39, 2269.7202, 2292.1714, 2314.2358, 2338.9346, + 2360.891, 2384.0264, 2408.3834, 2430.1544, 2454.8684, 2476.9896, 2501.4368, 2522.8702, 2548.0408, 2570.6738, 2593.5208, + 2617.0158, 2640.2302, 2664.0962, 2687.4986, 2714.2588, 2735.3914, 2759.6244, 2781.8378, 2808.0072, 2830.6516, 2856.2454, + 2877.2136, 2903.4546, 2926.785, 2951.2294, 2976.468, 3000.867, 3023.6508, 3049.91, 3073.5984, 3098.162, 3121.5564, + 3146.2328, 3170.9484, 3195.5902, 3221.3346, 3242.7032, 3271.6112, 3296.5546, 3317.7376, 3345.072, 3369.9518, 3394.326, + 3418.1818, 3444.6926, 3469.086, 3494.2754, 3517.8698, 3544.248, 3565.3768, 3588.7234, 3616.979, 3643.7504, 3668.6812, + 3695.72, 3719.7392, 3742.6224, 3770.4456, 3795.6602, 3819.9058, 3844.002, 3869.517, 3895.6824, 3920.8622, 3947.1364, + 3973.985, 3995.4772, 4021.62, 4046.628, 4074.65, 4096.2256, 4121.831, 4146.6406, 4173.276, 4195.0744, 4223.9696, + 4251.3708, 4272.9966, 4300.8046, 4326.302, 4353.1248, 4374.312, 4403.0322, 4426.819, 4450.0598, 4478.5206, 4504.8116, + 4528.8928, 4553.9584, 4578.8712, 4603.8384, 4632.3872, 4655.5128, 4675.821, 4704.6222, 4731.9862, 4755.4174, 4781.2628, + 4804.332, 4832.3048, 4862.8752, 4883.4148, 4906.9544, 4935.3516, 4954.3532, 4984.0248, 5011.217, 5035.3258, 5057.3672, + 5084.1828, }, + // precision 11 + { 1477, 1501.6014, 1526.5802, 1551.7942, 1577.3042, 1603.2062, 1629.8402, 1656.2292, 1682.9462, 1709.9926, 1737.3026, 1765.4252, + 1793.0578, 1821.6092, 1849.626, 1878.5568, 1908.527, 1937.5154, 1967.1874, 1997.3878, 2027.37, 2058.1972, 2089.5728, + 2120.1012, 2151.9668, 2183.292, 2216.0772, 2247.8578, 2280.6562, 2313.041, 2345.714, 2380.3112, 2414.1806, 2447.9854, + 2481.656, 2516.346, 2551.5154, 2586.8378, 2621.7448, 2656.6722, 2693.5722, 2729.1462, 2765.4124, 2802.8728, 2838.898, + 2876.408, 2913.4926, 2951.4938, 2989.6776, 3026.282, 3065.7704, 3104.1012, 3143.7388, 3181.6876, 3221.1872, 3261.5048, + 3300.0214, 3339.806, 3381.409, 3421.4144, 3461.4294, 3502.2286, 3544.651, 3586.6156, 3627.337, 3670.083, 3711.1538, + 3753.5094, 3797.01, 3838.6686, 3882.1678, 3922.8116, 3967.9978, 4009.9204, 4054.3286, 4097.5706, 4140.6014, 4185.544, + 4229.5976, 4274.583, 4316.9438, 4361.672, 4406.2786, 4451.8628, 4496.1834, 4543.505, 4589.1816, 4632.5188, 4678.2294, + 4724.8908, 4769.0194, 4817.052, 4861.4588, 4910.1596, 4956.4344, 5002.5238, 5048.13, 5093.6374, 5142.8162, 5187.7894, + 5237.3984, 5285.6078, 5331.0858, 5379.1036, 5428.6258, 5474.6018, 5522.7618, 5571.5822, 5618.59, 5667.9992, 5714.88, + 5763.454, 5808.6982, 5860.3644, 5910.2914, 5953.571, 6005.9232, 6055.1914, 6104.5882, 6154.5702, 6199.7036, 6251.1764, + 6298.7596, 6350.0302, 6398.061, 6448.4694, 6495.933, 6548.0474, 6597.7166, 6646.9416, 6695.9208, 6742.6328, 6793.5276, + 6842.1934, 6894.2372, 6945.3864, 6996.9228, 7044.2372, 7094.1374, 7142.2272, 7192.2942, 7238.8338, 7288.9006, 7344.0908, + 7394.8544, 7443.5176, 7490.4148, 7542.9314, 7595.6738, 7641.9878, 7694.3688, 7743.0448, 7797.522, 7845.53, 7899.594, + 7950.3132, 7996.455, 8050.9442, 8092.9114, 8153.1374, 8197.4472, 8252.8278, 8301.8728, 8348.6776, 8401.4698, 8453.551, + 8504.6598, 8553.8944, 8604.1276, 8657.6514, 8710.3062, 8758.908, 8807.8706, 8862.1702, 8910.4668, 8960.77, 9007.2766, + 9063.164, 9121.0534, 9164.1354, 9218.1594, 9267.767, 9319.0594, 9372.155, 9419.7126, 9474.3722, 9520.1338, 9572.368, + 9622.7702, 9675.8448, 9726.5396, 9778.7378, 9827.6554, 9878.1922, 9928.7782, 9978.3984, 10026.578, 10076.5626, + 10137.1618, 10177.5244, 10229.9176, }, + // precision 12 + { 2954, 3003.4782, 3053.3568, 3104.3666, 3155.324, 3206.9598, 3259.648, 3312.539, 3366.1474, 3420.2576, 3474.8376, 3530.6076, + 3586.451, 3643.38, 3700.4104, 3757.5638, 3815.9676, 3875.193, 3934.838, 3994.8548, 4055.018, 4117.1742, 4178.4482, + 4241.1294, 4304.4776, 4367.4044, 4431.8724, 4496.3732, 4561.4304, 4627.5326, 4693.949, 4761.5532, 4828.7256, 4897.6182, + 4965.5186, 5034.4528, 5104.865, 5174.7164, 5244.6828, 5316.6708, 5387.8312, 5459.9036, 5532.476, 5604.8652, 5679.6718, + 5753.757, 5830.2072, 5905.2828, 5980.0434, 6056.6264, 6134.3192, 6211.5746, 6290.0816, 6367.1176, 6447.9796, 6526.5576, + 6606.1858, 6686.9144, 6766.1142, 6847.0818, 6927.9664, 7010.9096, 7091.0816, 7175.3962, 7260.3454, 7344.018, 7426.4214, + 7511.3106, 7596.0686, 7679.8094, 7765.818, 7852.4248, 7936.834, 8022.363, 8109.5066, 8200.4554, 8288.5832, 8373.366, + 8463.4808, 8549.7682, 8642.0522, 8728.3288, 8820.9528, 8907.727, 9001.0794, 9091.2522, 9179.988, 9269.852, 9362.6394, + 9453.642, 9546.9024, 9640.6616, 9732.6622, 9824.3254, 9917.7484, 10007.9392, 10106.7508, 10196.2152, 10289.8114, + 10383.5494, 10482.3064, 10576.8734, 10668.7872, 10764.7156, 10862.0196, 10952.793, 11049.9748, 11146.0702, 11241.4492, + 11339.2772, 11434.2336, 11530.741, 11627.6136, 11726.311, 11821.5964, 11918.837, 12015.3724, 12113.0162, 12213.0424, + 12306.9804, 12408.4518, 12504.8968, 12604.586, 12700.9332, 12798.705, 12898.5142, 12997.0488, 13094.788, 13198.475, + 13292.7764, 13392.9698, 13486.8574, 13590.1616, 13686.5838, 13783.6264, 13887.2638, 13992.0978, 14081.0844, 14189.9956, + 14280.0912, 14382.4956, 14486.4384, 14588.1082, 14686.2392, 14782.276, 14888.0284, 14985.1864, 15088.8596, 15187.0998, + 15285.027, 15383.6694, 15495.8266, 15591.3736, 15694.2008, 15790.3246, 15898.4116, 15997.4522, 16095.5014, 16198.8514, + 16291.7492, 16402.6424, 16499.1266, 16606.2436, 16697.7186, 16796.3946, 16902.3376, 17005.7672, 17100.814, 17206.8282, + 17305.8262, 17416.0744, 17508.4092, 17617.0178, 17715.4554, 17816.758, 17920.1748, 18012.9236, 18119.7984, 18223.2248, + 18324.2482, 18426.6276, 18525.0932, 18629.8976, 18733.2588, 18831.0466, 18940.1366, 19032.2696, 19131.729, 19243.4864, + 19349.6932, 19442.866, 19547.9448, 19653.2798, 19754.4034, 19854.0692, 19965.1224, 20065.1774, 20158.2212, 20253.353, + 20366.3264, 20463.22, }, + // precision 13 + { 5908.5052, 6007.2672, 6107.347, 6208.5794, 6311.2622, 6414.5514, 6519.3376, 6625.6952, 6732.5988, 6841.3552, 6950.5972, + 7061.3082, 7173.5646, 7287.109, 7401.8216, 7516.4344, 7633.3802, 7751.2962, 7870.3784, 7990.292, 8110.79, 8233.4574, + 8356.6036, 8482.2712, 8607.7708, 8735.099, 8863.1858, 8993.4746, 9123.8496, 9255.6794, 9388.5448, 9522.7516, 9657.3106, + 9792.6094, 9930.5642, 10068.794, 10206.7256, 10347.81, 10490.3196, 10632.0778, 10775.9916, 10920.4662, 11066.124, + 11213.073, 11358.0362, 11508.1006, 11659.1716, 11808.7514, 11959.4884, 12112.1314, 12265.037, 12420.3756, 12578.933, + 12734.311, 12890.0006, 13047.2144, 13207.3096, 13368.5144, 13528.024, 13689.847, 13852.7528, 14018.3168, 14180.5372, + 14346.9668, 14513.5074, 14677.867, 14846.2186, 15017.4186, 15184.9716, 15356.339, 15529.2972, 15697.3578, 15871.8686, + 16042.187, 16216.4094, 16389.4188, 16565.9126, 16742.3272, 16919.0042, 17094.7592, 17273.965, 17451.8342, 17634.4254, + 17810.5984, 17988.9242, 18171.051, 18354.7938, 18539.466, 18721.0408, 18904.9972, 19081.867, 19271.9118, 19451.8694, + 19637.9816, 19821.2922, 20013.1292, 20199.3858, 20387.8726, 20572.9514, 20770.7764, 20955.1714, 21144.751, 21329.9952, + 21520.709, 21712.7016, 21906.3868, 22096.2626, 22286.0524, 22475.051, 22665.5098, 22862.8492, 23055.5294, 23249.6138, + 23437.848, 23636.273, 23826.093, 24020.3296, 24213.3896, 24411.7392, 24602.9614, 24805.7952, 24998.1552, 25193.9588, + 25389.0166, 25585.8392, 25780.6976, 25981.2728, 26175.977, 26376.5252, 26570.1964, 26773.387, 26962.9812, 27163.0586, + 27368.164, 27565.0534, 27758.7428, 27961.1276, 28163.2324, 28362.3816, 28565.7668, 28758.644, 28956.9768, 29163.4722, + 29354.7026, 29561.1186, 29767.9948, 29959.9986, 30164.0492, 30366.9818, 30562.5338, 30762.9928, 30976.1592, 31166.274, + 31376.722, 31570.3734, 31770.809, 31974.8934, 32179.5286, 32387.5442, 32582.3504, 32794.076, 32989.9528, 33191.842, + 33392.4684, 33595.659, 33801.8672, 34000.3414, 34200.0922, 34402.6792, 34610.0638, 34804.0084, 35011.13, 35218.669, + 35418.6634, 35619.0792, 35830.6534, 36028.4966, 36229.7902, 36438.6422, 36630.7764, 36833.3102, 37048.6728, 37247.3916, + 37453.5904, 37669.3614, 37854.5526, 38059.305, 38268.0936, 38470.2516, 38674.7064, 38876.167, 39068.3794, 39281.9144, + 39492.8566, 39684.8628, 39898.4108, 40093.1836, 40297.6858, 40489.7086, 40717.2424, }, + // precision 14 + { 11817.475, 12015.0046, 12215.3792, 12417.7504, 12623.1814, 12830.0086, 13040.0072, 13252.503, 13466.178, 13683.2738, + 13902.0344, 14123.9798, 14347.394, 14573.7784, 14802.6894, 15033.6824, 15266.9134, 15502.8624, 15741.4944, 15980.7956, + 16223.8916, 16468.6316, 16715.733, 16965.5726, 17217.204, 17470.666, 17727.8516, 17986.7886, 18247.6902, 18510.9632, + 18775.304, 19044.7486, 19314.4408, 19587.202, 19862.2576, 20135.924, 20417.0324, 20697.9788, 20979.6112, 21265.0274, + 21550.723, 21841.6906, 22132.162, 22428.1406, 22722.127, 23020.5606, 23319.7394, 23620.4014, 23925.2728, 24226.9224, + 24535.581, 24845.505, 25155.9618, 25470.3828, 25785.9702, 26103.7764, 26420.4132, 26742.0186, 27062.8852, 27388.415, + 27714.6024, 28042.296, 28365.4494, 28701.1526, 29031.8008, 29364.2156, 29704.497, 30037.1458, 30380.111, 30723.8168, + 31059.5114, 31404.9498, 31751.6752, 32095.2686, 32444.7792, 32794.767, 33145.204, 33498.4226, 33847.6502, 34209.006, + 34560.849, 34919.4838, 35274.9778, 35635.1322, 35996.3266, 36359.1394, 36722.8266, 37082.8516, 37447.7354, 37815.9606, + 38191.0692, 38559.4106, 38924.8112, 39294.6726, 39663.973, 40042.261, 40416.2036, 40779.2036, 41161.6436, 41540.9014, + 41921.1998, 42294.7698, 42678.5264, 43061.3464, 43432.375, 43818.432, 44198.6598, 44583.0138, 44970.4794, 45353.924, + 45729.858, 46118.2224, 46511.5724, 46900.7386, 47280.6964, 47668.1472, 48055.6796, 48446.9436, 48838.7146, 49217.7296, + 49613.7796, 50010.7508, 50410.0208, 50793.7886, 51190.2456, 51583.1882, 51971.0796, 52376.5338, 52763.319, 53165.5534, + 53556.5594, 53948.2702, 54346.352, 54748.7914, 55138.577, 55543.4824, 55941.1748, 56333.7746, 56745.1552, 57142.7944, + 57545.2236, 57935.9956, 58348.5268, 58737.5474, 59158.5962, 59542.6896, 59958.8004, 60349.3788, 60755.0212, 61147.6144, + 61548.194, 61946.0696, 62348.6042, 62763.603, 63162.781, 63560.635, 63974.3482, 64366.4908, 64771.5876, 65176.7346, + 65597.3916, 65995.915, 66394.0384, 66822.9396, 67203.6336, 67612.2032, 68019.0078, 68420.0388, 68821.22, 69235.8388, + 69640.0724, 70055.155, 70466.357, 70863.4266, 71276.2482, 71677.0306, 72080.2006, 72493.0214, 72893.5952, 73314.5856, + 73714.9852, 74125.3022, 74521.2122, 74933.6814, 75341.5904, 75743.0244, 76166.0278, 76572.1322, 76973.1028, 77381.6284, + 77800.6092, 78189.328, 78607.0962, 79012.2508, 79407.8358, 79825.725, 80238.701, 80646.891, 81035.6436, 81460.0448, + 81876.3884, }, + // precision 15 + { 23635.0036, 24030.8034, 24431.4744, 24837.1524, 25246.7928, 25661.326, 26081.3532, 26505.2806, 26933.9892, 27367.7098, + 27805.318, 28248.799, 28696.4382, 29148.8244, 29605.5138, 30066.8668, 30534.2344, 31006.32, 31480.778, 31962.2418, + 32447.3324, 32938.0232, 33432.731, 33930.728, 34433.9896, 34944.1402, 35457.5588, 35974.5958, 36497.3296, 37021.9096, + 37554.326, 38088.0826, 38628.8816, 39171.3192, 39723.2326, 40274.5554, 40832.3142, 41390.613, 41959.5908, 42532.5466, + 43102.0344, 43683.5072, 44266.694, 44851.2822, 45440.7862, 46038.0586, 46640.3164, 47241.064, 47846.155, 48454.7396, + 49076.9168, 49692.542, 50317.4778, 50939.65, 51572.5596, 52210.2906, 52843.7396, 53481.3996, 54127.236, 54770.406, + 55422.6598, 56078.7958, 56736.7174, 57397.6784, 58064.5784, 58730.308, 59404.9784, 60077.0864, 60751.9158, 61444.1386, + 62115.817, 62808.7742, 63501.4774, 64187.5454, 64883.6622, 65582.7468, 66274.5318, 66976.9276, 67688.7764, 68402.138, + 69109.6274, 69822.9706, 70543.6108, 71265.5202, 71983.3848, 72708.4656, 73433.384, 74158.4664, 74896.4868, 75620.9564, + 76362.1434, 77098.3204, 77835.7662, 78582.6114, 79323.9902, 80067.8658, 80814.9246, 81567.0136, 82310.8536, 83061.9952, + 83821.4096, 84580.8608, 85335.547, 86092.5802, 86851.6506, 87612.311, 88381.2016, 89146.3296, 89907.8974, 90676.846, + 91451.4152, 92224.5518, 92995.8686, 93763.5066, 94551.2796, 95315.1944, 96096.1806, 96881.0918, 97665.679, 98442.68, + 99229.3002, 100011.0994, 100790.6386, 101580.1564, 102377.7484, 103152.1392, 103944.2712, 104730.216, 105528.6336, + 106324.9398, 107117.6706, 107890.3988, 108695.2266, 109485.238, 110294.7876, 111075.0958, 111878.0496, 112695.2864, + 113464.5486, 114270.0474, 115068.608, 115884.3626, 116673.2588, 117483.3716, 118275.097, 119085.4092, 119879.2808, + 120687.5868, 121499.9944, 122284.916, 123095.9254, 123912.5038, 124709.0454, 125503.7182, 126323.259, 127138.9412, + 127943.8294, 128755.646, 129556.5354, 130375.3298, 131161.4734, 131971.1962, 132787.5458, 133588.1056, 134431.351, + 135220.2906, 136023.398, 136846.6558, 137667.0004, 138463.663, 139283.7154, 140074.6146, 140901.3072, 141721.8548, + 142543.2322, 143356.1096, 144173.7412, 144973.0948, 145794.3162, 146609.5714, 147420.003, 148237.9784, 149050.5696, + 149854.761, 150663.1966, 151494.0754, 152313.1416, 153112.6902, 153935.7206, 154746.9262, 155559.547, 156401.9746, + 157228.7036, 158008.7254, 158820.75, 159646.9184, 160470.4458, 161279.5348, 162093.3114, 162918.542, 163729.2842, }, + // precision 16 + { 47271, 48062.3584, 48862.7074, 49673.152, 50492.8416, 51322.9514, 52161.03, 53009.407, 53867.6348, 54734.206, 55610.5144, + 56496.2096, 57390.795, 58297.268, 59210.6448, 60134.665, 61068.0248, 62010.4472, 62962.5204, 63923.5742, 64895.0194, + 65876.4182, 66862.6136, 67862.6968, 68868.8908, 69882.8544, 70911.271, 71944.0924, 72990.0326, 74040.692, 75100.6336, + 76174.7826, 77252.5998, 78340.2974, 79438.2572, 80545.4976, 81657.2796, 82784.6336, 83915.515, 85059.7362, 86205.9368, + 87364.4424, 88530.3358, 89707.3744, 90885.9638, 92080.197, 93275.5738, 94479.391, 95695.918, 96919.2236, 98148.4602, + 99382.3474, 100625.6974, 101878.0284, 103141.6278, 104409.4588, 105686.2882, 106967.5402, 108261.6032, 109548.1578, + 110852.0728, 112162.231, 113479.0072, 114806.2626, 116137.9072, 117469.5048, 118813.5186, 120165.4876, 121516.2556, + 122875.766, 124250.5444, 125621.2222, 127003.2352, 128387.848, 129775.2644, 131181.7776, 132577.3086, 133979.9458, + 135394.1132, 136800.9078, 138233.217, 139668.5308, 141085.212, 142535.2122, 143969.0684, 145420.2872, 146878.1542, + 148332.7572, 149800.3202, 151269.66, 152743.6104, 154213.0948, 155690.288, 157169.4246, 158672.1756, 160160.059, + 161650.6854, 163145.7772, 164645.6726, 166159.1952, 167682.1578, 169177.3328, 170700.0118, 172228.8964, 173732.6664, + 175265.5556, 176787.799, 178317.111, 179856.6914, 181400.865, 182943.4612, 184486.742, 186033.4698, 187583.7886, + 189148.1868, 190688.4526, 192250.1926, 193810.9042, 195354.2972, 196938.7682, 198493.5898, 200079.2824, 201618.912, + 203205.5492, 204765.5798, 206356.1124, 207929.3064, 209498.7196, 211086.229, 212675.1324, 214256.7892, 215826.2392, + 217412.8474, 218995.6724, 220618.6038, 222207.1166, 223781.0364, 225387.4332, 227005.7928, 228590.4336, 230217.8738, + 231805.1054, 233408.9, 234995.3432, 236601.4956, 238190.7904, 239817.2548, 241411.2832, 243002.4066, 244640.1884, + 246255.3128, 247849.3508, 249479.9734, 251106.8822, 252705.027, 254332.9242, 255935.129, 257526.9014, 259154.772, + 260777.625, 262390.253, 264004.4906, 265643.59, 267255.4076, 268873.426, 270470.7252, 272106.4804, 273722.4456, + 275337.794, 276945.7038, 278592.9154, 280204.3726, 281841.1606, 283489.171, 285130.1716, 286735.3362, 288364.7164, + 289961.1814, 291595.5524, 293285.683, 294899.6668, 296499.3434, 298128.0462, 299761.8946, 301394.2424, 302997.6748, + 304615.1478, 306269.7724, 307886.114, 309543.1028, 311153.2862, 312782.8546, 314421.2008, 316033.2438, 317692.9636, + 319305.2648, 320948.7406, 322566.3364, 324228.4224, 325847.1542, }, + // precision 17 + { 94542, 96125.811, 97728.019, 99348.558, 100987.9705, 102646.7565, 104324.5125, 106021.7435, 107736.7865, 109469.272, + 111223.9465, 112995.219, 114787.432, 116593.152, 118422.71, 120267.2345, 122134.6765, 124020.937, 125927.2705, + 127851.255, 129788.9485, 131751.016, 133726.8225, 135722.592, 137736.789, 139770.568, 141821.518, 143891.343, + 145982.1415, 148095.387, 150207.526, 152355.649, 154515.6415, 156696.05, 158887.7575, 161098.159, 163329.852, + 165569.053, 167837.4005, 170121.6165, 172420.4595, 174732.6265, 177062.77, 179412.502, 181774.035, 184151.939, + 186551.6895, 188965.691, 191402.8095, 193857.949, 196305.0775, 198774.6715, 201271.2585, 203764.78, 206299.3695, + 208818.1365, 211373.115, 213946.7465, 216532.076, 219105.541, 221714.5375, 224337.5135, 226977.5125, 229613.0655, + 232270.2685, 234952.2065, 237645.3555, 240331.1925, 243034.517, 245756.0725, 248517.6865, 251232.737, 254011.3955, + 256785.995, 259556.44, 262368.335, 265156.911, 267965.266, 270785.583, 273616.0495, 276487.4835, 279346.639, 282202.509, + 285074.3885, 287942.2855, 290856.018, 293774.0345, 296678.5145, 299603.6355, 302552.6575, 305492.9785, 308466.8605, + 311392.581, 314347.538, 317319.4295, 320285.9785, 323301.7325, 326298.3235, 329301.3105, 332301.987, 335309.791, + 338370.762, 341382.923, 344431.1265, 347464.1545, 350507.28, 353619.2345, 356631.2005, 359685.203, 362776.7845, + 365886.488, 368958.2255, 372060.6825, 375165.4335, 378237.935, 381328.311, 384430.5225, 387576.425, 390683.242, + 393839.648, 396977.8425, 400101.9805, 403271.296, 406409.8425, 409529.5485, 412678.7, 415847.423, 419020.8035, + 422157.081, 425337.749, 428479.6165, 431700.902, 434893.1915, 438049.582, 441210.5415, 444379.2545, 447577.356, + 450741.931, 453959.548, 457137.0935, 460329.846, 463537.4815, 466732.3345, 469960.5615, 473164.681, 476347.6345, + 479496.173, 482813.1645, 486025.6995, 489249.4885, 492460.1945, 495675.8805, 498908.0075, 502131.802, 505374.3855, + 508550.9915, 511806.7305, 515026.776, 518217.0005, 521523.9855, 524705.9855, 527950.997, 531210.0265, 534472.497, + 537750.7315, 540926.922, 544207.094, 547429.4345, 550666.3745, 553975.3475, 557150.7185, 560399.6165, 563662.697, + 566916.7395, 570146.1215, 573447.425, 576689.6245, 579874.5745, 583202.337, 586503.0255, 589715.635, 592910.161, + 596214.3885, 599488.035, 602740.92, 605983.0685, 609248.67, 612491.3605, 615787.912, 619107.5245, 622307.9555, + 625577.333, 628840.4385, 632085.2155, 635317.6135, 638691.7195, 641887.467, 645139.9405, 648441.546, 651666.252, + 654941.845, }, + // precision 18 + { 189084, 192250.913, 195456.774, 198696.946, 201977.762, 205294.444, 208651.754, 212042.099, 215472.269, 218941.91, 222443.912, + 225996.845, 229568.199, 233193.568, 236844.457, 240543.233, 244279.475, 248044.27, 251854.588, 255693.2, 259583.619, + 263494.621, 267445.385, 271454.061, 275468.769, 279549.456, 283646.446, 287788.198, 291966.099, 296181.164, 300431.469, + 304718.618, 309024.004, 313393.508, 317760.803, 322209.731, 326675.061, 331160.627, 335654.47, 340241.442, 344841.833, + 349467.132, 354130.629, 358819.432, 363574.626, 368296.587, 373118.482, 377914.93, 382782.301, 387680.669, 392601.981, + 397544.323, 402529.115, 407546.018, 412593.658, 417638.657, 422762.865, 427886.169, 433017.167, 438213.273, 443441.254, + 448692.421, 453937.533, 459239.049, 464529.569, 469910.083, 475274.03, 480684.473, 486070.26, 491515.237, 496995.651, + 502476.617, 507973.609, 513497.19, 519083.233, 524726.509, 530305.505, 535945.728, 541584.404, 547274.055, 552967.236, + 558667.862, 564360.216, 570128.148, 575965.08, 581701.952, 587532.523, 593361.144, 599246.128, 605033.418, 610958.779, + 616837.117, 622772.818, 628672.04, 634675.369, 640574.831, 646585.739, 652574.547, 658611.217, 664642.684, 670713.914, + 676737.681, 682797.313, 688837.897, 694917.874, 701009.882, 707173.648, 713257.254, 719415.392, 725636.761, 731710.697, + 737906.209, 744103.074, 750313.39, 756504.185, 762712.579, 768876.985, 775167.859, 781359, 787615.959, 793863.597, + 800245.477, 806464.582, 812785.294, 819005.925, 825403.057, 831676.197, 837936.284, 844266.968, 850642.711, 856959.756, + 863322.774, 869699.931, 876102.478, 882355.787, 888694.463, 895159.952, 901536.143, 907872.631, 914293.672, 920615.14, + 927130.974, 933409.404, 939922.178, 946331.47, 952745.93, 959209.264, 965590.224, 972077.284, 978501.961, 984953.19, + 991413.271, 997817.479, 1004222.658, 1010725.676, 1017177.138, 1023612.529, 1030098.236, 1036493.719, 1043112.207, + 1049537.036, 1056008.096, 1062476.184, 1068942.337, 1075524.95, 1081932.864, 1088426.025, 1094776.005, 1101327.448, + 1107901.673, 1114423.639, 1120884.602, 1127324.923, 1133794.24, 1140328.886, 1146849.376, 1153346.682, 1159836.502, + 1166478.703, 1172953.304, 1179391.502, 1185950.982, 1192544.052, 1198913.41, 1205430.994, 1212015.525, 1218674.042, + 1225121.683, 1231551.101, 1238126.379, 1244673.795, 1251260.649, 1257697.86, 1264320.983, 1270736.319, 1277274.694, + 1283804.95, 1290211.514, 1296858.568, 1303455.691, } }; private static final double[][] BIAS_DATA = { - // precision 4 - { 10, 9.717, 9.207, 8.7896, 8.2882, 7.8204, 7.3772, 6.9342, 6.5202, 6.161, 5.7722, 5.4636, 5.0396, 4.6766, 4.3566, 4.0454, 3.7936, 3.4856, 3.2666, 2.9946, 2.766, 2.4692, 2.3638, 2.0764, 1.7864, 1.7602, 1.4814, 1.433, 1.2926, 1.0664, 0.999600000000001, 0.7956, 0.5366, 0.589399999999998, 0.573799999999999, 0.269799999999996, 0.368200000000002, 0.0544000000000011, 0.234200000000001, 0.0108000000000033, -0.203400000000002, -0.0701999999999998, -0.129600000000003, -0.364199999999997, -0.480600000000003, -0.226999999999997, -0.322800000000001, -0.382599999999996, -0.511200000000002, -0.669600000000003, -0.749400000000001, -0.500399999999999, -0.617600000000003, -0.6922, -0.601599999999998, -0.416200000000003, -0.338200000000001, -0.782600000000002, -0.648600000000002, -0.919800000000002, -0.851799999999997, -0.962400000000002, -0.6402, -1.1922, -1.0256, -1.086, -1.21899999999999, -0.819400000000002, -0.940600000000003, -1.1554, -1.2072, -1.1752, -1.16759999999999, -1.14019999999999, -1.3754, -1.29859999999999, -1.607, -1.3292, -1.7606, }, - // precision 5 - { 22, 21.1194, 20.8208, 20.2318, 19.77, 19.2436, 18.7774, 18.2848, 17.8224, 17.3742, 16.9336, 16.503, 16.0494, 15.6292, 15.2124, 14.798, 14.367, 13.9728, 13.5944, 13.217, 12.8438, 12.3696, 12.0956, 11.7044, 11.324, 11.0668, 10.6698, 10.3644, 10.049, 9.6918, 9.4146, 9.082, 8.687, 8.5398, 8.2462, 7.857, 7.6606, 7.4168, 7.1248, 6.9222, 6.6804, 6.447, 6.3454, 5.9594, 5.7636, 5.5776, 5.331, 5.19, 4.9676, 4.7564, 4.5314, 4.4442, 4.3708, 3.9774, 3.9624, 3.8796, 3.755, 3.472, 3.2076, 3.1024, 2.8908, 2.7338, 2.7728, 2.629, 2.413, 2.3266, 2.1524, 2.2642, 2.1806, 2.0566, 1.9192, 1.7598, 1.3516, 1.5802, 1.43859999999999, 1.49160000000001, 1.1524, 1.1892, 0.841399999999993, 0.879800000000003, 0.837599999999995, 0.469800000000006, 0.765600000000006, 0.331000000000003, 0.591399999999993, 0.601200000000006, 0.701599999999999, 0.558199999999999, 0.339399999999998, 0.354399999999998, 0.491200000000006, 0.308000000000007, 0.355199999999996, -0.0254000000000048, 0.205200000000005, -0.272999999999996, 0.132199999999997, 0.394400000000005, -0.241200000000006, 0.242000000000004, 0.191400000000002, 0.253799999999998, -0.122399999999999, -0.370800000000003, 0.193200000000004, -0.0848000000000013, 0.0867999999999967, -0.327200000000005, -0.285600000000002, 0.311400000000006, -0.128399999999999, -0.754999999999995, -0.209199999999996, -0.293599999999998, -0.364000000000004, -0.253600000000006, -0.821200000000005, -0.253600000000006, -0.510400000000004, -0.383399999999995, -0.491799999999998, -0.220200000000006, -0.0972000000000008, -0.557400000000001, -0.114599999999996, -0.295000000000002, -0.534800000000004, 0.346399999999988, -0.65379999999999, 0.0398000000000138, 0.0341999999999985, -0.995800000000003, -0.523400000000009, -0.489000000000004, -0.274799999999999, -0.574999999999989, -0.482799999999997, 0.0571999999999946, -0.330600000000004, -0.628800000000012, -0.140199999999993, -0.540600000000012, -0.445999999999998, -0.599400000000003, -0.262599999999992, 0.163399999999996, -0.100599999999986, -0.39500000000001, -1.06960000000001, -0.836399999999998, -0.753199999999993, -0.412399999999991, -0.790400000000005, -0.29679999999999, -0.28540000000001, -0.193000000000012, -0.0772000000000048, -0.962799999999987, -0.414800000000014, }, - // precision 6 - { 45, 44.1902, 43.271, 42.8358, 41.8142, 41.2854, 40.317, 39.354, 38.8924, 37.9436, 37.4596, 36.5262, 35.6248, 35.1574, 34.2822, 33.837, 32.9636, 32.074, 31.7042, 30.7976, 30.4772, 29.6564, 28.7942, 28.5004, 27.686, 27.291, 26.5672, 25.8556, 25.4982, 24.8204, 24.4252, 23.7744, 23.0786, 22.8344, 22.0294, 21.8098, 21.0794, 20.5732, 20.1878, 19.5648, 19.2902, 18.6784, 18.3352, 17.8946, 17.3712, 17.0852, 16.499, 16.2686, 15.6844, 15.2234, 14.9732, 14.3356, 14.2286, 13.7262, 13.3284, 13.1048, 12.5962, 12.3562, 12.1272, 11.4184, 11.4974, 11.0822, 10.856, 10.48, 10.2834, 10.0208, 9.637, 9.51739999999999, 9.05759999999999, 8.74760000000001, 8.42700000000001, 8.1326, 8.2372, 8.2788, 7.6776, 7.79259999999999, 7.1952, 6.9564, 6.6454, 6.87, 6.5428, 6.19999999999999, 6.02940000000001, 5.62780000000001, 5.6782, 5.792, 5.35159999999999, 5.28319999999999, 5.0394, 5.07480000000001, 4.49119999999999, 4.84899999999999, 4.696, 4.54040000000001, 4.07300000000001, 4.37139999999999, 3.7216, 3.7328, 3.42080000000001, 3.41839999999999, 3.94239999999999, 3.27719999999999, 3.411, 3.13079999999999, 2.76900000000001, 2.92580000000001, 2.68279999999999, 2.75020000000001, 2.70599999999999, 2.3886, 3.01859999999999, 2.45179999999999, 2.92699999999999, 2.41720000000001, 2.41139999999999, 2.03299999999999, 2.51240000000001, 2.5564, 2.60079999999999, 2.41720000000001, 1.80439999999999, 1.99700000000001, 2.45480000000001, 1.8948, 2.2346, 2.30860000000001, 2.15479999999999, 1.88419999999999, 1.6508, 0.677199999999999, 1.72540000000001, 1.4752, 1.72280000000001, 1.66139999999999, 1.16759999999999, 1.79300000000001, 1.00059999999999, 0.905200000000008, 0.659999999999997, 1.55879999999999, 1.1636, 0.688199999999995, 0.712600000000009, 0.450199999999995, 1.1978, 0.975599999999986, 0.165400000000005, 1.727, 1.19739999999999, -0.252600000000001, 1.13460000000001, 1.3048, 1.19479999999999, 0.313400000000001, 0.878999999999991, 1.12039999999999, 0.853000000000009, 1.67920000000001, 0.856999999999999, 0.448599999999999, 1.2362, 0.953399999999988, 1.02859999999998, 0.563199999999995, 0.663000000000011, 0.723000000000013, 0.756599999999992, 0.256599999999992, -0.837600000000009, 0.620000000000005, 0.821599999999989, 0.216600000000028, 0.205600000000004, 0.220199999999977, 0.372599999999977, 0.334400000000016, 0.928400000000011, 0.972800000000007, 0.192400000000021, 0.487199999999973, -0.413000000000011, 0.807000000000016, 0.120600000000024, 0.769000000000005, 0.870799999999974, 0.66500000000002, 0.118200000000002, 0.401200000000017, 0.635199999999998, 0.135400000000004, 0.175599999999974, 1.16059999999999, 0.34620000000001, 0.521400000000028, -0.586599999999976, -1.16480000000001, 0.968399999999974, 0.836999999999989, 0.779600000000016, 0.985799999999983, }, - // precision 7 - { 91, 89.4934, 87.9758, 86.4574, 84.9718, 83.4954, 81.5302, 80.0756, 78.6374, 77.1782, 75.7888, 73.9522, 72.592, 71.2532, 69.9086, 68.5938, 66.9474, 65.6796, 64.4394, 63.2176, 61.9768, 60.4214, 59.2528, 58.0102, 56.8658, 55.7278, 54.3044, 53.1316, 52.093, 51.0032, 49.9092, 48.6306, 47.5294, 46.5756, 45.6508, 44.662, 43.552, 42.3724, 41.617, 40.5754, 39.7872, 38.8444, 37.7988, 36.8606, 36.2118, 35.3566, 34.4476, 33.5882, 32.6816, 32.0824, 31.0258, 30.6048, 29.4436, 28.7274, 27.957, 27.147, 26.4364, 25.7592, 25.3386, 24.781, 23.8028, 23.656, 22.6544, 21.996, 21.4718, 21.1544, 20.6098, 19.5956, 19.0616, 18.5758, 18.4878, 17.5244, 17.2146, 16.724, 15.8722, 15.5198, 15.0414, 14.941, 14.9048, 13.87, 13.4304, 13.028, 12.4708, 12.37, 12.0624, 11.4668, 11.5532, 11.4352, 11.2564, 10.2744, 10.2118, 9.74720000000002, 10.1456, 9.2928, 8.75040000000001, 8.55279999999999, 8.97899999999998, 8.21019999999999, 8.18340000000001, 7.3494, 7.32499999999999, 7.66140000000001, 6.90300000000002, 7.25439999999998, 6.9042, 7.21499999999997, 6.28640000000001, 6.08139999999997, 6.6764, 6.30099999999999, 5.13900000000001, 5.65800000000002, 5.17320000000001, 4.59019999999998, 4.9538, 5.08280000000002, 4.92200000000003, 4.99020000000002, 4.7328, 5.4538, 4.11360000000002, 4.22340000000003, 4.08780000000002, 3.70800000000003, 4.15559999999999, 4.18520000000001, 3.63720000000001, 3.68220000000002, 3.77960000000002, 3.6078, 2.49160000000001, 3.13099999999997, 2.5376, 3.19880000000001, 3.21100000000001, 2.4502, 3.52820000000003, 2.91199999999998, 3.04480000000001, 2.7432, 2.85239999999999, 2.79880000000003, 2.78579999999999, 1.88679999999999, 2.98860000000002, 2.50639999999999, 1.91239999999999, 2.66160000000002, 2.46820000000002, 1.58199999999999, 1.30399999999997, 2.27379999999999, 2.68939999999998, 1.32900000000001, 3.10599999999999, 1.69080000000002, 2.13740000000001, 2.53219999999999, 1.88479999999998, 1.33240000000001, 1.45119999999997, 1.17899999999997, 2.44119999999998, 1.60659999999996, 2.16700000000003, 0.77940000000001, 2.37900000000002, 2.06700000000001, 1.46000000000004, 2.91160000000002, 1.69200000000001, 0.954600000000028, 2.49300000000005, 2.2722, 1.33500000000004, 2.44899999999996, 1.20140000000004, 3.07380000000001, 2.09739999999999, 2.85640000000001, 2.29960000000005, 2.40899999999999, 1.97040000000004, 0.809799999999996, 1.65279999999996, 2.59979999999996, 0.95799999999997, 2.06799999999998, 2.32780000000002, 4.20159999999998, 1.96320000000003, 1.86400000000003, 1.42999999999995, 3.77940000000001, 1.27200000000005, 1.86440000000005, 2.20600000000002, 3.21900000000005, 1.5154, 2.61019999999996, }, - // precision 8 - { 183.2152, 180.2454, 177.2096, 173.6652, 170.6312, 167.6822, 164.249, 161.3296, 158.0038, 155.2074, 152.4612, 149.27, 146.5178, 143.4412, 140.8032, 138.1634, 135.1688, 132.6074, 129.6946, 127.2664, 124.8228, 122.0432, 119.6824, 116.9464, 114.6268, 112.2626, 109.8376, 107.4034, 104.8956, 102.8522, 100.7638, 98.3552, 96.3556, 93.7526, 91.9292, 89.8954, 87.8198, 85.7668, 83.298, 81.6688, 79.9466, 77.9746, 76.1672, 74.3474, 72.3028, 70.8912, 69.114, 67.4646, 65.9744, 64.4092, 62.6022, 60.843, 59.5684, 58.1652, 56.5426, 55.4152, 53.5388, 52.3592, 51.1366, 49.486, 48.3918, 46.5076, 45.509, 44.3834, 43.3498, 42.0668, 40.7346, 40.1228, 38.4528, 37.7, 36.644, 36.0518, 34.5774, 33.9068, 32.432, 32.1666, 30.434, 29.6644, 28.4894, 27.6312, 26.3804, 26.292, 25.5496000000001, 25.0234, 24.8206, 22.6146, 22.4188, 22.117, 20.6762, 20.6576, 19.7864, 19.509, 18.5334, 17.9204, 17.772, 16.2924, 16.8654, 15.1836, 15.745, 15.1316, 15.0386, 14.0136, 13.6342, 12.6196, 12.1866, 12.4281999999999, 11.3324, 10.4794000000001, 11.5038, 10.129, 9.52800000000002, 10.3203999999999, 9.46299999999997, 9.79280000000006, 9.12300000000005, 8.74180000000001, 9.2192, 7.51020000000005, 7.60659999999996, 7.01840000000004, 7.22239999999999, 7.40139999999997, 6.76179999999999, 7.14359999999999, 5.65060000000005, 5.63779999999997, 5.76599999999996, 6.75139999999999, 5.57759999999996, 3.73220000000003, 5.8048, 5.63019999999995, 4.93359999999996, 3.47979999999995, 4.33879999999999, 3.98940000000005, 3.81960000000004, 3.31359999999995, 3.23080000000004, 3.4588, 3.08159999999998, 3.4076, 3.00639999999999, 2.38779999999997, 2.61900000000003, 1.99800000000005, 3.34820000000002, 2.95060000000001, 0.990999999999985, 2.11440000000005, 2.20299999999997, 2.82219999999995, 2.73239999999998, 2.7826, 3.76660000000004, 2.26480000000004, 2.31280000000004, 2.40819999999997, 2.75360000000001, 3.33759999999995, 2.71559999999999, 1.7478000000001, 1.42920000000004, 2.39300000000003, 2.22779999999989, 2.34339999999997, 0.87259999999992, 3.88400000000001, 1.80600000000004, 1.91759999999999, 1.16779999999994, 1.50320000000011, 2.52500000000009, 0.226400000000012, 2.31500000000005, 0.930000000000064, 1.25199999999995, 2.14959999999996, 0.0407999999999902, 2.5447999999999, 1.32960000000003, 0.197400000000016, 2.52620000000002, 3.33279999999991, -1.34300000000007, 0.422199999999975, 0.917200000000093, 1.12920000000008, 1.46060000000011, 1.45779999999991, 2.8728000000001, 3.33359999999993, -1.34079999999994, 1.57680000000005, 0.363000000000056, 1.40740000000005, 0.656600000000026, 0.801400000000058, -0.454600000000028, 1.51919999999996, }, - // precision 9 - { 368, 361.8294, 355.2452, 348.6698, 342.1464, 336.2024, 329.8782, 323.6598, 317.462, 311.2826, 305.7102, 299.7416, 293.9366, 288.1046, 282.285, 277.0668, 271.306, 265.8448, 260.301, 254.9886, 250.2422, 244.8138, 239.7074, 234.7428, 229.8402, 225.1664, 220.3534, 215.594, 210.6886, 205.7876, 201.65, 197.228, 192.8036, 188.1666, 184.0818, 180.0824, 176.2574, 172.302, 168.1644, 164.0056, 160.3802, 156.7192, 152.5234, 149.2084, 145.831, 142.485, 139.1112, 135.4764, 131.76, 129.3368, 126.5538, 122.5058, 119.2646, 116.5902, 113.3818, 110.8998, 107.9532, 105.2062, 102.2798, 99.4728, 96.9582, 94.3292, 92.171, 89.7809999999999, 87.5716, 84.7048, 82.5322, 79.875, 78.3972, 75.3464, 73.7274, 71.2834, 70.1444, 68.4263999999999, 66.0166, 64.018, 62.0437999999999, 60.3399999999999, 58.6856, 57.9836, 55.0311999999999, 54.6769999999999, 52.3188, 51.4846, 49.4423999999999, 47.739, 46.1487999999999, 44.9202, 43.4059999999999, 42.5342000000001, 41.2834, 38.8954000000001, 38.3286000000001, 36.2146, 36.6684, 35.9946, 33.123, 33.4338, 31.7378000000001, 29.076, 28.9692, 27.4964, 27.0998, 25.9864, 26.7754, 24.3208, 23.4838, 22.7388000000001, 24.0758000000001, 21.9097999999999, 20.9728, 19.9228000000001, 19.9292, 16.617, 17.05, 18.2996000000001, 15.6128000000001, 15.7392, 14.5174, 13.6322, 12.2583999999999, 13.3766000000001, 11.423, 13.1232, 9.51639999999998, 10.5938000000001, 9.59719999999993, 8.12220000000002, 9.76739999999995, 7.50440000000003, 7.56999999999994, 6.70440000000008, 6.41419999999994, 6.71019999999999, 5.60940000000005, 4.65219999999999, 6.84099999999989, 3.4072000000001, 3.97859999999991, 3.32760000000007, 5.52160000000003, 3.31860000000006, 2.06940000000009, 4.35400000000004, 1.57500000000005, 0.280799999999999, 2.12879999999996, -0.214799999999968, -0.0378000000000611, -0.658200000000079, 0.654800000000023, -0.0697999999999865, 0.858400000000074, -2.52700000000004, -2.1751999999999, -3.35539999999992, -1.04019999999991, -0.651000000000067, -2.14439999999991, -1.96659999999997, -3.97939999999994, -0.604400000000169, -3.08260000000018, -3.39159999999993, -5.29640000000018, -5.38920000000007, -5.08759999999984, -4.69900000000007, -5.23720000000003, -3.15779999999995, -4.97879999999986, -4.89899999999989, -7.48880000000008, -5.94799999999987, -5.68060000000014, -6.67180000000008, -4.70499999999993, -7.27779999999984, -4.6579999999999, -4.4362000000001, -4.32139999999981, -5.18859999999995, -6.66879999999992, -6.48399999999992, -5.1260000000002, -4.4032000000002, -6.13500000000022, -5.80819999999994, -4.16719999999987, -4.15039999999999, -7.45600000000013, -7.24080000000004, -9.83179999999993, -5.80420000000004, -8.6561999999999, -6.99940000000015, -10.5473999999999, -7.34139999999979, -6.80999999999995, -6.29719999999998, -6.23199999999997, }, - // precision 10 - { 737.1256, 724.4234, 711.1064, 698.4732, 685.4636, 673.0644, 660.488, 647.9654, 636.0832, 623.7864, 612.1992, 600.2176, 588.5228, 577.1716, 565.7752, 554.899, 543.6126, 532.6492, 521.9474, 511.5214, 501.1064, 490.6364, 480.2468, 470.4588, 460.3832, 451.0584, 440.8606, 431.3868, 422.5062, 413.1862, 404.463, 395.339, 386.1936, 378.1292, 369.1854, 361.2908, 353.3324, 344.8518, 337.5204, 329.4854, 321.9318, 314.552, 306.4658, 299.4256, 292.849, 286.152, 278.8956, 271.8792, 265.118, 258.62, 252.5132, 245.9322, 239.7726, 233.6086, 227.5332, 222.5918, 216.4294, 210.7662, 205.4106, 199.7338, 194.9012, 188.4486, 183.1556, 178.6338, 173.7312, 169.6264, 163.9526, 159.8742, 155.8326, 151.1966, 147.5594, 143.07, 140.037, 134.1804, 131.071, 127.4884, 124.0848, 120.2944, 117.333, 112.9626, 110.2902, 107.0814, 103.0334, 99.4832000000001, 96.3899999999999, 93.7202000000002, 90.1714000000002, 87.2357999999999, 85.9346, 82.8910000000001, 80.0264000000002, 78.3834000000002, 75.1543999999999, 73.8683999999998, 70.9895999999999, 69.4367999999999, 64.8701999999998, 65.0408000000002, 61.6738, 59.5207999999998, 57.0158000000001, 54.2302, 53.0962, 50.4985999999999, 52.2588000000001, 47.3914, 45.6244000000002, 42.8377999999998, 43.0072, 40.6516000000001, 40.2453999999998, 35.2136, 36.4546, 33.7849999999999, 33.2294000000002, 32.4679999999998, 30.8670000000002, 28.6507999999999, 28.9099999999999, 27.5983999999999, 26.1619999999998, 24.5563999999999, 23.2328000000002, 21.9484000000002, 21.5902000000001, 21.3346000000001, 17.7031999999999, 20.6111999999998, 19.5545999999999, 15.7375999999999, 17.0720000000001, 16.9517999999998, 15.326, 13.1817999999998, 14.6925999999999, 13.0859999999998, 13.2754, 10.8697999999999, 11.248, 7.3768, 4.72339999999986, 7.97899999999981, 8.7503999999999, 7.68119999999999, 9.7199999999998, 7.73919999999998, 5.6224000000002, 7.44560000000001, 6.6601999999998, 5.9058, 4.00199999999995, 4.51699999999983, 4.68240000000014, 3.86220000000003, 5.13639999999987, 5.98500000000013, 2.47719999999981, 2.61999999999989, 1.62800000000016, 4.65000000000009, 0.225599999999758, 0.831000000000131, -0.359400000000278, 1.27599999999984, -2.92559999999958, -0.0303999999996449, 2.37079999999969, -2.0033999999996, 0.804600000000391, 0.30199999999968, 1.1247999999996, -2.6880000000001, 0.0321999999996478, -1.18099999999959, -3.9402, -1.47940000000017, -0.188400000000001, -2.10720000000038, -2.04159999999956, -3.12880000000041, -4.16160000000036, -0.612799999999879, -3.48719999999958, -8.17900000000009, -5.37780000000021, -4.01379999999972, -5.58259999999973, -5.73719999999958, -7.66799999999967, -5.69520000000011, -1.1247999999996, -5.58520000000044, -8.04560000000038, -4.64840000000004, -11.6468000000004, -7.97519999999986, -5.78300000000036, -7.67420000000038, -10.6328000000003, -9.81720000000041, }, - // precision 11 - { 1476, 1449.6014, 1423.5802, 1397.7942, 1372.3042, 1347.2062, 1321.8402, 1297.2292, 1272.9462, 1248.9926, 1225.3026, 1201.4252, 1178.0578, 1155.6092, 1132.626, 1110.5568, 1088.527, 1066.5154, 1045.1874, 1024.3878, 1003.37, 982.1972, 962.5728, 942.1012, 922.9668, 903.292, 884.0772, 864.8578, 846.6562, 828.041, 809.714, 792.3112, 775.1806, 757.9854, 740.656, 724.346, 707.5154, 691.8378, 675.7448, 659.6722, 645.5722, 630.1462, 614.4124, 600.8728, 585.898, 572.408, 558.4926, 544.4938, 531.6776, 517.282, 505.7704, 493.1012, 480.7388, 467.6876, 456.1872, 445.5048, 433.0214, 420.806, 411.409, 400.4144, 389.4294, 379.2286, 369.651, 360.6156, 350.337, 342.083, 332.1538, 322.5094, 315.01, 305.6686, 298.1678, 287.8116, 280.9978, 271.9204, 265.3286, 257.5706, 249.6014, 242.544, 235.5976, 229.583, 220.9438, 214.672, 208.2786, 201.8628, 195.1834, 191.505, 186.1816, 178.5188, 172.2294, 167.8908, 161.0194, 158.052, 151.4588, 148.1596, 143.4344, 138.5238, 133.13, 127.6374, 124.8162, 118.7894, 117.3984, 114.6078, 109.0858, 105.1036, 103.6258, 98.6018000000004, 95.7618000000002, 93.5821999999998, 88.5900000000001, 86.9992000000002, 82.8800000000001, 80.4539999999997, 74.6981999999998, 74.3644000000004, 73.2914000000001, 65.5709999999999, 66.9232000000002, 65.1913999999997, 62.5882000000001, 61.5702000000001, 55.7035999999998, 56.1764000000003, 52.7596000000003, 53.0302000000001, 49.0609999999997, 48.4694, 44.933, 46.0474000000004, 44.7165999999997, 41.9416000000001, 39.9207999999999, 35.6328000000003, 35.5276000000003, 33.1934000000001, 33.2371999999996, 33.3864000000003, 33.9228000000003, 30.2371999999996, 29.1373999999996, 25.2272000000003, 24.2942000000003, 19.8338000000003, 18.9005999999999, 23.0907999999999, 21.8544000000002, 19.5176000000001, 15.4147999999996, 16.9314000000004, 18.6737999999996, 12.9877999999999, 14.3688000000002, 12.0447999999997, 15.5219999999999, 12.5299999999997, 14.5940000000001, 14.3131999999996, 9.45499999999993, 12.9441999999999, 3.91139999999996, 13.1373999999996, 5.44720000000052, 9.82779999999912, 7.87279999999919, 3.67760000000089, 5.46980000000076, 5.55099999999948, 5.65979999999945, 3.89439999999922, 3.1275999999998, 5.65140000000065, 6.3062000000009, 3.90799999999945, 1.87060000000019, 5.17020000000048, 2.46680000000015, 0.770000000000437, -3.72340000000077, 1.16400000000067, 8.05340000000069, 0.135399999999208, 2.15940000000046, 0.766999999999825, 1.0594000000001, 3.15500000000065, -0.287399999999252, 2.37219999999979, -2.86620000000039, -1.63199999999961, -2.22979999999916, -0.15519999999924, -1.46039999999994, -0.262199999999211, -2.34460000000036, -2.8078000000005, -3.22179999999935, -5.60159999999996, -8.42200000000048, -9.43740000000071, 0.161799999999857, -10.4755999999998, -10.0823999999993, }, - // precision 12 - { 2953, 2900.4782, 2848.3568, 2796.3666, 2745.324, 2694.9598, 2644.648, 2595.539, 2546.1474, 2498.2576, 2450.8376, 2403.6076, 2357.451, 2311.38, 2266.4104, 2221.5638, 2176.9676, 2134.193, 2090.838, 2048.8548, 2007.018, 1966.1742, 1925.4482, 1885.1294, 1846.4776, 1807.4044, 1768.8724, 1731.3732, 1693.4304, 1657.5326, 1621.949, 1586.5532, 1551.7256, 1517.6182, 1483.5186, 1450.4528, 1417.865, 1385.7164, 1352.6828, 1322.6708, 1291.8312, 1260.9036, 1231.476, 1201.8652, 1173.6718, 1145.757, 1119.2072, 1092.2828, 1065.0434, 1038.6264, 1014.3192, 988.5746, 965.0816, 940.1176, 917.9796, 894.5576, 871.1858, 849.9144, 827.1142, 805.0818, 783.9664, 763.9096, 742.0816, 724.3962, 706.3454, 688.018, 667.4214, 650.3106, 633.0686, 613.8094, 597.818, 581.4248, 563.834, 547.363, 531.5066, 520.455400000001, 505.583199999999, 488.366, 476.480799999999, 459.7682, 450.0522, 434.328799999999, 423.952799999999, 408.727000000001, 399.079400000001, 387.252200000001, 373.987999999999, 360.852000000001, 351.6394, 339.642, 330.902400000001, 322.661599999999, 311.662200000001, 301.3254, 291.7484, 279.939200000001, 276.7508, 263.215200000001, 254.811400000001, 245.5494, 242.306399999999, 234.8734, 223.787200000001, 217.7156, 212.0196, 200.793, 195.9748, 189.0702, 182.449199999999, 177.2772, 170.2336, 164.741, 158.613600000001, 155.311, 147.5964, 142.837, 137.3724, 132.0162, 130.0424, 121.9804, 120.451800000001, 114.8968, 111.585999999999, 105.933199999999, 101.705, 98.5141999999996, 95.0488000000005, 89.7880000000005, 91.4750000000004, 83.7764000000006, 80.9698000000008, 72.8574000000008, 73.1615999999995, 67.5838000000003, 62.6263999999992, 63.2638000000006, 66.0977999999996, 52.0843999999997, 58.9956000000002, 47.0912000000008, 46.4956000000002, 48.4383999999991, 47.1082000000006, 43.2392, 37.2759999999998, 40.0283999999992, 35.1864000000005, 35.8595999999998, 32.0998, 28.027, 23.6694000000007, 33.8266000000003, 26.3736000000008, 27.2008000000005, 21.3245999999999, 26.4115999999995, 23.4521999999997, 19.5013999999992, 19.8513999999996, 10.7492000000002, 18.6424000000006, 13.1265999999996, 18.2436000000016, 6.71860000000015, 3.39459999999963, 6.33759999999893, 7.76719999999841, 0.813999999998487, 3.82819999999992, 0.826199999999517, 8.07440000000133, -1.59080000000176, 5.01780000000144, 0.455399999998917, -0.24199999999837, 0.174800000000687, -9.07640000000174, -4.20160000000033, -3.77520000000004, -4.75179999999818, -5.3724000000002, -8.90680000000066, -6.10239999999976, -5.74120000000039, -9.95339999999851, -3.86339999999836, -13.7304000000004, -16.2710000000006, -7.51359999999841, -3.30679999999847, -13.1339999999982, -10.0551999999989, -6.72019999999975, -8.59660000000076, -10.9307999999983, -1.8775999999998, -4.82259999999951, -13.7788, -21.6470000000008, -10.6735999999983, -15.7799999999988, }, - // precision 13 - { 5907.5052, 5802.2672, 5697.347, 5593.5794, 5491.2622, 5390.5514, 5290.3376, 5191.6952, 5093.5988, 4997.3552, 4902.5972, 4808.3082, 4715.5646, 4624.109, 4533.8216, 4444.4344, 4356.3802, 4269.2962, 4183.3784, 4098.292, 4014.79, 3932.4574, 3850.6036, 3771.2712, 3691.7708, 3615.099, 3538.1858, 3463.4746, 3388.8496, 3315.6794, 3244.5448, 3173.7516, 3103.3106, 3033.6094, 2966.5642, 2900.794, 2833.7256, 2769.81, 2707.3196, 2644.0778, 2583.9916, 2523.4662, 2464.124, 2406.073, 2347.0362, 2292.1006, 2238.1716, 2182.7514, 2128.4884, 2077.1314, 2025.037, 1975.3756, 1928.933, 1879.311, 1831.0006, 1783.2144, 1738.3096, 1694.5144, 1649.024, 1606.847, 1564.7528, 1525.3168, 1482.5372, 1443.9668, 1406.5074, 1365.867, 1329.2186, 1295.4186, 1257.9716, 1225.339, 1193.2972, 1156.3578, 1125.8686, 1091.187, 1061.4094, 1029.4188, 1000.9126, 972.3272, 944.004199999999, 915.7592, 889.965, 862.834200000001, 840.4254, 812.598399999999, 785.924200000001, 763.050999999999, 741.793799999999, 721.466, 699.040799999999, 677.997200000002, 649.866999999998, 634.911800000002, 609.8694, 591.981599999999, 570.2922, 557.129199999999, 538.3858, 521.872599999999, 502.951400000002, 495.776399999999, 475.171399999999, 459.751, 439.995200000001, 426.708999999999, 413.7016, 402.3868, 387.262599999998, 372.0524, 357.050999999999, 342.5098, 334.849200000001, 322.529399999999, 311.613799999999, 295.848000000002, 289.273000000001, 274.093000000001, 263.329600000001, 251.389599999999, 245.7392, 231.9614, 229.7952, 217.155200000001, 208.9588, 199.016599999999, 190.839199999999, 180.6976, 176.272799999999, 166.976999999999, 162.5252, 151.196400000001, 149.386999999999, 133.981199999998, 130.0586, 130.164000000001, 122.053400000001, 110.7428, 108.1276, 106.232400000001, 100.381600000001, 98.7668000000012, 86.6440000000002, 79.9768000000004, 82.4722000000002, 68.7026000000005, 70.1186000000016, 71.9948000000004, 58.998599999999, 59.0492000000013, 56.9818000000014, 47.5338000000011, 42.9928, 51.1591999999982, 37.2740000000013, 42.7220000000016, 31.3734000000004, 26.8090000000011, 25.8934000000008, 26.5286000000015, 29.5442000000003, 19.3503999999994, 26.0760000000009, 17.9527999999991, 14.8419999999969, 10.4683999999979, 8.65899999999965, 9.86720000000059, 4.34139999999752, -0.907800000000861, -3.32080000000133, -0.936199999996461, -11.9916000000012, -8.87000000000262, -6.33099999999831, -11.3366000000024, -15.9207999999999, -9.34659999999712, -15.5034000000014, -19.2097999999969, -15.357799999998, -28.2235999999975, -30.6898000000001, -19.3271999999997, -25.6083999999973, -24.409599999999, -13.6385999999984, -33.4473999999973, -32.6949999999997, -28.9063999999998, -31.7483999999968, -32.2935999999972, -35.8329999999987, -47.620600000002, -39.0855999999985, -33.1434000000008, -46.1371999999974, -37.5892000000022, -46.8164000000033, -47.3142000000007, -60.2914000000019, -37.7575999999972, }, - // precision 14 - { 11816.475, 11605.0046, 11395.3792, 11188.7504, 10984.1814, 10782.0086, 10582.0072, 10384.503, 10189.178, 9996.2738, 9806.0344, 9617.9798, 9431.394, 9248.7784, 9067.6894, 8889.6824, 8712.9134, 8538.8624, 8368.4944, 8197.7956, 8031.8916, 7866.6316, 7703.733, 7544.5726, 7386.204, 7230.666, 7077.8516, 6926.7886, 6778.6902, 6631.9632, 6487.304, 6346.7486, 6206.4408, 6070.202, 5935.2576, 5799.924, 5671.0324, 5541.9788, 5414.6112, 5290.0274, 5166.723, 5047.6906, 4929.162, 4815.1406, 4699.127, 4588.5606, 4477.7394, 4369.4014, 4264.2728, 4155.9224, 4055.581, 3955.505, 3856.9618, 3761.3828, 3666.9702, 3575.7764, 3482.4132, 3395.0186, 3305.8852, 3221.415, 3138.6024, 3056.296, 2970.4494, 2896.1526, 2816.8008, 2740.2156, 2670.497, 2594.1458, 2527.111, 2460.8168, 2387.5114, 2322.9498, 2260.6752, 2194.2686, 2133.7792, 2074.767, 2015.204, 1959.4226, 1898.6502, 1850.006, 1792.849, 1741.4838, 1687.9778, 1638.1322, 1589.3266, 1543.1394, 1496.8266, 1447.8516, 1402.7354, 1361.9606, 1327.0692, 1285.4106, 1241.8112, 1201.6726, 1161.973, 1130.261, 1094.2036, 1048.2036, 1020.6436, 990.901400000002, 961.199800000002, 924.769800000002, 899.526400000002, 872.346400000002, 834.375, 810.432000000001, 780.659800000001, 756.013800000001, 733.479399999997, 707.923999999999, 673.858, 652.222399999999, 636.572399999997, 615.738599999997, 586.696400000001, 564.147199999999, 541.679600000003, 523.943599999999, 505.714599999999, 475.729599999999, 461.779600000002, 449.750800000002, 439.020799999998, 412.7886, 400.245600000002, 383.188199999997, 362.079599999997, 357.533799999997, 334.319000000003, 327.553399999997, 308.559399999998, 291.270199999999, 279.351999999999, 271.791400000002, 252.576999999997, 247.482400000001, 236.174800000001, 218.774599999997, 220.155200000001, 208.794399999999, 201.223599999998, 182.995600000002, 185.5268, 164.547400000003, 176.5962, 150.689599999998, 157.8004, 138.378799999999, 134.021200000003, 117.614399999999, 108.194000000003, 97.0696000000025, 89.6042000000016, 95.6030000000028, 84.7810000000027, 72.635000000002, 77.3482000000004, 59.4907999999996, 55.5875999999989, 50.7346000000034, 61.3916000000027, 50.9149999999936, 39.0384000000049, 58.9395999999979, 29.633600000001, 28.2032000000036, 26.0078000000067, 17.0387999999948, 9.22000000000116, 13.8387999999977, 8.07240000000456, 14.1549999999988, 15.3570000000036, 3.42660000000615, 6.24820000000182, -2.96940000000177, -8.79940000000352, -5.97860000000219, -14.4048000000039, -3.4143999999942, -13.0148000000045, -11.6977999999945, -25.7878000000055, -22.3185999999987, -24.409599999999, -31.9756000000052, -18.9722000000038, -22.8678000000073, -30.8972000000067, -32.3715999999986, -22.3907999999938, -43.6720000000059, -35.9038, -39.7492000000057, -54.1641999999993, -45.2749999999942, -42.2989999999991, -44.1089999999967, -64.3564000000042, -49.9551999999967, -42.6116000000038, }, - // precision 15 - { 23634.0036, 23210.8034, 22792.4744, 22379.1524, 21969.7928, 21565.326, 21165.3532, 20770.2806, 20379.9892, 19994.7098, 19613.318, 19236.799, 18865.4382, 18498.8244, 18136.5138, 17778.8668, 17426.2344, 17079.32, 16734.778, 16397.2418, 16063.3324, 15734.0232, 15409.731, 15088.728, 14772.9896, 14464.1402, 14157.5588, 13855.5958, 13559.3296, 13264.9096, 12978.326, 12692.0826, 12413.8816, 12137.3192, 11870.2326, 11602.5554, 11340.3142, 11079.613, 10829.5908, 10583.5466, 10334.0344, 10095.5072, 9859.694, 9625.2822, 9395.7862, 9174.0586, 8957.3164, 8738.064, 8524.155, 8313.7396, 8116.9168, 7913.542, 7718.4778, 7521.65, 7335.5596, 7154.2906, 6968.7396, 6786.3996, 6613.236, 6437.406, 6270.6598, 6107.7958, 5945.7174, 5787.6784, 5635.5784, 5482.308, 5337.9784, 5190.0864, 5045.9158, 4919.1386, 4771.817, 4645.7742, 4518.4774, 4385.5454, 4262.6622, 4142.74679999999, 4015.5318, 3897.9276, 3790.7764, 3685.13800000001, 3573.6274, 3467.9706, 3368.61079999999, 3271.5202, 3170.3848, 3076.4656, 2982.38400000001, 2888.4664, 2806.4868, 2711.9564, 2634.1434, 2551.3204, 2469.7662, 2396.61139999999, 2318.9902, 2243.8658, 2171.9246, 2105.01360000001, 2028.8536, 1960.9952, 1901.4096, 1841.86079999999, 1777.54700000001, 1714.5802, 1654.65059999999, 1596.311, 1546.2016, 1492.3296, 1433.8974, 1383.84600000001, 1339.4152, 1293.5518, 1245.8686, 1193.50659999999, 1162.27959999999, 1107.19439999999, 1069.18060000001, 1035.09179999999, 999.679000000004, 957.679999999993, 925.300199999998, 888.099400000006, 848.638600000006, 818.156400000007, 796.748399999997, 752.139200000005, 725.271200000003, 692.216, 671.633600000001, 647.939799999993, 621.670599999998, 575.398799999995, 561.226599999995, 532.237999999998, 521.787599999996, 483.095799999996, 467.049599999998, 465.286399999997, 415.548599999995, 401.047399999996, 380.607999999993, 377.362599999993, 347.258799999996, 338.371599999999, 310.096999999994, 301.409199999995, 276.280799999993, 265.586800000005, 258.994399999996, 223.915999999997, 215.925399999993, 213.503800000006, 191.045400000003, 166.718200000003, 166.259000000005, 162.941200000001, 148.829400000002, 141.645999999993, 123.535399999993, 122.329800000007, 89.473399999988, 80.1962000000058, 77.5457999999926, 59.1056000000099, 83.3509999999951, 52.2906000000075, 36.3979999999865, 40.6558000000077, 42.0003999999899, 19.6630000000005, 19.7153999999864, -8.38539999999921, -0.692799999989802, 0.854800000000978, 3.23219999999856, -3.89040000000386, -5.25880000001052, -24.9052000000083, -22.6837999999989, -26.4286000000138, -34.997000000003, -37.0216000000073, -43.430400000012, -58.2390000000014, -68.8034000000043, -56.9245999999985, -57.8583999999973, -77.3097999999882, -73.2793999999994, -81.0738000000129, -87.4530000000086, -65.0254000000132, -57.296399999992, -96.2746000000043, -103.25, -96.081600000005, -91.5542000000132, -102.465200000006, -107.688599999994, -101.458000000013, -109.715800000005, }, - // precision 16 - { 47270, 46423.3584, 45585.7074, 44757.152, 43938.8416, 43130.9514, 42330.03, 41540.407, 40759.6348, 39988.206, 39226.5144, 38473.2096, 37729.795, 36997.268, 36272.6448, 35558.665, 34853.0248, 34157.4472, 33470.5204, 32793.5742, 32127.0194, 31469.4182, 30817.6136, 30178.6968, 29546.8908, 28922.8544, 28312.271, 27707.0924, 27114.0326, 26526.692, 25948.6336, 25383.7826, 24823.5998, 24272.2974, 23732.2572, 23201.4976, 22674.2796, 22163.6336, 21656.515, 21161.7362, 20669.9368, 20189.4424, 19717.3358, 19256.3744, 18795.9638, 18352.197, 17908.5738, 17474.391, 17052.918, 16637.2236, 16228.4602, 15823.3474, 15428.6974, 15043.0284, 14667.6278, 14297.4588, 13935.2882, 13578.5402, 13234.6032, 12882.1578, 12548.0728, 12219.231, 11898.0072, 11587.2626, 11279.9072, 10973.5048, 10678.5186, 10392.4876, 10105.2556, 9825.766, 9562.5444, 9294.2222, 9038.2352, 8784.848, 8533.2644, 8301.7776, 8058.30859999999, 7822.94579999999, 7599.11319999999, 7366.90779999999, 7161.217, 6957.53080000001, 6736.212, 6548.21220000001, 6343.06839999999, 6156.28719999999, 5975.15419999999, 5791.75719999999, 5621.32019999999, 5451.66, 5287.61040000001, 5118.09479999999, 4957.288, 4798.4246, 4662.17559999999, 4512.05900000001, 4364.68539999999, 4220.77720000001, 4082.67259999999, 3957.19519999999, 3842.15779999999, 3699.3328, 3583.01180000001, 3473.8964, 3338.66639999999, 3233.55559999999, 3117.799, 3008.111, 2909.69140000001, 2814.86499999999, 2719.46119999999, 2624.742, 2532.46979999999, 2444.7886, 2370.1868, 2272.45259999999, 2196.19260000001, 2117.90419999999, 2023.2972, 1969.76819999999, 1885.58979999999, 1833.2824, 1733.91200000001, 1682.54920000001, 1604.57980000001, 1556.11240000001, 1491.3064, 1421.71960000001, 1371.22899999999, 1322.1324, 1264.7892, 1196.23920000001, 1143.8474, 1088.67240000001, 1073.60380000001, 1023.11660000001, 959.036400000012, 927.433199999999, 906.792799999996, 853.433599999989, 841.873800000001, 791.1054, 756.899999999994, 704.343200000003, 672.495599999995, 622.790399999998, 611.254799999995, 567.283200000005, 519.406599999988, 519.188400000014, 495.312800000014, 451.350799999986, 443.973399999988, 431.882199999993, 392.027000000002, 380.924200000009, 345.128999999986, 298.901400000002, 287.771999999997, 272.625, 247.253000000026, 222.490600000019, 223.590000000026, 196.407599999977, 176.425999999978, 134.725199999986, 132.4804, 110.445599999977, 86.7939999999944, 56.7038000000175, 64.915399999998, 38.3726000000024, 37.1606000000029, 46.170999999973, 49.1716000000015, 15.3362000000197, 6.71639999997569, -34.8185999999987, -39.4476000000141, 12.6830000000191, -12.3331999999937, -50.6565999999875, -59.9538000000175, -65.1054000000004, -70.7576000000117, -106.325200000021, -126.852200000023, -110.227599999984, -132.885999999999, -113.897200000007, -142.713800000027, -151.145399999979, -150.799200000009, -177.756200000003, -156.036399999983, -182.735199999996, -177.259399999981, -198.663600000029, -174.577600000019, -193.84580000001, }, - // precision 17 - { 94541, 92848.811, 91174.019, 89517.558, 87879.9705, 86262.7565, 84663.5125, 83083.7435, 81521.7865, 79977.272, 78455.9465, 76950.219, 75465.432, 73994.152, 72546.71, 71115.2345, 69705.6765, 68314.937, 66944.2705, 65591.255, 64252.9485, 62938.016, 61636.8225, 60355.592, 59092.789, 57850.568, 56624.518, 55417.343, 54231.1415, 53067.387, 51903.526, 50774.649, 49657.6415, 48561.05, 47475.7575, 46410.159, 45364.852, 44327.053, 43318.4005, 42325.6165, 41348.4595, 40383.6265, 39436.77, 38509.502, 37594.035, 36695.939, 35818.6895, 34955.691, 34115.8095, 33293.949, 32465.0775, 31657.6715, 30877.2585, 30093.78, 29351.3695, 28594.1365, 27872.115, 27168.7465, 26477.076, 25774.541, 25106.5375, 24452.5135, 23815.5125, 23174.0655, 22555.2685, 21960.2065, 21376.3555, 20785.1925, 20211.517, 19657.0725, 19141.6865, 18579.737, 18081.3955, 17578.995, 17073.44, 16608.335, 16119.911, 15651.266, 15194.583, 14749.0495, 14343.4835, 13925.639, 13504.509, 13099.3885, 12691.2855, 12328.018, 11969.0345, 11596.5145, 11245.6355, 10917.6575, 10580.9785, 10277.8605, 9926.58100000001, 9605.538, 9300.42950000003, 8989.97850000003, 8728.73249999998, 8448.3235, 8175.31050000002, 7898.98700000002, 7629.79100000003, 7413.76199999999, 7149.92300000001, 6921.12650000001, 6677.1545, 6443.28000000003, 6278.23450000002, 6014.20049999998, 5791.20299999998, 5605.78450000001, 5438.48800000001, 5234.2255, 5059.6825, 4887.43349999998, 4682.935, 4496.31099999999, 4322.52250000002, 4191.42499999999, 4021.24200000003, 3900.64799999999, 3762.84250000003, 3609.98050000001, 3502.29599999997, 3363.84250000003, 3206.54849999998, 3079.70000000001, 2971.42300000001, 2867.80349999998, 2727.08100000001, 2630.74900000001, 2496.6165, 2440.902, 2356.19150000002, 2235.58199999999, 2120.54149999999, 2012.25449999998, 1933.35600000003, 1820.93099999998, 1761.54800000001, 1663.09350000002, 1578.84600000002, 1509.48149999999, 1427.3345, 1379.56150000001, 1306.68099999998, 1212.63449999999, 1084.17300000001, 1124.16450000001, 1060.69949999999, 1007.48849999998, 941.194499999983, 879.880500000028, 836.007500000007, 782.802000000025, 748.385499999975, 647.991500000004, 626.730500000005, 570.776000000013, 484.000500000024, 513.98550000001, 418.985499999952, 386.996999999974, 370.026500000036, 355.496999999974, 356.731499999994, 255.92200000002, 259.094000000041, 205.434499999974, 165.374500000034, 197.347500000033, 95.718499999959, 67.6165000000037, 54.6970000000438, 31.7395000000251, -15.8784999999916, 8.42500000004657, -26.3754999999655, -118.425500000012, -66.6629999999423, -42.9745000000112, -107.364999999991, -189.839000000036, -162.611499999999, -164.964999999967, -189.079999999958, -223.931499999948, -235.329999999958, -269.639500000048, -249.087999999989, -206.475499999942, -283.04449999996, -290.667000000016, -304.561499999953, -336.784499999951, -380.386500000022, -283.280499999993, -364.533000000054, -389.059499999974, -364.454000000027, -415.748000000021, -417.155000000028, }, - // precision 18 - { 189083, 185696.913, 182348.774, 179035.946, 175762.762, 172526.444, 169329.754, 166166.099, 163043.269, 159958.91, 156907.912, 153906.845, 150924.199, 147996.568, 145093.457, 142239.233, 139421.475, 136632.27, 133889.588, 131174.2, 128511.619, 125868.621, 123265.385, 120721.061, 118181.769, 115709.456, 113252.446, 110840.198, 108465.099, 106126.164, 103823.469, 101556.618, 99308.004, 97124.508, 94937.803, 92833.731, 90745.061, 88677.627, 86617.47, 84650.442, 82697.833, 80769.132, 78879.629, 77014.432, 75215.626, 73384.587, 71652.482, 69895.93, 68209.301, 66553.669, 64921.981, 63310.323, 61742.115, 60205.018, 58698.658, 57190.657, 55760.865, 54331.169, 52908.167, 51550.273, 50225.254, 48922.421, 47614.533, 46362.049, 45098.569, 43926.083, 42736.03, 41593.473, 40425.26, 39316.237, 38243.651, 37170.617, 36114.609, 35084.19, 34117.233, 33206.509, 32231.505, 31318.728, 30403.404, 29540.0550000001, 28679.236, 27825.862, 26965.216, 26179.148, 25462.08, 24645.952, 23922.523, 23198.144, 22529.128, 21762.4179999999, 21134.779, 20459.117, 19840.818, 19187.04, 18636.3689999999, 17982.831, 17439.7389999999, 16874.547, 16358.2169999999, 15835.684, 15352.914, 14823.681, 14329.313, 13816.897, 13342.874, 12880.882, 12491.648, 12021.254, 11625.392, 11293.7610000001, 10813.697, 10456.209, 10099.074, 9755.39000000001, 9393.18500000006, 9047.57900000003, 8657.98499999999, 8395.85900000005, 8033, 7736.95900000003, 7430.59699999995, 7258.47699999996, 6924.58200000005, 6691.29399999999, 6357.92500000005, 6202.05700000003, 5921.19700000004, 5628.28399999999, 5404.96799999999, 5226.71100000001, 4990.75600000005, 4799.77399999998, 4622.93099999998, 4472.478, 4171.78700000001, 3957.46299999999, 3868.95200000005, 3691.14300000004, 3474.63100000005, 3341.67200000002, 3109.14000000001, 3071.97400000005, 2796.40399999998, 2756.17799999996, 2611.46999999997, 2471.93000000005, 2382.26399999997, 2209.22400000005, 2142.28399999999, 2013.96100000001, 1911.18999999994, 1818.27099999995, 1668.47900000005, 1519.65800000005, 1469.67599999998, 1367.13800000004, 1248.52899999998, 1181.23600000003, 1022.71900000004, 1088.20700000005, 959.03600000008, 876.095999999903, 791.183999999892, 703.337000000058, 731.949999999953, 586.86400000006, 526.024999999907, 323.004999999888, 320.448000000091, 340.672999999952, 309.638999999966, 216.601999999955, 102.922999999952, 19.2399999999907, -0.114000000059605, -32.6240000000689, -89.3179999999702, -153.497999999905, -64.2970000000205, -143.695999999996, -259.497999999905, -253.017999999924, -213.948000000091, -397.590000000084, -434.006000000052, -403.475000000093, -297.958000000101, -404.317000000039, -528.898999999976, -506.621000000043, -513.205000000075, -479.351000000024, -596.139999999898, -527.016999999993, -664.681000000099, -680.306000000099, -704.050000000047, -850.486000000034, -757.43200000003, -713.308999999892, } - }; + // precision 4 + { 10, 9.717, 9.207, 8.7896, 8.2882, 7.8204, 7.3772, 6.9342, 6.5202, 6.161, 5.7722, 5.4636, 5.0396, 4.6766, 4.3566, 4.0454, + 3.7936, 3.4856, 3.2666, 2.9946, 2.766, 2.4692, 2.3638, 2.0764, 1.7864, 1.7602, 1.4814, 1.433, 1.2926, 1.0664, + 0.999600000000001, 0.7956, 0.5366, 0.589399999999998, 0.573799999999999, 0.269799999999996, 0.368200000000002, + 0.0544000000000011, 0.234200000000001, 0.0108000000000033, -0.203400000000002, -0.0701999999999998, -0.129600000000003, + -0.364199999999997, -0.480600000000003, -0.226999999999997, -0.322800000000001, -0.382599999999996, -0.511200000000002, + -0.669600000000003, -0.749400000000001, -0.500399999999999, -0.617600000000003, -0.6922, -0.601599999999998, + -0.416200000000003, -0.338200000000001, -0.782600000000002, -0.648600000000002, -0.919800000000002, -0.851799999999997, + -0.962400000000002, -0.6402, -1.1922, -1.0256, -1.086, -1.21899999999999, -0.819400000000002, -0.940600000000003, + -1.1554, -1.2072, -1.1752, -1.16759999999999, -1.14019999999999, -1.3754, -1.29859999999999, -1.607, -1.3292, + -1.7606, }, + // precision 5 + { 22, 21.1194, 20.8208, 20.2318, 19.77, 19.2436, 18.7774, 18.2848, 17.8224, 17.3742, 16.9336, 16.503, 16.0494, 15.6292, 15.2124, + 14.798, 14.367, 13.9728, 13.5944, 13.217, 12.8438, 12.3696, 12.0956, 11.7044, 11.324, 11.0668, 10.6698, 10.3644, 10.049, + 9.6918, 9.4146, 9.082, 8.687, 8.5398, 8.2462, 7.857, 7.6606, 7.4168, 7.1248, 6.9222, 6.6804, 6.447, 6.3454, 5.9594, + 5.7636, 5.5776, 5.331, 5.19, 4.9676, 4.7564, 4.5314, 4.4442, 4.3708, 3.9774, 3.9624, 3.8796, 3.755, 3.472, 3.2076, + 3.1024, 2.8908, 2.7338, 2.7728, 2.629, 2.413, 2.3266, 2.1524, 2.2642, 2.1806, 2.0566, 1.9192, 1.7598, 1.3516, 1.5802, + 1.43859999999999, 1.49160000000001, 1.1524, 1.1892, 0.841399999999993, 0.879800000000003, 0.837599999999995, + 0.469800000000006, 0.765600000000006, 0.331000000000003, 0.591399999999993, 0.601200000000006, 0.701599999999999, + 0.558199999999999, 0.339399999999998, 0.354399999999998, 0.491200000000006, 0.308000000000007, 0.355199999999996, + -0.0254000000000048, 0.205200000000005, -0.272999999999996, 0.132199999999997, 0.394400000000005, -0.241200000000006, + 0.242000000000004, 0.191400000000002, 0.253799999999998, -0.122399999999999, -0.370800000000003, 0.193200000000004, + -0.0848000000000013, 0.0867999999999967, -0.327200000000005, -0.285600000000002, 0.311400000000006, -0.128399999999999, + -0.754999999999995, -0.209199999999996, -0.293599999999998, -0.364000000000004, -0.253600000000006, -0.821200000000005, + -0.253600000000006, -0.510400000000004, -0.383399999999995, -0.491799999999998, -0.220200000000006, -0.0972000000000008, + -0.557400000000001, -0.114599999999996, -0.295000000000002, -0.534800000000004, 0.346399999999988, -0.65379999999999, + 0.0398000000000138, 0.0341999999999985, -0.995800000000003, -0.523400000000009, -0.489000000000004, -0.274799999999999, + -0.574999999999989, -0.482799999999997, 0.0571999999999946, -0.330600000000004, -0.628800000000012, -0.140199999999993, + -0.540600000000012, -0.445999999999998, -0.599400000000003, -0.262599999999992, 0.163399999999996, -0.100599999999986, + -0.39500000000001, -1.06960000000001, -0.836399999999998, -0.753199999999993, -0.412399999999991, -0.790400000000005, + -0.29679999999999, -0.28540000000001, -0.193000000000012, -0.0772000000000048, -0.962799999999987, + -0.414800000000014, }, + // precision 6 + { 45, 44.1902, 43.271, 42.8358, 41.8142, 41.2854, 40.317, 39.354, 38.8924, 37.9436, 37.4596, 36.5262, 35.6248, 35.1574, 34.2822, + 33.837, 32.9636, 32.074, 31.7042, 30.7976, 30.4772, 29.6564, 28.7942, 28.5004, 27.686, 27.291, 26.5672, 25.8556, + 25.4982, 24.8204, 24.4252, 23.7744, 23.0786, 22.8344, 22.0294, 21.8098, 21.0794, 20.5732, 20.1878, 19.5648, 19.2902, + 18.6784, 18.3352, 17.8946, 17.3712, 17.0852, 16.499, 16.2686, 15.6844, 15.2234, 14.9732, 14.3356, 14.2286, 13.7262, + 13.3284, 13.1048, 12.5962, 12.3562, 12.1272, 11.4184, 11.4974, 11.0822, 10.856, 10.48, 10.2834, 10.0208, 9.637, + 9.51739999999999, 9.05759999999999, 8.74760000000001, 8.42700000000001, 8.1326, 8.2372, 8.2788, 7.6776, + 7.79259999999999, 7.1952, 6.9564, 6.6454, 6.87, 6.5428, 6.19999999999999, 6.02940000000001, 5.62780000000001, 5.6782, + 5.792, 5.35159999999999, 5.28319999999999, 5.0394, 5.07480000000001, 4.49119999999999, 4.84899999999999, 4.696, + 4.54040000000001, 4.07300000000001, 4.37139999999999, 3.7216, 3.7328, 3.42080000000001, 3.41839999999999, + 3.94239999999999, 3.27719999999999, 3.411, 3.13079999999999, 2.76900000000001, 2.92580000000001, 2.68279999999999, + 2.75020000000001, 2.70599999999999, 2.3886, 3.01859999999999, 2.45179999999999, 2.92699999999999, 2.41720000000001, + 2.41139999999999, 2.03299999999999, 2.51240000000001, 2.5564, 2.60079999999999, 2.41720000000001, 1.80439999999999, + 1.99700000000001, 2.45480000000001, 1.8948, 2.2346, 2.30860000000001, 2.15479999999999, 1.88419999999999, 1.6508, + 0.677199999999999, 1.72540000000001, 1.4752, 1.72280000000001, 1.66139999999999, 1.16759999999999, 1.79300000000001, + 1.00059999999999, 0.905200000000008, 0.659999999999997, 1.55879999999999, 1.1636, 0.688199999999995, 0.712600000000009, + 0.450199999999995, 1.1978, 0.975599999999986, 0.165400000000005, 1.727, 1.19739999999999, -0.252600000000001, + 1.13460000000001, 1.3048, 1.19479999999999, 0.313400000000001, 0.878999999999991, 1.12039999999999, 0.853000000000009, + 1.67920000000001, 0.856999999999999, 0.448599999999999, 1.2362, 0.953399999999988, 1.02859999999998, 0.563199999999995, + 0.663000000000011, 0.723000000000013, 0.756599999999992, 0.256599999999992, -0.837600000000009, 0.620000000000005, + 0.821599999999989, 0.216600000000028, 0.205600000000004, 0.220199999999977, 0.372599999999977, 0.334400000000016, + 0.928400000000011, 0.972800000000007, 0.192400000000021, 0.487199999999973, -0.413000000000011, 0.807000000000016, + 0.120600000000024, 0.769000000000005, 0.870799999999974, 0.66500000000002, 0.118200000000002, 0.401200000000017, + 0.635199999999998, 0.135400000000004, 0.175599999999974, 1.16059999999999, 0.34620000000001, 0.521400000000028, + -0.586599999999976, -1.16480000000001, 0.968399999999974, 0.836999999999989, 0.779600000000016, 0.985799999999983, }, + // precision 7 + { 91, 89.4934, 87.9758, 86.4574, 84.9718, 83.4954, 81.5302, 80.0756, 78.6374, 77.1782, 75.7888, 73.9522, 72.592, 71.2532, + 69.9086, 68.5938, 66.9474, 65.6796, 64.4394, 63.2176, 61.9768, 60.4214, 59.2528, 58.0102, 56.8658, 55.7278, 54.3044, + 53.1316, 52.093, 51.0032, 49.9092, 48.6306, 47.5294, 46.5756, 45.6508, 44.662, 43.552, 42.3724, 41.617, 40.5754, + 39.7872, 38.8444, 37.7988, 36.8606, 36.2118, 35.3566, 34.4476, 33.5882, 32.6816, 32.0824, 31.0258, 30.6048, 29.4436, + 28.7274, 27.957, 27.147, 26.4364, 25.7592, 25.3386, 24.781, 23.8028, 23.656, 22.6544, 21.996, 21.4718, 21.1544, 20.6098, + 19.5956, 19.0616, 18.5758, 18.4878, 17.5244, 17.2146, 16.724, 15.8722, 15.5198, 15.0414, 14.941, 14.9048, 13.87, + 13.4304, 13.028, 12.4708, 12.37, 12.0624, 11.4668, 11.5532, 11.4352, 11.2564, 10.2744, 10.2118, 9.74720000000002, + 10.1456, 9.2928, 8.75040000000001, 8.55279999999999, 8.97899999999998, 8.21019999999999, 8.18340000000001, 7.3494, + 7.32499999999999, 7.66140000000001, 6.90300000000002, 7.25439999999998, 6.9042, 7.21499999999997, 6.28640000000001, + 6.08139999999997, 6.6764, 6.30099999999999, 5.13900000000001, 5.65800000000002, 5.17320000000001, 4.59019999999998, + 4.9538, 5.08280000000002, 4.92200000000003, 4.99020000000002, 4.7328, 5.4538, 4.11360000000002, 4.22340000000003, + 4.08780000000002, 3.70800000000003, 4.15559999999999, 4.18520000000001, 3.63720000000001, 3.68220000000002, + 3.77960000000002, 3.6078, 2.49160000000001, 3.13099999999997, 2.5376, 3.19880000000001, 3.21100000000001, 2.4502, + 3.52820000000003, 2.91199999999998, 3.04480000000001, 2.7432, 2.85239999999999, 2.79880000000003, 2.78579999999999, + 1.88679999999999, 2.98860000000002, 2.50639999999999, 1.91239999999999, 2.66160000000002, 2.46820000000002, + 1.58199999999999, 1.30399999999997, 2.27379999999999, 2.68939999999998, 1.32900000000001, 3.10599999999999, + 1.69080000000002, 2.13740000000001, 2.53219999999999, 1.88479999999998, 1.33240000000001, 1.45119999999997, + 1.17899999999997, 2.44119999999998, 1.60659999999996, 2.16700000000003, 0.77940000000001, 2.37900000000002, + 2.06700000000001, 1.46000000000004, 2.91160000000002, 1.69200000000001, 0.954600000000028, 2.49300000000005, 2.2722, + 1.33500000000004, 2.44899999999996, 1.20140000000004, 3.07380000000001, 2.09739999999999, 2.85640000000001, + 2.29960000000005, 2.40899999999999, 1.97040000000004, 0.809799999999996, 1.65279999999996, 2.59979999999996, + 0.95799999999997, 2.06799999999998, 2.32780000000002, 4.20159999999998, 1.96320000000003, 1.86400000000003, + 1.42999999999995, 3.77940000000001, 1.27200000000005, 1.86440000000005, 2.20600000000002, 3.21900000000005, 1.5154, + 2.61019999999996, }, + // precision 8 + { 183.2152, 180.2454, 177.2096, 173.6652, 170.6312, 167.6822, 164.249, 161.3296, 158.0038, 155.2074, 152.4612, 149.27, 146.5178, + 143.4412, 140.8032, 138.1634, 135.1688, 132.6074, 129.6946, 127.2664, 124.8228, 122.0432, 119.6824, 116.9464, 114.6268, + 112.2626, 109.8376, 107.4034, 104.8956, 102.8522, 100.7638, 98.3552, 96.3556, 93.7526, 91.9292, 89.8954, 87.8198, + 85.7668, 83.298, 81.6688, 79.9466, 77.9746, 76.1672, 74.3474, 72.3028, 70.8912, 69.114, 67.4646, 65.9744, 64.4092, + 62.6022, 60.843, 59.5684, 58.1652, 56.5426, 55.4152, 53.5388, 52.3592, 51.1366, 49.486, 48.3918, 46.5076, 45.509, + 44.3834, 43.3498, 42.0668, 40.7346, 40.1228, 38.4528, 37.7, 36.644, 36.0518, 34.5774, 33.9068, 32.432, 32.1666, 30.434, + 29.6644, 28.4894, 27.6312, 26.3804, 26.292, 25.5496000000001, 25.0234, 24.8206, 22.6146, 22.4188, 22.117, 20.6762, + 20.6576, 19.7864, 19.509, 18.5334, 17.9204, 17.772, 16.2924, 16.8654, 15.1836, 15.745, 15.1316, 15.0386, 14.0136, + 13.6342, 12.6196, 12.1866, 12.4281999999999, 11.3324, 10.4794000000001, 11.5038, 10.129, 9.52800000000002, + 10.3203999999999, 9.46299999999997, 9.79280000000006, 9.12300000000005, 8.74180000000001, 9.2192, 7.51020000000005, + 7.60659999999996, 7.01840000000004, 7.22239999999999, 7.40139999999997, 6.76179999999999, 7.14359999999999, + 5.65060000000005, 5.63779999999997, 5.76599999999996, 6.75139999999999, 5.57759999999996, 3.73220000000003, 5.8048, + 5.63019999999995, 4.93359999999996, 3.47979999999995, 4.33879999999999, 3.98940000000005, 3.81960000000004, + 3.31359999999995, 3.23080000000004, 3.4588, 3.08159999999998, 3.4076, 3.00639999999999, 2.38779999999997, + 2.61900000000003, 1.99800000000005, 3.34820000000002, 2.95060000000001, 0.990999999999985, 2.11440000000005, + 2.20299999999997, 2.82219999999995, 2.73239999999998, 2.7826, 3.76660000000004, 2.26480000000004, 2.31280000000004, + 2.40819999999997, 2.75360000000001, 3.33759999999995, 2.71559999999999, 1.7478000000001, 1.42920000000004, + 2.39300000000003, 2.22779999999989, 2.34339999999997, 0.87259999999992, 3.88400000000001, 1.80600000000004, + 1.91759999999999, 1.16779999999994, 1.50320000000011, 2.52500000000009, 0.226400000000012, 2.31500000000005, + 0.930000000000064, 1.25199999999995, 2.14959999999996, 0.0407999999999902, 2.5447999999999, 1.32960000000003, + 0.197400000000016, 2.52620000000002, 3.33279999999991, -1.34300000000007, 0.422199999999975, 0.917200000000093, + 1.12920000000008, 1.46060000000011, 1.45779999999991, 2.8728000000001, 3.33359999999993, -1.34079999999994, + 1.57680000000005, 0.363000000000056, 1.40740000000005, 0.656600000000026, 0.801400000000058, -0.454600000000028, + 1.51919999999996, }, + // precision 9 + { 368, 361.8294, 355.2452, 348.6698, 342.1464, 336.2024, 329.8782, 323.6598, 317.462, 311.2826, 305.7102, 299.7416, 293.9366, + 288.1046, 282.285, 277.0668, 271.306, 265.8448, 260.301, 254.9886, 250.2422, 244.8138, 239.7074, 234.7428, 229.8402, + 225.1664, 220.3534, 215.594, 210.6886, 205.7876, 201.65, 197.228, 192.8036, 188.1666, 184.0818, 180.0824, 176.2574, + 172.302, 168.1644, 164.0056, 160.3802, 156.7192, 152.5234, 149.2084, 145.831, 142.485, 139.1112, 135.4764, 131.76, + 129.3368, 126.5538, 122.5058, 119.2646, 116.5902, 113.3818, 110.8998, 107.9532, 105.2062, 102.2798, 99.4728, 96.9582, + 94.3292, 92.171, 89.7809999999999, 87.5716, 84.7048, 82.5322, 79.875, 78.3972, 75.3464, 73.7274, 71.2834, 70.1444, + 68.4263999999999, 66.0166, 64.018, 62.0437999999999, 60.3399999999999, 58.6856, 57.9836, 55.0311999999999, + 54.6769999999999, 52.3188, 51.4846, 49.4423999999999, 47.739, 46.1487999999999, 44.9202, 43.4059999999999, + 42.5342000000001, 41.2834, 38.8954000000001, 38.3286000000001, 36.2146, 36.6684, 35.9946, 33.123, 33.4338, + 31.7378000000001, 29.076, 28.9692, 27.4964, 27.0998, 25.9864, 26.7754, 24.3208, 23.4838, 22.7388000000001, + 24.0758000000001, 21.9097999999999, 20.9728, 19.9228000000001, 19.9292, 16.617, 17.05, 18.2996000000001, + 15.6128000000001, 15.7392, 14.5174, 13.6322, 12.2583999999999, 13.3766000000001, 11.423, 13.1232, 9.51639999999998, + 10.5938000000001, 9.59719999999993, 8.12220000000002, 9.76739999999995, 7.50440000000003, 7.56999999999994, + 6.70440000000008, 6.41419999999994, 6.71019999999999, 5.60940000000005, 4.65219999999999, 6.84099999999989, + 3.4072000000001, 3.97859999999991, 3.32760000000007, 5.52160000000003, 3.31860000000006, 2.06940000000009, + 4.35400000000004, 1.57500000000005, 0.280799999999999, 2.12879999999996, -0.214799999999968, -0.0378000000000611, + -0.658200000000079, 0.654800000000023, -0.0697999999999865, 0.858400000000074, -2.52700000000004, -2.1751999999999, + -3.35539999999992, -1.04019999999991, -0.651000000000067, -2.14439999999991, -1.96659999999997, -3.97939999999994, + -0.604400000000169, -3.08260000000018, -3.39159999999993, -5.29640000000018, -5.38920000000007, -5.08759999999984, + -4.69900000000007, -5.23720000000003, -3.15779999999995, -4.97879999999986, -4.89899999999989, -7.48880000000008, + -5.94799999999987, -5.68060000000014, -6.67180000000008, -4.70499999999993, -7.27779999999984, -4.6579999999999, + -4.4362000000001, -4.32139999999981, -5.18859999999995, -6.66879999999992, -6.48399999999992, -5.1260000000002, + -4.4032000000002, -6.13500000000022, -5.80819999999994, -4.16719999999987, -4.15039999999999, -7.45600000000013, + -7.24080000000004, -9.83179999999993, -5.80420000000004, -8.6561999999999, -6.99940000000015, -10.5473999999999, + -7.34139999999979, -6.80999999999995, -6.29719999999998, -6.23199999999997, }, + // precision 10 + { 737.1256, 724.4234, 711.1064, 698.4732, 685.4636, 673.0644, 660.488, 647.9654, 636.0832, 623.7864, 612.1992, 600.2176, + 588.5228, 577.1716, 565.7752, 554.899, 543.6126, 532.6492, 521.9474, 511.5214, 501.1064, 490.6364, 480.2468, 470.4588, + 460.3832, 451.0584, 440.8606, 431.3868, 422.5062, 413.1862, 404.463, 395.339, 386.1936, 378.1292, 369.1854, 361.2908, + 353.3324, 344.8518, 337.5204, 329.4854, 321.9318, 314.552, 306.4658, 299.4256, 292.849, 286.152, 278.8956, 271.8792, + 265.118, 258.62, 252.5132, 245.9322, 239.7726, 233.6086, 227.5332, 222.5918, 216.4294, 210.7662, 205.4106, 199.7338, + 194.9012, 188.4486, 183.1556, 178.6338, 173.7312, 169.6264, 163.9526, 159.8742, 155.8326, 151.1966, 147.5594, 143.07, + 140.037, 134.1804, 131.071, 127.4884, 124.0848, 120.2944, 117.333, 112.9626, 110.2902, 107.0814, 103.0334, + 99.4832000000001, 96.3899999999999, 93.7202000000002, 90.1714000000002, 87.2357999999999, 85.9346, 82.8910000000001, + 80.0264000000002, 78.3834000000002, 75.1543999999999, 73.8683999999998, 70.9895999999999, 69.4367999999999, + 64.8701999999998, 65.0408000000002, 61.6738, 59.5207999999998, 57.0158000000001, 54.2302, 53.0962, 50.4985999999999, + 52.2588000000001, 47.3914, 45.6244000000002, 42.8377999999998, 43.0072, 40.6516000000001, 40.2453999999998, 35.2136, + 36.4546, 33.7849999999999, 33.2294000000002, 32.4679999999998, 30.8670000000002, 28.6507999999999, 28.9099999999999, + 27.5983999999999, 26.1619999999998, 24.5563999999999, 23.2328000000002, 21.9484000000002, 21.5902000000001, + 21.3346000000001, 17.7031999999999, 20.6111999999998, 19.5545999999999, 15.7375999999999, 17.0720000000001, + 16.9517999999998, 15.326, 13.1817999999998, 14.6925999999999, 13.0859999999998, 13.2754, 10.8697999999999, 11.248, + 7.3768, 4.72339999999986, 7.97899999999981, 8.7503999999999, 7.68119999999999, 9.7199999999998, 7.73919999999998, + 5.6224000000002, 7.44560000000001, 6.6601999999998, 5.9058, 4.00199999999995, 4.51699999999983, 4.68240000000014, + 3.86220000000003, 5.13639999999987, 5.98500000000013, 2.47719999999981, 2.61999999999989, 1.62800000000016, + 4.65000000000009, 0.225599999999758, 0.831000000000131, -0.359400000000278, 1.27599999999984, -2.92559999999958, + -0.0303999999996449, 2.37079999999969, -2.0033999999996, 0.804600000000391, 0.30199999999968, 1.1247999999996, + -2.6880000000001, 0.0321999999996478, -1.18099999999959, -3.9402, -1.47940000000017, -0.188400000000001, + -2.10720000000038, -2.04159999999956, -3.12880000000041, -4.16160000000036, -0.612799999999879, -3.48719999999958, + -8.17900000000009, -5.37780000000021, -4.01379999999972, -5.58259999999973, -5.73719999999958, -7.66799999999967, + -5.69520000000011, -1.1247999999996, -5.58520000000044, -8.04560000000038, -4.64840000000004, -11.6468000000004, + -7.97519999999986, -5.78300000000036, -7.67420000000038, -10.6328000000003, -9.81720000000041, }, + // precision 11 + { 1476, 1449.6014, 1423.5802, 1397.7942, 1372.3042, 1347.2062, 1321.8402, 1297.2292, 1272.9462, 1248.9926, 1225.3026, 1201.4252, + 1178.0578, 1155.6092, 1132.626, 1110.5568, 1088.527, 1066.5154, 1045.1874, 1024.3878, 1003.37, 982.1972, 962.5728, + 942.1012, 922.9668, 903.292, 884.0772, 864.8578, 846.6562, 828.041, 809.714, 792.3112, 775.1806, 757.9854, 740.656, + 724.346, 707.5154, 691.8378, 675.7448, 659.6722, 645.5722, 630.1462, 614.4124, 600.8728, 585.898, 572.408, 558.4926, + 544.4938, 531.6776, 517.282, 505.7704, 493.1012, 480.7388, 467.6876, 456.1872, 445.5048, 433.0214, 420.806, 411.409, + 400.4144, 389.4294, 379.2286, 369.651, 360.6156, 350.337, 342.083, 332.1538, 322.5094, 315.01, 305.6686, 298.1678, + 287.8116, 280.9978, 271.9204, 265.3286, 257.5706, 249.6014, 242.544, 235.5976, 229.583, 220.9438, 214.672, 208.2786, + 201.8628, 195.1834, 191.505, 186.1816, 178.5188, 172.2294, 167.8908, 161.0194, 158.052, 151.4588, 148.1596, 143.4344, + 138.5238, 133.13, 127.6374, 124.8162, 118.7894, 117.3984, 114.6078, 109.0858, 105.1036, 103.6258, 98.6018000000004, + 95.7618000000002, 93.5821999999998, 88.5900000000001, 86.9992000000002, 82.8800000000001, 80.4539999999997, + 74.6981999999998, 74.3644000000004, 73.2914000000001, 65.5709999999999, 66.9232000000002, 65.1913999999997, + 62.5882000000001, 61.5702000000001, 55.7035999999998, 56.1764000000003, 52.7596000000003, 53.0302000000001, + 49.0609999999997, 48.4694, 44.933, 46.0474000000004, 44.7165999999997, 41.9416000000001, 39.9207999999999, + 35.6328000000003, 35.5276000000003, 33.1934000000001, 33.2371999999996, 33.3864000000003, 33.9228000000003, + 30.2371999999996, 29.1373999999996, 25.2272000000003, 24.2942000000003, 19.8338000000003, 18.9005999999999, + 23.0907999999999, 21.8544000000002, 19.5176000000001, 15.4147999999996, 16.9314000000004, 18.6737999999996, + 12.9877999999999, 14.3688000000002, 12.0447999999997, 15.5219999999999, 12.5299999999997, 14.5940000000001, + 14.3131999999996, 9.45499999999993, 12.9441999999999, 3.91139999999996, 13.1373999999996, 5.44720000000052, + 9.82779999999912, 7.87279999999919, 3.67760000000089, 5.46980000000076, 5.55099999999948, 5.65979999999945, + 3.89439999999922, 3.1275999999998, 5.65140000000065, 6.3062000000009, 3.90799999999945, 1.87060000000019, + 5.17020000000048, 2.46680000000015, 0.770000000000437, -3.72340000000077, 1.16400000000067, 8.05340000000069, + 0.135399999999208, 2.15940000000046, 0.766999999999825, 1.0594000000001, 3.15500000000065, -0.287399999999252, + 2.37219999999979, -2.86620000000039, -1.63199999999961, -2.22979999999916, -0.15519999999924, -1.46039999999994, + -0.262199999999211, -2.34460000000036, -2.8078000000005, -3.22179999999935, -5.60159999999996, -8.42200000000048, + -9.43740000000071, 0.161799999999857, -10.4755999999998, -10.0823999999993, }, + // precision 12 + { 2953, 2900.4782, 2848.3568, 2796.3666, 2745.324, 2694.9598, 2644.648, 2595.539, 2546.1474, 2498.2576, 2450.8376, 2403.6076, + 2357.451, 2311.38, 2266.4104, 2221.5638, 2176.9676, 2134.193, 2090.838, 2048.8548, 2007.018, 1966.1742, 1925.4482, + 1885.1294, 1846.4776, 1807.4044, 1768.8724, 1731.3732, 1693.4304, 1657.5326, 1621.949, 1586.5532, 1551.7256, 1517.6182, + 1483.5186, 1450.4528, 1417.865, 1385.7164, 1352.6828, 1322.6708, 1291.8312, 1260.9036, 1231.476, 1201.8652, 1173.6718, + 1145.757, 1119.2072, 1092.2828, 1065.0434, 1038.6264, 1014.3192, 988.5746, 965.0816, 940.1176, 917.9796, 894.5576, + 871.1858, 849.9144, 827.1142, 805.0818, 783.9664, 763.9096, 742.0816, 724.3962, 706.3454, 688.018, 667.4214, 650.3106, + 633.0686, 613.8094, 597.818, 581.4248, 563.834, 547.363, 531.5066, 520.455400000001, 505.583199999999, 488.366, + 476.480799999999, 459.7682, 450.0522, 434.328799999999, 423.952799999999, 408.727000000001, 399.079400000001, + 387.252200000001, 373.987999999999, 360.852000000001, 351.6394, 339.642, 330.902400000001, 322.661599999999, + 311.662200000001, 301.3254, 291.7484, 279.939200000001, 276.7508, 263.215200000001, 254.811400000001, 245.5494, + 242.306399999999, 234.8734, 223.787200000001, 217.7156, 212.0196, 200.793, 195.9748, 189.0702, 182.449199999999, + 177.2772, 170.2336, 164.741, 158.613600000001, 155.311, 147.5964, 142.837, 137.3724, 132.0162, 130.0424, 121.9804, + 120.451800000001, 114.8968, 111.585999999999, 105.933199999999, 101.705, 98.5141999999996, 95.0488000000005, + 89.7880000000005, 91.4750000000004, 83.7764000000006, 80.9698000000008, 72.8574000000008, 73.1615999999995, + 67.5838000000003, 62.6263999999992, 63.2638000000006, 66.0977999999996, 52.0843999999997, 58.9956000000002, + 47.0912000000008, 46.4956000000002, 48.4383999999991, 47.1082000000006, 43.2392, 37.2759999999998, 40.0283999999992, + 35.1864000000005, 35.8595999999998, 32.0998, 28.027, 23.6694000000007, 33.8266000000003, 26.3736000000008, + 27.2008000000005, 21.3245999999999, 26.4115999999995, 23.4521999999997, 19.5013999999992, 19.8513999999996, + 10.7492000000002, 18.6424000000006, 13.1265999999996, 18.2436000000016, 6.71860000000015, 3.39459999999963, + 6.33759999999893, 7.76719999999841, 0.813999999998487, 3.82819999999992, 0.826199999999517, 8.07440000000133, + -1.59080000000176, 5.01780000000144, 0.455399999998917, -0.24199999999837, 0.174800000000687, -9.07640000000174, + -4.20160000000033, -3.77520000000004, -4.75179999999818, -5.3724000000002, -8.90680000000066, -6.10239999999976, + -5.74120000000039, -9.95339999999851, -3.86339999999836, -13.7304000000004, -16.2710000000006, -7.51359999999841, + -3.30679999999847, -13.1339999999982, -10.0551999999989, -6.72019999999975, -8.59660000000076, -10.9307999999983, + -1.8775999999998, -4.82259999999951, -13.7788, -21.6470000000008, -10.6735999999983, -15.7799999999988, }, + // precision 13 + { 5907.5052, 5802.2672, 5697.347, 5593.5794, 5491.2622, 5390.5514, 5290.3376, 5191.6952, 5093.5988, 4997.3552, 4902.5972, + 4808.3082, 4715.5646, 4624.109, 4533.8216, 4444.4344, 4356.3802, 4269.2962, 4183.3784, 4098.292, 4014.79, 3932.4574, + 3850.6036, 3771.2712, 3691.7708, 3615.099, 3538.1858, 3463.4746, 3388.8496, 3315.6794, 3244.5448, 3173.7516, 3103.3106, + 3033.6094, 2966.5642, 2900.794, 2833.7256, 2769.81, 2707.3196, 2644.0778, 2583.9916, 2523.4662, 2464.124, 2406.073, + 2347.0362, 2292.1006, 2238.1716, 2182.7514, 2128.4884, 2077.1314, 2025.037, 1975.3756, 1928.933, 1879.311, 1831.0006, + 1783.2144, 1738.3096, 1694.5144, 1649.024, 1606.847, 1564.7528, 1525.3168, 1482.5372, 1443.9668, 1406.5074, 1365.867, + 1329.2186, 1295.4186, 1257.9716, 1225.339, 1193.2972, 1156.3578, 1125.8686, 1091.187, 1061.4094, 1029.4188, 1000.9126, + 972.3272, 944.004199999999, 915.7592, 889.965, 862.834200000001, 840.4254, 812.598399999999, 785.924200000001, + 763.050999999999, 741.793799999999, 721.466, 699.040799999999, 677.997200000002, 649.866999999998, 634.911800000002, + 609.8694, 591.981599999999, 570.2922, 557.129199999999, 538.3858, 521.872599999999, 502.951400000002, 495.776399999999, + 475.171399999999, 459.751, 439.995200000001, 426.708999999999, 413.7016, 402.3868, 387.262599999998, 372.0524, + 357.050999999999, 342.5098, 334.849200000001, 322.529399999999, 311.613799999999, 295.848000000002, 289.273000000001, + 274.093000000001, 263.329600000001, 251.389599999999, 245.7392, 231.9614, 229.7952, 217.155200000001, 208.9588, + 199.016599999999, 190.839199999999, 180.6976, 176.272799999999, 166.976999999999, 162.5252, 151.196400000001, + 149.386999999999, 133.981199999998, 130.0586, 130.164000000001, 122.053400000001, 110.7428, 108.1276, 106.232400000001, + 100.381600000001, 98.7668000000012, 86.6440000000002, 79.9768000000004, 82.4722000000002, 68.7026000000005, + 70.1186000000016, 71.9948000000004, 58.998599999999, 59.0492000000013, 56.9818000000014, 47.5338000000011, 42.9928, + 51.1591999999982, 37.2740000000013, 42.7220000000016, 31.3734000000004, 26.8090000000011, 25.8934000000008, + 26.5286000000015, 29.5442000000003, 19.3503999999994, 26.0760000000009, 17.9527999999991, 14.8419999999969, + 10.4683999999979, 8.65899999999965, 9.86720000000059, 4.34139999999752, -0.907800000000861, -3.32080000000133, + -0.936199999996461, -11.9916000000012, -8.87000000000262, -6.33099999999831, -11.3366000000024, -15.9207999999999, + -9.34659999999712, -15.5034000000014, -19.2097999999969, -15.357799999998, -28.2235999999975, -30.6898000000001, + -19.3271999999997, -25.6083999999973, -24.409599999999, -13.6385999999984, -33.4473999999973, -32.6949999999997, + -28.9063999999998, -31.7483999999968, -32.2935999999972, -35.8329999999987, -47.620600000002, -39.0855999999985, + -33.1434000000008, -46.1371999999974, -37.5892000000022, -46.8164000000033, -47.3142000000007, -60.2914000000019, + -37.7575999999972, }, + // precision 14 + { 11816.475, 11605.0046, 11395.3792, 11188.7504, 10984.1814, 10782.0086, 10582.0072, 10384.503, 10189.178, 9996.2738, 9806.0344, + 9617.9798, 9431.394, 9248.7784, 9067.6894, 8889.6824, 8712.9134, 8538.8624, 8368.4944, 8197.7956, 8031.8916, 7866.6316, + 7703.733, 7544.5726, 7386.204, 7230.666, 7077.8516, 6926.7886, 6778.6902, 6631.9632, 6487.304, 6346.7486, 6206.4408, + 6070.202, 5935.2576, 5799.924, 5671.0324, 5541.9788, 5414.6112, 5290.0274, 5166.723, 5047.6906, 4929.162, 4815.1406, + 4699.127, 4588.5606, 4477.7394, 4369.4014, 4264.2728, 4155.9224, 4055.581, 3955.505, 3856.9618, 3761.3828, 3666.9702, + 3575.7764, 3482.4132, 3395.0186, 3305.8852, 3221.415, 3138.6024, 3056.296, 2970.4494, 2896.1526, 2816.8008, 2740.2156, + 2670.497, 2594.1458, 2527.111, 2460.8168, 2387.5114, 2322.9498, 2260.6752, 2194.2686, 2133.7792, 2074.767, 2015.204, + 1959.4226, 1898.6502, 1850.006, 1792.849, 1741.4838, 1687.9778, 1638.1322, 1589.3266, 1543.1394, 1496.8266, 1447.8516, + 1402.7354, 1361.9606, 1327.0692, 1285.4106, 1241.8112, 1201.6726, 1161.973, 1130.261, 1094.2036, 1048.2036, 1020.6436, + 990.901400000002, 961.199800000002, 924.769800000002, 899.526400000002, 872.346400000002, 834.375, 810.432000000001, + 780.659800000001, 756.013800000001, 733.479399999997, 707.923999999999, 673.858, 652.222399999999, 636.572399999997, + 615.738599999997, 586.696400000001, 564.147199999999, 541.679600000003, 523.943599999999, 505.714599999999, + 475.729599999999, 461.779600000002, 449.750800000002, 439.020799999998, 412.7886, 400.245600000002, 383.188199999997, + 362.079599999997, 357.533799999997, 334.319000000003, 327.553399999997, 308.559399999998, 291.270199999999, + 279.351999999999, 271.791400000002, 252.576999999997, 247.482400000001, 236.174800000001, 218.774599999997, + 220.155200000001, 208.794399999999, 201.223599999998, 182.995600000002, 185.5268, 164.547400000003, 176.5962, + 150.689599999998, 157.8004, 138.378799999999, 134.021200000003, 117.614399999999, 108.194000000003, 97.0696000000025, + 89.6042000000016, 95.6030000000028, 84.7810000000027, 72.635000000002, 77.3482000000004, 59.4907999999996, + 55.5875999999989, 50.7346000000034, 61.3916000000027, 50.9149999999936, 39.0384000000049, 58.9395999999979, + 29.633600000001, 28.2032000000036, 26.0078000000067, 17.0387999999948, 9.22000000000116, 13.8387999999977, + 8.07240000000456, 14.1549999999988, 15.3570000000036, 3.42660000000615, 6.24820000000182, -2.96940000000177, + -8.79940000000352, -5.97860000000219, -14.4048000000039, -3.4143999999942, -13.0148000000045, -11.6977999999945, + -25.7878000000055, -22.3185999999987, -24.409599999999, -31.9756000000052, -18.9722000000038, -22.8678000000073, + -30.8972000000067, -32.3715999999986, -22.3907999999938, -43.6720000000059, -35.9038, -39.7492000000057, + -54.1641999999993, -45.2749999999942, -42.2989999999991, -44.1089999999967, -64.3564000000042, -49.9551999999967, + -42.6116000000038, }, + // precision 15 + { 23634.0036, 23210.8034, 22792.4744, 22379.1524, 21969.7928, 21565.326, 21165.3532, 20770.2806, 20379.9892, 19994.7098, + 19613.318, 19236.799, 18865.4382, 18498.8244, 18136.5138, 17778.8668, 17426.2344, 17079.32, 16734.778, 16397.2418, + 16063.3324, 15734.0232, 15409.731, 15088.728, 14772.9896, 14464.1402, 14157.5588, 13855.5958, 13559.3296, 13264.9096, + 12978.326, 12692.0826, 12413.8816, 12137.3192, 11870.2326, 11602.5554, 11340.3142, 11079.613, 10829.5908, 10583.5466, + 10334.0344, 10095.5072, 9859.694, 9625.2822, 9395.7862, 9174.0586, 8957.3164, 8738.064, 8524.155, 8313.7396, 8116.9168, + 7913.542, 7718.4778, 7521.65, 7335.5596, 7154.2906, 6968.7396, 6786.3996, 6613.236, 6437.406, 6270.6598, 6107.7958, + 5945.7174, 5787.6784, 5635.5784, 5482.308, 5337.9784, 5190.0864, 5045.9158, 4919.1386, 4771.817, 4645.7742, 4518.4774, + 4385.5454, 4262.6622, 4142.74679999999, 4015.5318, 3897.9276, 3790.7764, 3685.13800000001, 3573.6274, 3467.9706, + 3368.61079999999, 3271.5202, 3170.3848, 3076.4656, 2982.38400000001, 2888.4664, 2806.4868, 2711.9564, 2634.1434, + 2551.3204, 2469.7662, 2396.61139999999, 2318.9902, 2243.8658, 2171.9246, 2105.01360000001, 2028.8536, 1960.9952, + 1901.4096, 1841.86079999999, 1777.54700000001, 1714.5802, 1654.65059999999, 1596.311, 1546.2016, 1492.3296, 1433.8974, + 1383.84600000001, 1339.4152, 1293.5518, 1245.8686, 1193.50659999999, 1162.27959999999, 1107.19439999999, + 1069.18060000001, 1035.09179999999, 999.679000000004, 957.679999999993, 925.300199999998, 888.099400000006, + 848.638600000006, 818.156400000007, 796.748399999997, 752.139200000005, 725.271200000003, 692.216, 671.633600000001, + 647.939799999993, 621.670599999998, 575.398799999995, 561.226599999995, 532.237999999998, 521.787599999996, + 483.095799999996, 467.049599999998, 465.286399999997, 415.548599999995, 401.047399999996, 380.607999999993, + 377.362599999993, 347.258799999996, 338.371599999999, 310.096999999994, 301.409199999995, 276.280799999993, + 265.586800000005, 258.994399999996, 223.915999999997, 215.925399999993, 213.503800000006, 191.045400000003, + 166.718200000003, 166.259000000005, 162.941200000001, 148.829400000002, 141.645999999993, 123.535399999993, + 122.329800000007, 89.473399999988, 80.1962000000058, 77.5457999999926, 59.1056000000099, 83.3509999999951, + 52.2906000000075, 36.3979999999865, 40.6558000000077, 42.0003999999899, 19.6630000000005, 19.7153999999864, + -8.38539999999921, -0.692799999989802, 0.854800000000978, 3.23219999999856, -3.89040000000386, -5.25880000001052, + -24.9052000000083, -22.6837999999989, -26.4286000000138, -34.997000000003, -37.0216000000073, -43.430400000012, + -58.2390000000014, -68.8034000000043, -56.9245999999985, -57.8583999999973, -77.3097999999882, -73.2793999999994, + -81.0738000000129, -87.4530000000086, -65.0254000000132, -57.296399999992, -96.2746000000043, -103.25, -96.081600000005, + -91.5542000000132, -102.465200000006, -107.688599999994, -101.458000000013, -109.715800000005, }, + // precision 16 + { 47270, 46423.3584, 45585.7074, 44757.152, 43938.8416, 43130.9514, 42330.03, 41540.407, 40759.6348, 39988.206, 39226.5144, + 38473.2096, 37729.795, 36997.268, 36272.6448, 35558.665, 34853.0248, 34157.4472, 33470.5204, 32793.5742, 32127.0194, + 31469.4182, 30817.6136, 30178.6968, 29546.8908, 28922.8544, 28312.271, 27707.0924, 27114.0326, 26526.692, 25948.6336, + 25383.7826, 24823.5998, 24272.2974, 23732.2572, 23201.4976, 22674.2796, 22163.6336, 21656.515, 21161.7362, 20669.9368, + 20189.4424, 19717.3358, 19256.3744, 18795.9638, 18352.197, 17908.5738, 17474.391, 17052.918, 16637.2236, 16228.4602, + 15823.3474, 15428.6974, 15043.0284, 14667.6278, 14297.4588, 13935.2882, 13578.5402, 13234.6032, 12882.1578, 12548.0728, + 12219.231, 11898.0072, 11587.2626, 11279.9072, 10973.5048, 10678.5186, 10392.4876, 10105.2556, 9825.766, 9562.5444, + 9294.2222, 9038.2352, 8784.848, 8533.2644, 8301.7776, 8058.30859999999, 7822.94579999999, 7599.11319999999, + 7366.90779999999, 7161.217, 6957.53080000001, 6736.212, 6548.21220000001, 6343.06839999999, 6156.28719999999, + 5975.15419999999, 5791.75719999999, 5621.32019999999, 5451.66, 5287.61040000001, 5118.09479999999, 4957.288, 4798.4246, + 4662.17559999999, 4512.05900000001, 4364.68539999999, 4220.77720000001, 4082.67259999999, 3957.19519999999, + 3842.15779999999, 3699.3328, 3583.01180000001, 3473.8964, 3338.66639999999, 3233.55559999999, 3117.799, 3008.111, + 2909.69140000001, 2814.86499999999, 2719.46119999999, 2624.742, 2532.46979999999, 2444.7886, 2370.1868, + 2272.45259999999, 2196.19260000001, 2117.90419999999, 2023.2972, 1969.76819999999, 1885.58979999999, 1833.2824, + 1733.91200000001, 1682.54920000001, 1604.57980000001, 1556.11240000001, 1491.3064, 1421.71960000001, 1371.22899999999, + 1322.1324, 1264.7892, 1196.23920000001, 1143.8474, 1088.67240000001, 1073.60380000001, 1023.11660000001, + 959.036400000012, 927.433199999999, 906.792799999996, 853.433599999989, 841.873800000001, 791.1054, 756.899999999994, + 704.343200000003, 672.495599999995, 622.790399999998, 611.254799999995, 567.283200000005, 519.406599999988, + 519.188400000014, 495.312800000014, 451.350799999986, 443.973399999988, 431.882199999993, 392.027000000002, + 380.924200000009, 345.128999999986, 298.901400000002, 287.771999999997, 272.625, 247.253000000026, 222.490600000019, + 223.590000000026, 196.407599999977, 176.425999999978, 134.725199999986, 132.4804, 110.445599999977, 86.7939999999944, + 56.7038000000175, 64.915399999998, 38.3726000000024, 37.1606000000029, 46.170999999973, 49.1716000000015, + 15.3362000000197, 6.71639999997569, -34.8185999999987, -39.4476000000141, 12.6830000000191, -12.3331999999937, + -50.6565999999875, -59.9538000000175, -65.1054000000004, -70.7576000000117, -106.325200000021, -126.852200000023, + -110.227599999984, -132.885999999999, -113.897200000007, -142.713800000027, -151.145399999979, -150.799200000009, + -177.756200000003, -156.036399999983, -182.735199999996, -177.259399999981, -198.663600000029, -174.577600000019, + -193.84580000001, }, + // precision 17 + { 94541, 92848.811, 91174.019, 89517.558, 87879.9705, 86262.7565, 84663.5125, 83083.7435, 81521.7865, 79977.272, 78455.9465, + 76950.219, 75465.432, 73994.152, 72546.71, 71115.2345, 69705.6765, 68314.937, 66944.2705, 65591.255, 64252.9485, + 62938.016, 61636.8225, 60355.592, 59092.789, 57850.568, 56624.518, 55417.343, 54231.1415, 53067.387, 51903.526, + 50774.649, 49657.6415, 48561.05, 47475.7575, 46410.159, 45364.852, 44327.053, 43318.4005, 42325.6165, 41348.4595, + 40383.6265, 39436.77, 38509.502, 37594.035, 36695.939, 35818.6895, 34955.691, 34115.8095, 33293.949, 32465.0775, + 31657.6715, 30877.2585, 30093.78, 29351.3695, 28594.1365, 27872.115, 27168.7465, 26477.076, 25774.541, 25106.5375, + 24452.5135, 23815.5125, 23174.0655, 22555.2685, 21960.2065, 21376.3555, 20785.1925, 20211.517, 19657.0725, 19141.6865, + 18579.737, 18081.3955, 17578.995, 17073.44, 16608.335, 16119.911, 15651.266, 15194.583, 14749.0495, 14343.4835, + 13925.639, 13504.509, 13099.3885, 12691.2855, 12328.018, 11969.0345, 11596.5145, 11245.6355, 10917.6575, 10580.9785, + 10277.8605, 9926.58100000001, 9605.538, 9300.42950000003, 8989.97850000003, 8728.73249999998, 8448.3235, + 8175.31050000002, 7898.98700000002, 7629.79100000003, 7413.76199999999, 7149.92300000001, 6921.12650000001, 6677.1545, + 6443.28000000003, 6278.23450000002, 6014.20049999998, 5791.20299999998, 5605.78450000001, 5438.48800000001, 5234.2255, + 5059.6825, 4887.43349999998, 4682.935, 4496.31099999999, 4322.52250000002, 4191.42499999999, 4021.24200000003, + 3900.64799999999, 3762.84250000003, 3609.98050000001, 3502.29599999997, 3363.84250000003, 3206.54849999998, + 3079.70000000001, 2971.42300000001, 2867.80349999998, 2727.08100000001, 2630.74900000001, 2496.6165, 2440.902, + 2356.19150000002, 2235.58199999999, 2120.54149999999, 2012.25449999998, 1933.35600000003, 1820.93099999998, + 1761.54800000001, 1663.09350000002, 1578.84600000002, 1509.48149999999, 1427.3345, 1379.56150000001, 1306.68099999998, + 1212.63449999999, 1084.17300000001, 1124.16450000001, 1060.69949999999, 1007.48849999998, 941.194499999983, + 879.880500000028, 836.007500000007, 782.802000000025, 748.385499999975, 647.991500000004, 626.730500000005, + 570.776000000013, 484.000500000024, 513.98550000001, 418.985499999952, 386.996999999974, 370.026500000036, + 355.496999999974, 356.731499999994, 255.92200000002, 259.094000000041, 205.434499999974, 165.374500000034, + 197.347500000033, 95.718499999959, 67.6165000000037, 54.6970000000438, 31.7395000000251, -15.8784999999916, + 8.42500000004657, -26.3754999999655, -118.425500000012, -66.6629999999423, -42.9745000000112, -107.364999999991, + -189.839000000036, -162.611499999999, -164.964999999967, -189.079999999958, -223.931499999948, -235.329999999958, + -269.639500000048, -249.087999999989, -206.475499999942, -283.04449999996, -290.667000000016, -304.561499999953, + -336.784499999951, -380.386500000022, -283.280499999993, -364.533000000054, -389.059499999974, -364.454000000027, + -415.748000000021, -417.155000000028, }, + // precision 18 + { 189083, 185696.913, 182348.774, 179035.946, 175762.762, 172526.444, 169329.754, 166166.099, 163043.269, 159958.91, 156907.912, + 153906.845, 150924.199, 147996.568, 145093.457, 142239.233, 139421.475, 136632.27, 133889.588, 131174.2, 128511.619, + 125868.621, 123265.385, 120721.061, 118181.769, 115709.456, 113252.446, 110840.198, 108465.099, 106126.164, 103823.469, + 101556.618, 99308.004, 97124.508, 94937.803, 92833.731, 90745.061, 88677.627, 86617.47, 84650.442, 82697.833, 80769.132, + 78879.629, 77014.432, 75215.626, 73384.587, 71652.482, 69895.93, 68209.301, 66553.669, 64921.981, 63310.323, 61742.115, + 60205.018, 58698.658, 57190.657, 55760.865, 54331.169, 52908.167, 51550.273, 50225.254, 48922.421, 47614.533, 46362.049, + 45098.569, 43926.083, 42736.03, 41593.473, 40425.26, 39316.237, 38243.651, 37170.617, 36114.609, 35084.19, 34117.233, + 33206.509, 32231.505, 31318.728, 30403.404, 29540.0550000001, 28679.236, 27825.862, 26965.216, 26179.148, 25462.08, + 24645.952, 23922.523, 23198.144, 22529.128, 21762.4179999999, 21134.779, 20459.117, 19840.818, 19187.04, + 18636.3689999999, 17982.831, 17439.7389999999, 16874.547, 16358.2169999999, 15835.684, 15352.914, 14823.681, 14329.313, + 13816.897, 13342.874, 12880.882, 12491.648, 12021.254, 11625.392, 11293.7610000001, 10813.697, 10456.209, 10099.074, + 9755.39000000001, 9393.18500000006, 9047.57900000003, 8657.98499999999, 8395.85900000005, 8033, 7736.95900000003, + 7430.59699999995, 7258.47699999996, 6924.58200000005, 6691.29399999999, 6357.92500000005, 6202.05700000003, + 5921.19700000004, 5628.28399999999, 5404.96799999999, 5226.71100000001, 4990.75600000005, 4799.77399999998, + 4622.93099999998, 4472.478, 4171.78700000001, 3957.46299999999, 3868.95200000005, 3691.14300000004, 3474.63100000005, + 3341.67200000002, 3109.14000000001, 3071.97400000005, 2796.40399999998, 2756.17799999996, 2611.46999999997, + 2471.93000000005, 2382.26399999997, 2209.22400000005, 2142.28399999999, 2013.96100000001, 1911.18999999994, + 1818.27099999995, 1668.47900000005, 1519.65800000005, 1469.67599999998, 1367.13800000004, 1248.52899999998, + 1181.23600000003, 1022.71900000004, 1088.20700000005, 959.03600000008, 876.095999999903, 791.183999999892, + 703.337000000058, 731.949999999953, 586.86400000006, 526.024999999907, 323.004999999888, 320.448000000091, + 340.672999999952, 309.638999999966, 216.601999999955, 102.922999999952, 19.2399999999907, -0.114000000059605, + -32.6240000000689, -89.3179999999702, -153.497999999905, -64.2970000000205, -143.695999999996, -259.497999999905, + -253.017999999924, -213.948000000091, -397.590000000084, -434.006000000052, -403.475000000093, -297.958000000101, + -404.317000000039, -528.898999999976, -506.621000000043, -513.205000000075, -479.351000000024, -596.139999999898, + -527.016999999993, -664.681000000099, -680.306000000099, -704.050000000047, -850.486000000034, -757.43200000003, + -713.308999999892, } }; - private static final long[] THRESHOLDS = new long[] { - 10, 20, 40, 80, 220, 400, 900, 1800, 3100, 6500, 11500, 20000, 50000, 120000, 350000 - }; + private static final long[] THRESHOLDS = new long[] { 10, 20, 40, 80, 220, 400, 900, 1800, 3100, 6500, 11500, 20000, 50000, 120000, + 350000 }; private final BigArrays bigArrays; private final OpenBitSet algorithm; @@ -378,7 +974,6 @@ public final class HyperLogLogPlusPlus implements Releasable { return 1 + Math.min(Long.numberOfLeadingZeros(hash << p), 64 - p); } - private double estimateBias(double e) { final double[] rawEstimateData = rawEstimateData(); final double[] biasData = biasData(); @@ -454,14 +1049,13 @@ public final class HyperLogLogPlusPlus implements Releasable { } public boolean equals(long bucket, HyperLogLogPlusPlus other) { - return Objects.equals(p, other.p) && - Objects.equals(algorithm.get(bucket), other.algorithm.get(bucket)) && - Objects.equals(getComparableData(bucket), other.getComparableData(bucket)); + return Objects.equals(p, other.p) + && Objects.equals(algorithm.get(bucket), other.algorithm.get(bucket)) + && Objects.equals(getComparableData(bucket), other.getComparableData(bucket)); } /** - * We are actually using HyperLogLog's runLens array but interpreting it as a hash set - * for linear counting. + * We are actually using HyperLogLog's runLens array but interpreting it as a hash set for linear counting. */ private class Hashset { @@ -481,7 +1075,7 @@ public final class HyperLogLogPlusPlus implements Releasable { writeSpare = ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN); } - private long index (long bucket, int index) { + private long index(long bucket, int index) { return (bucket << p) + (index << 2); } @@ -516,13 +1110,13 @@ public final class HyperLogLogPlusPlus implements Releasable { } /** - * Add k to the hash table associated with bucket. - * Return {@code -1} if the value was already in the set or the new set size if it was added. + * Add k to the hash table associated with bucket. Return {@code -1} if the value was already in the set + * or the new set size if it was added. */ public int add(long bucket, int k) { sizes = bigArrays.grow(sizes, bucket + 1); assert k != 0; - for (int i = (k & mask); ; i = (i + 1) & mask) { + for (int i = (k & mask);; i = (i + 1) & mask) { final int v = get(bucket, i); if (v == 0) { // means unused, take it! @@ -591,7 +1185,7 @@ public final class HyperLogLogPlusPlus implements Releasable { } return counts; } - + /** looks and smells like the old openbitset. */ static class OpenBitSet { LongBitSet impl = new LongBitSet(64); @@ -603,16 +1197,16 @@ public final class HyperLogLogPlusPlus implements Releasable { return false; } } - + void ensureCapacity(long bit) { impl = LongBitSet.ensureCapacity(impl, bit); } - + void set(long bit) { ensureCapacity(bit); impl.set(bit); } - + void clear(long bit) { ensureCapacity(bit); impl.clear(bit); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/support/AggregationPath.java b/server/src/main/java/org/elasticsearch/search/aggregations/support/AggregationPath.java index ac97c48882a..c7474fb800f 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/support/AggregationPath.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/support/AggregationPath.java @@ -52,12 +52,12 @@ import java.util.List; * this case, the order will be based on the number of documents under {@code agg3}. * *
  • - * {@code agg1>agg2>agg3} - where agg1 and agg2 are both single-bucket aggs and agg3 is a single-value metrics agg (eg avg, max, min, etc..). - * In this case, the order will be based on the value of {@code agg3}. + * {@code agg1>agg2>agg3} - where agg1 and agg2 are both single-bucket aggs and agg3 is a single-value metrics agg (eg avg, max, + * min, etc..). In this case, the order will be based on the value of {@code agg3}. *
  • *
  • - * {@code agg1>agg2>agg3.avg} - where agg1 and agg2 are both single-bucket aggs and agg3 is a multi-value metrics agg (eg stats, extended_stats, etc...). - * In this case, the order will be based on the avg value of {@code agg3}. + * {@code agg1>agg2>agg3.avg} - where agg1 and agg2 are both single-bucket aggs and agg3 is a multi-value metrics agg (eg stats, + * extended_stats, etc...). In this case, the order will be based on the avg value of {@code agg3}. *
  • * * @@ -331,7 +331,8 @@ public class AggregationPath { if (lastToken.key != null && !"doc_count".equals(lastToken.key)) { throw new AggregationExecutionException("Invalid aggregation order path [" + this + "]. Ordering on a single-bucket aggregation can only be done on its doc_count. " + - "Either drop the key (a la \"" + lastToken.name + "\") or change it to \"doc_count\" (a la \"" + lastToken.name + ".doc_count\")"); + "Either drop the key (a la \"" + lastToken.name + "\") or change it to \"doc_count\" (a la \"" + lastToken.name + + ".doc_count\")"); } return; // perfectly valid to sort on single-bucket aggregation (will be sored on its doc_count) } @@ -340,7 +341,8 @@ public class AggregationPath { if (lastToken.key != null && !"value".equals(lastToken.key)) { throw new AggregationExecutionException("Invalid aggregation order path [" + this + "]. Ordering on a single-value metrics aggregation can only be done on its value. " + - "Either drop the key (a la \"" + lastToken.name + "\") or change it to \"value\" (a la \"" + lastToken.name + ".value\")"); + "Either drop the key (a la \"" + lastToken.name + "\") or change it to \"value\" (a la \"" + lastToken.name + + ".value\")"); } return; // perfectly valid to sort on single metric aggregation (will be sorted on its associated value) } diff --git a/server/src/main/java/org/elasticsearch/search/dfs/AggregatedDfs.java b/server/src/main/java/org/elasticsearch/search/dfs/AggregatedDfs.java index f7bfb6a8052..19da9ea9b91 100644 --- a/server/src/main/java/org/elasticsearch/search/dfs/AggregatedDfs.java +++ b/server/src/main/java/org/elasticsearch/search/dfs/AggregatedDfs.java @@ -41,7 +41,8 @@ public class AggregatedDfs implements Streamable { private AggregatedDfs() { } - public AggregatedDfs(ObjectObjectHashMap termStatistics, ObjectObjectHashMap fieldStatistics, long maxDoc) { + public AggregatedDfs(ObjectObjectHashMap termStatistics, + ObjectObjectHashMap fieldStatistics, long maxDoc) { this.termStatistics = termStatistics; this.fieldStatistics = fieldStatistics; this.maxDoc = maxDoc; diff --git a/server/src/main/java/org/elasticsearch/search/dfs/DfsSearchResult.java b/server/src/main/java/org/elasticsearch/search/dfs/DfsSearchResult.java index 46999e0f6da..49a791941f6 100644 --- a/server/src/main/java/org/elasticsearch/search/dfs/DfsSearchResult.java +++ b/server/src/main/java/org/elasticsearch/search/dfs/DfsSearchResult.java @@ -121,7 +121,8 @@ public class DfsSearchResult extends SearchPhaseResult { out.writeVInt(maxDoc); } - public static void writeFieldStats(StreamOutput out, ObjectObjectHashMap fieldStatistics) throws IOException { + public static void writeFieldStats(StreamOutput out, ObjectObjectHashMap fieldStatistics) throws IOException { out.writeVInt(fieldStatistics.size()); for (ObjectObjectCursor c : fieldStatistics) { @@ -164,7 +165,8 @@ public class DfsSearchResult extends SearchPhaseResult { return readFieldStats(in, null); } - public static ObjectObjectHashMap readFieldStats(StreamInput in, ObjectObjectHashMap fieldStatistics) throws IOException { + public static ObjectObjectHashMap readFieldStats(StreamInput in, + ObjectObjectHashMap fieldStatistics) throws IOException { final int numFieldStatistics = in.readVInt(); if (fieldStatistics == null) { fieldStatistics = HppcMaps.newNoNullKeysMap(numFieldStatistics); diff --git a/server/src/main/java/org/elasticsearch/search/internal/ShardSearchTransportRequest.java b/server/src/main/java/org/elasticsearch/search/internal/ShardSearchTransportRequest.java index 08060a2b249..e7aad0bd517 100644 --- a/server/src/main/java/org/elasticsearch/search/internal/ShardSearchTransportRequest.java +++ b/server/src/main/java/org/elasticsearch/search/internal/ShardSearchTransportRequest.java @@ -42,7 +42,8 @@ import java.util.Map; /** * Shard level search request that represents an actual search sent from the coordinating node to the nodes holding * the shards where the query needs to be executed. Holds the same info as {@link org.elasticsearch.search.internal.ShardSearchLocalRequest} - * but gets sent over the transport and holds also the indices coming from the original request that generated it, plus its headers and context. + * but gets sent over the transport and holds also the indices coming from the original request that generated it, plus its headers and + * context. */ public class ShardSearchTransportRequest extends TransportRequest implements ShardSearchRequest, IndicesRequest { diff --git a/server/src/main/java/org/elasticsearch/search/lookup/FieldLookup.java b/server/src/main/java/org/elasticsearch/search/lookup/FieldLookup.java index 8224e453ff2..2e3817d7684 100644 --- a/server/src/main/java/org/elasticsearch/search/lookup/FieldLookup.java +++ b/server/src/main/java/org/elasticsearch/search/lookup/FieldLookup.java @@ -26,7 +26,8 @@ import java.util.Map; public class FieldLookup { - // we can cached fieldType completely per name, since its on an index/shard level (the lookup, and it does not change within the scope of a search request) + // we can cached fieldType completely per name, since its on an index/shard level (the lookup, and it does not change within the scope + // of a search request) private final MappedFieldType fieldType; private Map> fields; diff --git a/server/src/main/java/org/elasticsearch/search/lookup/LeafDocLookup.java b/server/src/main/java/org/elasticsearch/search/lookup/LeafDocLookup.java index 33645340c78..4beb2507d7f 100644 --- a/server/src/main/java/org/elasticsearch/search/lookup/LeafDocLookup.java +++ b/server/src/main/java/org/elasticsearch/search/lookup/LeafDocLookup.java @@ -78,7 +78,8 @@ public class LeafDocLookup implements Map> { if (scriptValues == null) { final MappedFieldType fieldType = mapperService.fullName(fieldName); if (fieldType == null) { - throw new IllegalArgumentException("No field found for [" + fieldName + "] in mapping with types " + Arrays.toString(types)); + throw new IllegalArgumentException("No field found for [" + fieldName + "] in mapping with types " + + Arrays.toString(types)); } // load fielddata on behalf of the script: otherwise it would need additional permissions // to deal with pagedbytes/ramusagestimator/etc diff --git a/server/src/main/java/org/elasticsearch/search/rescore/QueryRescorer.java b/server/src/main/java/org/elasticsearch/search/rescore/QueryRescorer.java index 61bd150291d..d70ec62c7af 100644 --- a/server/src/main/java/org/elasticsearch/search/rescore/QueryRescorer.java +++ b/server/src/main/java/org/elasticsearch/search/rescore/QueryRescorer.java @@ -53,7 +53,8 @@ public final class QueryRescorer implements Rescorer { @Override protected float combine(float firstPassScore, boolean secondPassMatches, float secondPassScore) { if (secondPassMatches) { - return rescore.scoreMode.combine(firstPassScore * rescore.queryWeight(), secondPassScore * rescore.rescoreQueryWeight()); + return rescore.scoreMode.combine(firstPassScore * rescore.queryWeight(), + secondPassScore * rescore.rescoreQueryWeight()); } // TODO: shouldn't this be up to the ScoreMode? I.e., we should just invoke ScoreMode.combine, passing 0.0f for the // secondary score? diff --git a/server/src/main/java/org/elasticsearch/search/suggest/completion/context/CategoryContextMapping.java b/server/src/main/java/org/elasticsearch/search/suggest/completion/context/CategoryContextMapping.java index d935bc1050e..affdb552812 100644 --- a/server/src/main/java/org/elasticsearch/search/suggest/completion/context/CategoryContextMapping.java +++ b/server/src/main/java/org/elasticsearch/search/suggest/completion/context/CategoryContextMapping.java @@ -149,7 +149,8 @@ public class CategoryContextMapping extends ContextMapping } else if (field.fieldType() instanceof StringFieldType) { values.add(field.stringValue()); } else { - throw new IllegalArgumentException("Failed to parse context field [" + fieldName + "], only keyword and text fields are accepted"); + throw new IllegalArgumentException("Failed to parse context field [" + fieldName + + "], only keyword and text fields are accepted"); } } } @@ -173,7 +174,8 @@ public class CategoryContextMapping extends ContextMapping * * A CategoryQueryContext has one of the following forms: *
      - *
    • Object:
      {"context": <string>, "boost": <int>, "prefix": <boolean>}
    • + *
    • Object:
      {"context": <string>, "boost": <int>, "prefix":
      +     *     <boolean>}
    • *
    • String:
      "string"
    • *
    */ diff --git a/server/src/main/java/org/elasticsearch/search/suggest/completion/context/ContextMapping.java b/server/src/main/java/org/elasticsearch/search/suggest/completion/context/ContextMapping.java index ba24e8eb6aa..e643735ade6 100644 --- a/server/src/main/java/org/elasticsearch/search/suggest/completion/context/ContextMapping.java +++ b/server/src/main/java/org/elasticsearch/search/suggest/completion/context/ContextMapping.java @@ -95,7 +95,8 @@ public abstract class ContextMapping implements ToXContent /** * Parses a set of index-time contexts. */ - public abstract Set parseContext(ParseContext parseContext, XContentParser parser) throws IOException, ElasticsearchParseException; + public abstract Set parseContext(ParseContext parseContext, XContentParser parser) + throws IOException, ElasticsearchParseException; /** * Retrieves a set of context from a document at index-time. diff --git a/server/src/main/java/org/elasticsearch/search/suggest/completion/context/GeoContextMapping.java b/server/src/main/java/org/elasticsearch/search/suggest/completion/context/GeoContextMapping.java index 9f01c9a15b5..b1b3c5e92ce 100644 --- a/server/src/main/java/org/elasticsearch/search/suggest/completion/context/GeoContextMapping.java +++ b/server/src/main/java/org/elasticsearch/search/suggest/completion/context/GeoContextMapping.java @@ -251,9 +251,12 @@ public class GeoContextMapping extends ContextMapping { *
  • Object: *
      *
    • GEO POINT
    • - *
    • {"lat": <double>, "lon": <double>, "precision": <int>, "neighbours": <[int, ..]>}
    • - *
    • {"context": <string>, "boost": <int>, "precision": <int>, "neighbours": <[int, ..]>}
    • - *
    • {"context": <GEO POINT>, "boost": <int>, "precision": <int>, "neighbours": <[int, ..]>}
    • + *
    • {"lat": <double>, "lon": <double>, "precision":
      +     *         <int>, "neighbours": <[int, ..]>}
    • + *
    • {"context": <string>, "boost": <int>, "precision":
      +     *         <int>, "neighbours": <[int, ..]>}
    • + *
    • {"context": <GEO POINT>, "boost": <int>, "precision":
      +     *         <int>, "neighbours": <[int, ..]>}
    • *
    *
  • String:
    GEO POINT
  • * diff --git a/server/src/main/java/org/elasticsearch/search/suggest/completion/context/GeoQueryContext.java b/server/src/main/java/org/elasticsearch/search/suggest/completion/context/GeoQueryContext.java index 259446cb0c1..7885dd1d296 100644 --- a/server/src/main/java/org/elasticsearch/search/suggest/completion/context/GeoQueryContext.java +++ b/server/src/main/java/org/elasticsearch/search/suggest/completion/context/GeoQueryContext.java @@ -114,7 +114,9 @@ public final class GeoQueryContext implements ToXContentObject { private static ObjectParser GEO_CONTEXT_PARSER = new ObjectParser<>(NAME, null); static { - GEO_CONTEXT_PARSER.declareField((parser, geoQueryContext, geoContextMapping) -> geoQueryContext.setGeoPoint(GeoUtils.parseGeoPoint(parser)), new ParseField(CONTEXT_VALUE), ObjectParser.ValueType.OBJECT); + GEO_CONTEXT_PARSER.declareField((parser, geoQueryContext, + geoContextMapping) -> geoQueryContext.setGeoPoint(GeoUtils.parseGeoPoint(parser)), + new ParseField(CONTEXT_VALUE), ObjectParser.ValueType.OBJECT); GEO_CONTEXT_PARSER.declareInt(GeoQueryContext.Builder::setBoost, new ParseField(CONTEXT_BOOST)); GEO_CONTEXT_PARSER.declareField((parser, builder, context) -> builder.setPrecision(parsePrecision(parser)), new ParseField(CONTEXT_PRECISION), ObjectParser.ValueType.INT); diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/bootstrap/BootstrapConfigurationTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/bootstrap/BootstrapConfigurationTests.java index 7294a9c4773..fc2e24017e7 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/bootstrap/BootstrapConfigurationTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/bootstrap/BootstrapConfigurationTests.java @@ -26,6 +26,7 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNode.Role; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.EqualsHashCodeTestUtils; +import org.elasticsearch.test.EqualsHashCodeTestUtils.CopyFunction; import java.util.ArrayList; import java.util.List; @@ -39,8 +40,11 @@ import static org.hamcrest.Matchers.startsWith; public class BootstrapConfigurationTests extends ESTestCase { public void testEqualsHashcodeSerialization() { + // Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type EqualsHashCodeTestUtils.checkEqualsAndHashCode(randomBootstrapConfiguration(), - bootstrapConfiguration -> copyWriteable(bootstrapConfiguration, writableRegistry(), BootstrapConfiguration::new), this::mutate); + (CopyFunction) bootstrapConfiguration -> copyWriteable(bootstrapConfiguration, writableRegistry(), + BootstrapConfiguration::new), + this::mutate); } public void testNodeDescriptionResolvedByName() { diff --git a/server/src/test/java/org/elasticsearch/action/termvectors/TermVectorsUnitTests.java b/server/src/test/java/org/elasticsearch/action/termvectors/TermVectorsUnitTests.java index 9a8bb38d8cd..0cd9d3130f1 100644 --- a/server/src/test/java/org/elasticsearch/action/termvectors/TermVectorsUnitTests.java +++ b/server/src/test/java/org/elasticsearch/action/termvectors/TermVectorsUnitTests.java @@ -300,7 +300,9 @@ public class TermVectorsUnitTests extends ESTestCase { data = createParser(JsonXContent.jsonXContent, new BytesArray(bytes)); request = new MultiTermVectorsRequest(); request.add(new TermVectorsRequest(), data); + checkParsedParameters(request); + assertWarnings(RestTermVectorsAction.TYPES_DEPRECATION_MESSAGE); } void checkParsedParameters(MultiTermVectorsRequest request) { @@ -330,7 +332,9 @@ public class TermVectorsUnitTests extends ESTestCase { XContentParser data = createParser(JsonXContent.jsonXContent, bytes); MultiTermVectorsRequest request = new MultiTermVectorsRequest(); request.add(new TermVectorsRequest(), data); + checkParsedFilterParameters(request); + assertWarnings(RestTermVectorsAction.TYPES_DEPRECATION_MESSAGE); } void checkParsedFilterParameters(MultiTermVectorsRequest multiRequest) { diff --git a/server/src/test/java/org/elasticsearch/bootstrap/BootstrapChecksTests.java b/server/src/test/java/org/elasticsearch/bootstrap/BootstrapChecksTests.java index 1e18135f4eb..4f3a3a615da 100644 --- a/server/src/test/java/org/elasticsearch/bootstrap/BootstrapChecksTests.java +++ b/server/src/test/java/org/elasticsearch/bootstrap/BootstrapChecksTests.java @@ -40,6 +40,8 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; +import static org.elasticsearch.discovery.DiscoveryModule.ZEN2_DISCOVERY_TYPE; +import static org.elasticsearch.discovery.DiscoveryModule.ZEN_DISCOVERY_TYPE; import static org.hamcrest.CoreMatchers.allOf; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.equalTo; @@ -101,7 +103,7 @@ public class BootstrapChecksTests extends ESTestCase { when(boundTransportAddress.boundAddresses()).thenReturn(transportAddresses.toArray(new TransportAddress[0])); when(boundTransportAddress.publishAddress()).thenReturn(publishAddress); - final String discoveryType = randomFrom("zen", "single-node"); + final String discoveryType = randomFrom(ZEN_DISCOVERY_TYPE, ZEN2_DISCOVERY_TYPE, "single-node"); assertEquals(BootstrapChecks.enforceLimits(boundTransportAddress, discoveryType), !"single-node".equals(discoveryType)); } @@ -119,7 +121,7 @@ public class BootstrapChecksTests extends ESTestCase { when(boundTransportAddress.boundAddresses()).thenReturn(transportAddresses.toArray(new TransportAddress[0])); when(boundTransportAddress.publishAddress()).thenReturn(publishAddress); - final String discoveryType = randomFrom("zen", "single-node"); + final String discoveryType = randomFrom(ZEN_DISCOVERY_TYPE, ZEN2_DISCOVERY_TYPE, "single-node"); assertEquals(BootstrapChecks.enforceLimits(boundTransportAddress, discoveryType), !"single-node".equals(discoveryType)); } diff --git a/server/src/test/java/org/elasticsearch/cluster/coordination/ClusterBootstrapServiceTests.java b/server/src/test/java/org/elasticsearch/cluster/coordination/ClusterBootstrapServiceTests.java index 952d7c0e752..23030b9500f 100644 --- a/server/src/test/java/org/elasticsearch/cluster/coordination/ClusterBootstrapServiceTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/coordination/ClusterBootstrapServiceTests.java @@ -48,6 +48,7 @@ import java.util.stream.Stream; import static java.util.Collections.emptyMap; import static java.util.Collections.emptySet; import static java.util.Collections.singleton; +import static org.elasticsearch.cluster.coordination.ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING; import static org.elasticsearch.cluster.coordination.ClusterBootstrapService.INITIAL_MASTER_NODE_COUNT_SETTING; import static org.elasticsearch.node.Node.NODE_NAME_SETTING; @@ -76,8 +77,14 @@ public class ClusterBootstrapServiceTests extends ESTestCase { transportService = transport.createTransportService(Settings.EMPTY, deterministicTaskQueue.getThreadPool(), TransportService.NOOP_TRANSPORT_INTERCEPTOR, boundTransportAddress -> localNode, null, emptySet()); - clusterBootstrapService = new ClusterBootstrapService(Settings.builder().put(INITIAL_MASTER_NODE_COUNT_SETTING.getKey(), 3).build(), - transportService); + final Settings settings; + if (randomBoolean()) { + settings = Settings.builder().put(INITIAL_MASTER_NODE_COUNT_SETTING.getKey(), 3).build(); + } else { + settings = Settings.builder() + .putList(INITIAL_MASTER_NODES_SETTING.getKey(), localNode.getName(), otherNode1.getName(), otherNode2.getName()).build(); + } + clusterBootstrapService = new ClusterBootstrapService(settings, transportService); } private DiscoveryNode newDiscoveryNode(String nodeName) { diff --git a/server/src/test/java/org/elasticsearch/cluster/coordination/CoordinationMetaDataTests.java b/server/src/test/java/org/elasticsearch/cluster/coordination/CoordinationMetaDataTests.java index b9a67d69665..5e366c6bdcc 100644 --- a/server/src/test/java/org/elasticsearch/cluster/coordination/CoordinationMetaDataTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/coordination/CoordinationMetaDataTests.java @@ -18,8 +18,8 @@ */ package org.elasticsearch.cluster.coordination; -import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfiguration; import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfigExclusion; +import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfiguration; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.util.set.Sets; @@ -29,6 +29,7 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.EqualsHashCodeTestUtils; +import org.elasticsearch.test.EqualsHashCodeTestUtils.CopyFunction; import java.io.IOException; import java.util.Collections; @@ -84,9 +85,11 @@ public class CoordinationMetaDataTests extends ESTestCase { public void testVotingConfigurationSerializationEqualsHashCode() { VotingConfiguration initialConfig = randomVotingConfig(); + // Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type EqualsHashCodeTestUtils.checkEqualsAndHashCode(initialConfig, - orig -> ESTestCase.copyWriteable(orig, new NamedWriteableRegistry(Collections.emptyList()), VotingConfiguration::new), - cfg -> randomlyChangeVotingConfiguration(cfg)); + (CopyFunction) orig -> ESTestCase.copyWriteable(orig, + new NamedWriteableRegistry(Collections.emptyList()), VotingConfiguration::new), + cfg -> randomlyChangeVotingConfiguration(cfg)); } private static VotingConfiguration randomVotingConfig() { @@ -95,8 +98,10 @@ public class CoordinationMetaDataTests extends ESTestCase { public void testVotingTombstoneSerializationEqualsHashCode() { VotingConfigExclusion tombstone = new VotingConfigExclusion(randomAlphaOfLength(10), randomAlphaOfLength(10)); + // Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type EqualsHashCodeTestUtils.checkEqualsAndHashCode(tombstone, - orig -> ESTestCase.copyWriteable(orig, new NamedWriteableRegistry(Collections.emptyList()), VotingConfigExclusion::new), + (CopyFunction) orig -> ESTestCase.copyWriteable(orig, + new NamedWriteableRegistry(Collections.emptyList()), VotingConfigExclusion::new), orig -> randomlyChangeVotingTombstone(orig)); } @@ -148,8 +153,10 @@ public class CoordinationMetaDataTests extends ESTestCase { public void testCoordinationMetaDataSerializationEqualsHashCode() { CoordinationMetaData initialMetaData = new CoordinationMetaData(randomNonNegativeLong(), randomVotingConfig(), randomVotingConfig(), randomVotingTombstones()); + // Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type EqualsHashCodeTestUtils.checkEqualsAndHashCode(initialMetaData, - orig -> ESTestCase.copyWriteable(orig, new NamedWriteableRegistry(Collections.emptyList()), CoordinationMetaData::new), + (CopyFunction) orig -> ESTestCase.copyWriteable(orig, + new NamedWriteableRegistry(Collections.emptyList()), CoordinationMetaData::new), meta -> { CoordinationMetaData.Builder builder = CoordinationMetaData.builder(meta); switch (randomInt(3)) { diff --git a/server/src/test/java/org/elasticsearch/cluster/coordination/FollowersCheckerTests.java b/server/src/test/java/org/elasticsearch/cluster/coordination/FollowersCheckerTests.java index beda4ef1a8c..6d985d46ef6 100644 --- a/server/src/test/java/org/elasticsearch/cluster/coordination/FollowersCheckerTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/coordination/FollowersCheckerTests.java @@ -30,6 +30,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings.Builder; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.EqualsHashCodeTestUtils; +import org.elasticsearch.test.EqualsHashCodeTestUtils.CopyFunction; import org.elasticsearch.test.transport.MockTransport; import org.elasticsearch.threadpool.ThreadPool.Names; import org.elasticsearch.transport.ConnectTransportException; @@ -376,9 +377,10 @@ public class FollowersCheckerTests extends ESTestCase { } public void testFollowerCheckRequestEqualsHashCodeSerialization() { + // Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type EqualsHashCodeTestUtils.checkEqualsAndHashCode(new FollowerCheckRequest(randomNonNegativeLong(), new DiscoveryNode(randomAlphaOfLength(10), buildNewFakeTransportAddress(), Version.CURRENT)), - rq -> copyWriteable(rq, writableRegistry(), FollowerCheckRequest::new), + (CopyFunction) rq -> copyWriteable(rq, writableRegistry(), FollowerCheckRequest::new), rq -> { if (randomBoolean()) { return new FollowerCheckRequest(rq.getTerm(), diff --git a/server/src/test/java/org/elasticsearch/cluster/coordination/LeaderCheckerTests.java b/server/src/test/java/org/elasticsearch/cluster/coordination/LeaderCheckerTests.java index f9132033e61..a806cb84a68 100644 --- a/server/src/test/java/org/elasticsearch/cluster/coordination/LeaderCheckerTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/coordination/LeaderCheckerTests.java @@ -29,6 +29,7 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.EqualsHashCodeTestUtils; +import org.elasticsearch.test.EqualsHashCodeTestUtils.CopyFunction; import org.elasticsearch.test.transport.CapturingTransport; import org.elasticsearch.test.transport.MockTransport; import org.elasticsearch.threadpool.ThreadPool.Names; @@ -387,8 +388,9 @@ public class LeaderCheckerTests extends ESTestCase { public void testLeaderCheckRequestEqualsHashcodeSerialization() { LeaderCheckRequest request = new LeaderCheckRequest( new DiscoveryNode(randomAlphaOfLength(10), buildNewFakeTransportAddress(), Version.CURRENT)); + // Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type EqualsHashCodeTestUtils.checkEqualsAndHashCode(request, - rq -> copyWriteable(rq, writableRegistry(), LeaderCheckRequest::new), + (CopyFunction) rq -> copyWriteable(rq, writableRegistry(), LeaderCheckRequest::new), rq -> new LeaderCheckRequest(new DiscoveryNode(randomAlphaOfLength(10), buildNewFakeTransportAddress(), Version.CURRENT))); } } diff --git a/server/src/test/java/org/elasticsearch/cluster/coordination/MessagesTests.java b/server/src/test/java/org/elasticsearch/cluster/coordination/MessagesTests.java index d885f42e554..cb89c7c0fea 100644 --- a/server/src/test/java/org/elasticsearch/cluster/coordination/MessagesTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/coordination/MessagesTests.java @@ -24,6 +24,7 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.EqualsHashCodeTestUtils; +import org.elasticsearch.test.EqualsHashCodeTestUtils.CopyFunction; import java.util.Optional; @@ -37,8 +38,9 @@ public class MessagesTests extends ESTestCase { Join initialJoin = new Join(createNode(randomAlphaOfLength(10)), createNode(randomAlphaOfLength(10)), randomNonNegativeLong(), randomNonNegativeLong(), randomNonNegativeLong()); + // Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type EqualsHashCodeTestUtils.checkEqualsAndHashCode(initialJoin, - join -> copyWriteable(join, writableRegistry(), Join::new), + (CopyFunction) join -> copyWriteable(join, writableRegistry(), Join::new), join -> { switch (randomInt(4)) { case 0: @@ -79,8 +81,9 @@ public class MessagesTests extends ESTestCase { public void testPublishResponseEqualsHashCodeSerialization() { PublishResponse initialPublishResponse = new PublishResponse(randomNonNegativeLong(), randomNonNegativeLong()); + // Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type EqualsHashCodeTestUtils.checkEqualsAndHashCode(initialPublishResponse, - publishResponse -> copyWriteable(publishResponse, writableRegistry(), PublishResponse::new), + (CopyFunction) publishResponse -> copyWriteable(publishResponse, writableRegistry(), PublishResponse::new), publishResponse -> { switch (randomInt(1)) { case 0: @@ -104,8 +107,10 @@ public class MessagesTests extends ESTestCase { randomNonNegativeLong()); PublishWithJoinResponse initialPublishWithJoinResponse = new PublishWithJoinResponse(initialPublishResponse, randomBoolean() ? Optional.empty() : Optional.of(initialJoin)); + // Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type EqualsHashCodeTestUtils.checkEqualsAndHashCode(initialPublishWithJoinResponse, - publishWithJoinResponse -> copyWriteable(publishWithJoinResponse, writableRegistry(), PublishWithJoinResponse::new), + (CopyFunction) publishWithJoinResponse -> copyWriteable(publishWithJoinResponse, + writableRegistry(), PublishWithJoinResponse::new), publishWithJoinResponse -> { switch (randomInt(1)) { case 0: @@ -126,8 +131,10 @@ public class MessagesTests extends ESTestCase { public void testStartJoinRequestEqualsHashCodeSerialization() { StartJoinRequest initialStartJoinRequest = new StartJoinRequest(createNode(randomAlphaOfLength(10)), randomNonNegativeLong()); + // Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type EqualsHashCodeTestUtils.checkEqualsAndHashCode(initialStartJoinRequest, - startJoinRequest -> copyWriteable(startJoinRequest, writableRegistry(), StartJoinRequest::new), + (CopyFunction) startJoinRequest -> copyWriteable(startJoinRequest, writableRegistry(), + StartJoinRequest::new), startJoinRequest -> { switch (randomInt(1)) { case 0: @@ -146,8 +153,9 @@ public class MessagesTests extends ESTestCase { public void testApplyCommitEqualsHashCodeSerialization() { ApplyCommitRequest initialApplyCommit = new ApplyCommitRequest(createNode(randomAlphaOfLength(10)), randomNonNegativeLong(), randomNonNegativeLong()); + // Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type EqualsHashCodeTestUtils.checkEqualsAndHashCode(initialApplyCommit, - applyCommit -> copyWriteable(applyCommit, writableRegistry(), ApplyCommitRequest::new), + (CopyFunction) applyCommit -> copyWriteable(applyCommit, writableRegistry(), ApplyCommitRequest::new), applyCommit -> { switch (randomInt(2)) { case 0: @@ -172,8 +180,9 @@ public class MessagesTests extends ESTestCase { randomNonNegativeLong(), randomNonNegativeLong()); JoinRequest initialJoinRequest = new JoinRequest(initialJoin.getSourceNode(), randomBoolean() ? Optional.empty() : Optional.of(initialJoin)); + // Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type EqualsHashCodeTestUtils.checkEqualsAndHashCode(initialJoinRequest, - joinRequest -> copyWriteable(joinRequest, writableRegistry(), JoinRequest::new), + (CopyFunction) joinRequest -> copyWriteable(joinRequest, writableRegistry(), JoinRequest::new), joinRequest -> { if (randomBoolean() && joinRequest.getOptionalJoin().isPresent() == false) { return new JoinRequest(createNode(randomAlphaOfLength(20)), joinRequest.getOptionalJoin()); @@ -200,8 +209,9 @@ public class MessagesTests extends ESTestCase { public void testPreVoteRequestEqualsHashCodeSerialization() { PreVoteRequest initialPreVoteRequest = new PreVoteRequest(createNode(randomAlphaOfLength(10)), randomNonNegativeLong()); + // Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type EqualsHashCodeTestUtils.checkEqualsAndHashCode(initialPreVoteRequest, - preVoteRequest -> copyWriteable(preVoteRequest, writableRegistry(), PreVoteRequest::new), + (CopyFunction) preVoteRequest -> copyWriteable(preVoteRequest, writableRegistry(), PreVoteRequest::new), preVoteRequest -> { if (randomBoolean()) { return new PreVoteRequest(createNode(randomAlphaOfLength(10)), preVoteRequest.getCurrentTerm()); @@ -215,8 +225,9 @@ public class MessagesTests extends ESTestCase { long currentTerm = randomNonNegativeLong(); PreVoteResponse initialPreVoteResponse = new PreVoteResponse(currentTerm, randomLongBetween(1, currentTerm), randomNonNegativeLong()); + // Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type EqualsHashCodeTestUtils.checkEqualsAndHashCode(initialPreVoteResponse, - preVoteResponse -> copyWriteable(preVoteResponse, writableRegistry(), PreVoteResponse::new), + (CopyFunction) preVoteResponse -> copyWriteable(preVoteResponse, writableRegistry(), PreVoteResponse::new), preVoteResponse -> { switch (randomInt(2)) { case 0: diff --git a/server/src/test/java/org/elasticsearch/discovery/PeerFinderMessagesTests.java b/server/src/test/java/org/elasticsearch/discovery/PeerFinderMessagesTests.java index aabb77b67ee..90399107f42 100644 --- a/server/src/test/java/org/elasticsearch/discovery/PeerFinderMessagesTests.java +++ b/server/src/test/java/org/elasticsearch/discovery/PeerFinderMessagesTests.java @@ -24,6 +24,7 @@ import org.elasticsearch.cluster.coordination.PeersResponse; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.EqualsHashCodeTestUtils; +import org.elasticsearch.test.EqualsHashCodeTestUtils.CopyFunction; import java.util.ArrayList; import java.util.Arrays; @@ -44,8 +45,9 @@ public class PeerFinderMessagesTests extends ESTestCase { final PeersRequest initialPeersRequest = new PeersRequest(createNode(randomAlphaOfLength(10)), Arrays.stream(generateRandomStringArray(10, 10, false)).map(this::createNode).collect(Collectors.toList())); + // Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type EqualsHashCodeTestUtils.checkEqualsAndHashCode(initialPeersRequest, - publishRequest -> copyWriteable(publishRequest, writableRegistry(), PeersRequest::new), + (CopyFunction) publishRequest -> copyWriteable(publishRequest, writableRegistry(), PeersRequest::new), in -> { final List discoveryNodes = new ArrayList<>(in.getKnownPeers()); if (randomBoolean()) { @@ -68,8 +70,9 @@ public class PeerFinderMessagesTests extends ESTestCase { initialTerm); } + // Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type EqualsHashCodeTestUtils.checkEqualsAndHashCode(initialPeersResponse, - publishResponse -> copyWriteable(publishResponse, writableRegistry(), PeersResponse::new), + (CopyFunction) publishResponse -> copyWriteable(publishResponse, writableRegistry(), PeersResponse::new), in -> { final long term = in.getTerm(); if (randomBoolean()) { diff --git a/server/src/test/java/org/elasticsearch/gateway/WriteStateExceptionTests.java b/server/src/test/java/org/elasticsearch/gateway/WriteStateExceptionTests.java new file mode 100644 index 00000000000..cc6a7950d89 --- /dev/null +++ b/server/src/test/java/org/elasticsearch/gateway/WriteStateExceptionTests.java @@ -0,0 +1,49 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.elasticsearch.gateway; + +import org.elasticsearch.test.ESTestCase; + +import java.io.IOError; +import java.io.UncheckedIOException; + +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.instanceOf; + +public class WriteStateExceptionTests extends ESTestCase { + + public void testDirtyFlag() { + boolean dirty = randomBoolean(); + WriteStateException ex = new WriteStateException(dirty, "test", null); + assertThat(ex.isDirty(), equalTo(dirty)); + } + + public void testNonDirtyRethrow() { + WriteStateException ex = new WriteStateException(false, "test", null); + UncheckedIOException ex2 = expectThrows(UncheckedIOException.class, () -> ex.rethrowAsErrorOrUncheckedException()); + assertThat(ex2.getCause(), instanceOf(WriteStateException.class)); + } + + public void testDirtyRethrow() { + WriteStateException ex = new WriteStateException(true, "test", null); + IOError err = expectThrows(IOError.class, () -> ex.rethrowAsErrorOrUncheckedException()); + assertThat(err.getCause(), instanceOf(WriteStateException.class)); + } +} diff --git a/server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java b/server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java index a34bc77ac1f..15b10218d0f 100644 --- a/server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java +++ b/server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java @@ -3809,7 +3809,6 @@ public class InternalEngineTests extends EngineTestCase { searchResult.close(); } - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/35823") public void testLookupSeqNoByIdInLucene() throws Exception { int numOps = between(10, 100); long seqNo = 0; @@ -3878,7 +3877,7 @@ public class InternalEngineTests extends EngineTestCase { lookupAndCheck.run(); } if (rarely()) { - engine.flush(); + engine.flush(false, true); lookupAndCheck.run(); } } diff --git a/server/src/test/java/org/elasticsearch/index/shard/RemoveCorruptedShardDataCommandIT.java b/server/src/test/java/org/elasticsearch/index/shard/RemoveCorruptedShardDataCommandIT.java index a7ea3904386..b1a67472730 100644 --- a/server/src/test/java/org/elasticsearch/index/shard/RemoveCorruptedShardDataCommandIT.java +++ b/server/src/test/java/org/elasticsearch/index/shard/RemoveCorruptedShardDataCommandIT.java @@ -28,7 +28,6 @@ import org.apache.lucene.store.FSDirectory; import org.apache.lucene.store.Lock; import org.apache.lucene.store.LockObtainFailedException; import org.apache.lucene.store.NativeFSLockFactory; -import org.apache.lucene.util.LuceneTestCase; import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplanation; import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; @@ -100,7 +99,6 @@ import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.startsWith; -@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/36189") @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.SUITE, numDataNodes = 0) public class RemoveCorruptedShardDataCommandIT extends ESIntegTestCase { diff --git a/server/src/test/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsActionTests.java new file mode 100644 index 00000000000..286a3ffbab9 --- /dev/null +++ b/server/src/test/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsActionTests.java @@ -0,0 +1,107 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.elasticsearch.rest.action.document; + +import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.bytes.BytesReference; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.concurrent.ThreadContext; +import org.elasticsearch.common.xcontent.XContentBuilder; +import org.elasticsearch.common.xcontent.XContentFactory; +import org.elasticsearch.common.xcontent.XContentType; +import org.elasticsearch.indices.breaker.NoneCircuitBreakerService; +import org.elasticsearch.rest.RestChannel; +import org.elasticsearch.rest.RestController; +import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; +import org.elasticsearch.test.ESTestCase; +import org.elasticsearch.test.rest.FakeRestChannel; +import org.elasticsearch.test.rest.FakeRestRequest; +import org.elasticsearch.usage.UsageService; + +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import static org.mockito.Mockito.mock; + +public class RestMultiTermVectorsActionTests extends ESTestCase { + private RestController controller; + + public void setUp() throws Exception { + super.setUp(); + controller = new RestController(Collections.emptySet(), null, + mock(NodeClient.class), + new NoneCircuitBreakerService(), + new UsageService()); + new RestMultiTermVectorsAction(Settings.EMPTY, controller); + } + + public void testTypeInPath() { + RestRequest request = new FakeRestRequest.Builder(xContentRegistry()) + .withMethod(Method.POST) + .withPath("/some_index/some_type/_mtermvectors") + .build(); + + performRequest(request); + assertWarnings(RestMultiTermVectorsAction.TYPES_DEPRECATION_MESSAGE); + } + + public void testTypeParameter() { + Map params = new HashMap<>(); + params.put("type", "some_type"); + + RestRequest request = new FakeRestRequest.Builder(xContentRegistry()) + .withMethod(Method.GET) + .withPath("/some_index/_mtermvectors") + .withParams(params) + .build(); + + performRequest(request); + assertWarnings(RestMultiTermVectorsAction.TYPES_DEPRECATION_MESSAGE); + } + + public void testTypeInBody() throws IOException { + XContentBuilder content = XContentFactory.jsonBuilder().startObject() + .startArray("docs") + .startObject() + .field("_type", "some_type") + .field("_id", 1) + .endObject() + .endArray() + .endObject(); + + RestRequest request = new FakeRestRequest.Builder(xContentRegistry()) + .withMethod(Method.GET) + .withPath("/some_index/_mtermvectors") + .withContent(BytesReference.bytes(content), XContentType.JSON) + .build(); + + performRequest(request); + assertWarnings(RestTermVectorsAction.TYPES_DEPRECATION_MESSAGE); + } + + private void performRequest(RestRequest request) { + RestChannel channel = new FakeRestChannel(request, false, 1); + ThreadContext threadContext = new ThreadContext(Settings.EMPTY); + controller.dispatchRequest(request, channel, threadContext); + } +} diff --git a/server/src/test/java/org/elasticsearch/rest/action/document/RestTermVectorsActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/document/RestTermVectorsActionTests.java new file mode 100644 index 00000000000..80850c5377b --- /dev/null +++ b/server/src/test/java/org/elasticsearch/rest/action/document/RestTermVectorsActionTests.java @@ -0,0 +1,87 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.elasticsearch.rest.action.document; + +import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.bytes.BytesReference; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.concurrent.ThreadContext; +import org.elasticsearch.common.xcontent.XContentBuilder; +import org.elasticsearch.common.xcontent.XContentFactory; +import org.elasticsearch.common.xcontent.XContentType; +import org.elasticsearch.indices.breaker.NoneCircuitBreakerService; +import org.elasticsearch.rest.RestChannel; +import org.elasticsearch.rest.RestController; +import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.RestRequest.Method; +import org.elasticsearch.test.ESTestCase; +import org.elasticsearch.test.rest.FakeRestChannel; +import org.elasticsearch.test.rest.FakeRestRequest; +import org.elasticsearch.usage.UsageService; + +import java.io.IOException; +import java.util.Collections; + +import static org.mockito.Mockito.mock; + +public class RestTermVectorsActionTests extends ESTestCase { + private RestController controller; + + public void setUp() throws Exception { + super.setUp(); + controller = new RestController(Collections.emptySet(), null, + mock(NodeClient.class), + new NoneCircuitBreakerService(), + new UsageService()); + new RestTermVectorsAction(Settings.EMPTY, controller); + } + + public void testTypeInPath() { + RestRequest request = new FakeRestRequest.Builder(xContentRegistry()) + .withMethod(Method.POST) + .withPath("/some_index/some_type/some_id/_termvectors") + .build(); + + performRequest(request); + assertWarnings(RestTermVectorsAction.TYPES_DEPRECATION_MESSAGE); + } + + public void testTypeInBody() throws IOException { + XContentBuilder content = XContentFactory.jsonBuilder().startObject() + .field("_type", "some_type") + .field("_id", 1) + .endObject(); + + RestRequest request = new FakeRestRequest.Builder(xContentRegistry()) + .withMethod(Method.GET) + .withPath("/some_index/_termvectors/some_id") + .withContent(BytesReference.bytes(content), XContentType.JSON) + .build(); + + performRequest(request); + assertWarnings(RestTermVectorsAction.TYPES_DEPRECATION_MESSAGE); + } + + private void performRequest(RestRequest request) { + RestChannel channel = new FakeRestChannel(request, false, 1); + ThreadContext threadContext = new ThreadContext(Settings.EMPTY); + controller.dispatchRequest(request, channel, threadContext); + } +} diff --git a/server/src/test/java/org/elasticsearch/search/MultiValueModeTests.java b/server/src/test/java/org/elasticsearch/search/MultiValueModeTests.java index 5cfee0a0213..cd75f3695cb 100644 --- a/server/src/test/java/org/elasticsearch/search/MultiValueModeTests.java +++ b/server/src/test/java/org/elasticsearch/search/MultiValueModeTests.java @@ -92,15 +92,18 @@ public class MultiValueModeTests extends ESTestCase { final Supplier multiValues = () -> DocValues.singleton(new AbstractNumericDocValues() { int docId = -1; + @Override public boolean advanceExact(int target) throws IOException { this.docId = target; return docsWithValue == null ? true : docsWithValue.get(docId); } + @Override public int docID() { return docId; } + @Override public long longValue() { return array[docId]; @@ -113,7 +116,7 @@ public class MultiValueModeTests extends ESTestCase { verifySortedNumeric(multiValues, numDocs, rootDocs, innerDocs, randomIntBetween(1, numDocs)); } - public void testMultiValuedLongs() throws Exception { + public void testMultiValuedLongs() throws Exception { final int numDocs = scaledRandomIntBetween(1, 100); final long[][] array = new long[numDocs][]; for (int i = 0; i < numDocs; ++i) { @@ -163,7 +166,6 @@ public class MultiValueModeTests extends ESTestCase { verifyLongValueCanCalledMoreThanOnce(selected, actual); } - Long expected = null; if (values.advanceExact(i)) { int numValues = values.docValueCount(); @@ -184,14 +186,14 @@ public class MultiValueModeTests extends ESTestCase { } } if (mode == MultiValueMode.AVG) { - expected = numValues > 1 ? Math.round((double)expected/(double)numValues) : expected; + expected = numValues > 1 ? Math.round((double) expected / (double) numValues) : expected; } else if (mode == MultiValueMode.MEDIAN) { - int value = numValues/2; + int value = numValues / 2; if (numValues % 2 == 0) { for (int j = 0; j < value - 1; ++j) { values.nextValue(); } - expected = Math.round(((double) values.nextValue() + values.nextValue())/2.0); + expected = Math.round(((double) values.nextValue() + values.nextValue()) / 2.0); } else { for (int j = 0; j < value; ++j) { values.nextValue(); @@ -212,11 +214,14 @@ public class MultiValueModeTests extends ESTestCase { } } - private void verifySortedNumeric(Supplier supplier, int maxDoc, FixedBitSet rootDocs, FixedBitSet innerDocs, int maxChildren) throws IOException { + private void verifySortedNumeric(Supplier supplier, int maxDoc, FixedBitSet rootDocs, FixedBitSet innerDocs, + int maxChildren) throws IOException { for (long missingValue : new long[] { 0, randomLong() }) { - for (MultiValueMode mode : new MultiValueMode[] {MultiValueMode.MIN, MultiValueMode.MAX, MultiValueMode.SUM, MultiValueMode.AVG}) { + for (MultiValueMode mode : new MultiValueMode[] { MultiValueMode.MIN, MultiValueMode.MAX, MultiValueMode.SUM, + MultiValueMode.AVG }) { SortedNumericDocValues values = supplier.get(); - final NumericDocValues selected = mode.select(values, missingValue, rootDocs, new BitSetIterator(innerDocs, 0L), maxDoc, maxChildren); + final NumericDocValues selected = mode.select(values, missingValue, rootDocs, new BitSetIterator(innerDocs, 0L), maxDoc, + maxChildren); int prevRoot = -1; for (int root = rootDocs.nextSetBit(0); root != -1; root = root + 1 < maxDoc ? rootDocs.nextSetBit(root + 1) : -1) { assertTrue(selected.advanceExact(root)); @@ -231,7 +236,8 @@ public class MultiValueModeTests extends ESTestCase { } int numValues = 0; int count = 0; - for (int child = innerDocs.nextSetBit(prevRoot + 1); child != -1 && child < root; child = innerDocs.nextSetBit(child + 1)) { + for (int child = innerDocs.nextSetBit(prevRoot + 1); child != -1 + && child < root; child = innerDocs.nextSetBit(child + 1)) { if (values.advanceExact(child)) { if (++count > maxChildren) { break; @@ -262,7 +268,7 @@ public class MultiValueModeTests extends ESTestCase { } } - public void testSingleValuedDoubles() throws Exception { + public void testSingleValuedDoubles() throws Exception { final int numDocs = scaledRandomIntBetween(1, 100); final double[] array = new double[numDocs]; final FixedBitSet docsWithValue = randomBoolean() ? null : new FixedBitSet(numDocs); @@ -278,11 +284,13 @@ public class MultiValueModeTests extends ESTestCase { } final Supplier multiValues = () -> FieldData.singleton(new NumericDoubleValues() { int docID; + @Override public boolean advanceExact(int doc) throws IOException { docID = doc; return docsWithValue == null || docsWithValue.get(doc); } + @Override public double doubleValue() { return array[docID]; @@ -295,7 +303,7 @@ public class MultiValueModeTests extends ESTestCase { verifySortedNumericDouble(multiValues, numDocs, rootDocs, innerDocs, randomIntBetween(1, numDocs)); } - public void testMultiValuedDoubles() throws Exception { + public void testMultiValuedDoubles() throws Exception { final int numDocs = scaledRandomIntBetween(1, 100); final double[][] array = new double[numDocs][]; for (int i = 0; i < numDocs; ++i) { @@ -365,14 +373,14 @@ public class MultiValueModeTests extends ESTestCase { } } if (mode == MultiValueMode.AVG) { - expected = expected/numValues; + expected = expected / numValues; } else if (mode == MultiValueMode.MEDIAN) { - int value = numValues/2; + int value = numValues / 2; if (numValues % 2 == 0) { for (int j = 0; j < value - 1; ++j) { values.nextValue(); } - expected = (values.nextValue() + values.nextValue())/2.0; + expected = (values.nextValue() + values.nextValue()) / 2.0; } else { for (int j = 0; j < value; ++j) { values.nextValue(); @@ -393,11 +401,14 @@ public class MultiValueModeTests extends ESTestCase { } } - private void verifySortedNumericDouble(Supplier supplier, int maxDoc, FixedBitSet rootDocs, FixedBitSet innerDocs, int maxChildren) throws IOException { + private void verifySortedNumericDouble(Supplier supplier, int maxDoc, FixedBitSet rootDocs, + FixedBitSet innerDocs, int maxChildren) throws IOException { for (long missingValue : new long[] { 0, randomLong() }) { - for (MultiValueMode mode : new MultiValueMode[] {MultiValueMode.MIN, MultiValueMode.MAX, MultiValueMode.SUM, MultiValueMode.AVG}) { + for (MultiValueMode mode : new MultiValueMode[] { MultiValueMode.MIN, MultiValueMode.MAX, MultiValueMode.SUM, + MultiValueMode.AVG }) { SortedNumericDoubleValues values = supplier.get(); - final NumericDoubleValues selected = mode.select(values, missingValue, rootDocs, new BitSetIterator(innerDocs, 0L), maxDoc, maxChildren); + final NumericDoubleValues selected = mode.select(values, missingValue, rootDocs, new BitSetIterator(innerDocs, 0L), maxDoc, + maxChildren); int prevRoot = -1; for (int root = rootDocs.nextSetBit(0); root != -1; root = root + 1 < maxDoc ? rootDocs.nextSetBit(root + 1) : -1) { assertTrue(selected.advanceExact(root)); @@ -412,7 +423,8 @@ public class MultiValueModeTests extends ESTestCase { } int numValues = 0; int count = 0; - for (int child = innerDocs.nextSetBit(prevRoot + 1); child != -1 && child < root; child = innerDocs.nextSetBit(child + 1)) { + for (int child = innerDocs.nextSetBit(prevRoot + 1); child != -1 + && child < root; child = innerDocs.nextSetBit(child + 1)) { if (values.advanceExact(child)) { if (++count > maxChildren) { break; @@ -432,7 +444,7 @@ public class MultiValueModeTests extends ESTestCase { if (numValues == 0) { expected = missingValue; } else if (mode == MultiValueMode.AVG) { - expected = expected/numValues; + expected = expected / numValues; } assertEquals(mode.toString() + " docId=" + root, expected, actual, 0.1); @@ -443,7 +455,7 @@ public class MultiValueModeTests extends ESTestCase { } } - public void testSingleValuedStrings() throws Exception { + public void testSingleValuedStrings() throws Exception { final int numDocs = scaledRandomIntBetween(1, 100); final BytesRef[] array = new BytesRef[numDocs]; final FixedBitSet docsWithValue = randomBoolean() ? null : new FixedBitSet(numDocs); @@ -462,11 +474,13 @@ public class MultiValueModeTests extends ESTestCase { } final Supplier multiValues = () -> FieldData.singleton(new AbstractBinaryDocValues() { int docID; + @Override public boolean advanceExact(int target) throws IOException { docID = target; return docsWithValue == null || docsWithValue.get(docID); } + @Override public BytesRef binaryValue() { return BytesRef.deepCopyOf(array[docID]); @@ -479,7 +493,7 @@ public class MultiValueModeTests extends ESTestCase { verifySortedBinary(multiValues, numDocs, rootDocs, innerDocs, randomIntBetween(1, numDocs)); } - public void testMultiValuedStrings() throws Exception { + public void testMultiValuedStrings() throws Exception { final int numDocs = scaledRandomIntBetween(1, 100); final BytesRef[][] array = new BytesRef[numDocs][]; for (int i = 0; i < numDocs; ++i) { @@ -520,7 +534,7 @@ public class MultiValueModeTests extends ESTestCase { private void verifySortedBinary(Supplier supplier, int maxDoc) throws IOException { for (BytesRef missingValue : new BytesRef[] { new BytesRef(), new BytesRef(randomAlphaOfLengthBetween(8, 8)) }) { - for (MultiValueMode mode : new MultiValueMode[] {MultiValueMode.MIN, MultiValueMode.MAX}) { + for (MultiValueMode mode : new MultiValueMode[] { MultiValueMode.MIN, MultiValueMode.MAX }) { SortedBinaryDocValues values = supplier.get(); final BinaryDocValues selected = mode.select(values, missingValue); for (int i = 0; i < maxDoc; ++i) { @@ -562,11 +576,13 @@ public class MultiValueModeTests extends ESTestCase { } } - private void verifySortedBinary(Supplier supplier, int maxDoc, FixedBitSet rootDocs, FixedBitSet innerDocs, int maxChildren) throws IOException { + private void verifySortedBinary(Supplier supplier, int maxDoc, FixedBitSet rootDocs, FixedBitSet innerDocs, + int maxChildren) throws IOException { for (BytesRef missingValue : new BytesRef[] { new BytesRef(), new BytesRef(randomAlphaOfLengthBetween(8, 8)) }) { - for (MultiValueMode mode : new MultiValueMode[] {MultiValueMode.MIN, MultiValueMode.MAX}) { + for (MultiValueMode mode : new MultiValueMode[] { MultiValueMode.MIN, MultiValueMode.MAX }) { SortedBinaryDocValues values = supplier.get(); - final BinaryDocValues selected = mode.select(values, missingValue, rootDocs, new BitSetIterator(innerDocs, 0L), maxDoc, maxChildren); + final BinaryDocValues selected = mode.select(values, missingValue, rootDocs, new BitSetIterator(innerDocs, 0L), maxDoc, + maxChildren); int prevRoot = -1; for (int root = rootDocs.nextSetBit(0); root != -1; root = root + 1 < maxDoc ? rootDocs.nextSetBit(root + 1) : -1) { assertTrue(selected.advanceExact(root)); @@ -575,7 +591,8 @@ public class MultiValueModeTests extends ESTestCase { BytesRef expected = null; int count = 0; - for (int child = innerDocs.nextSetBit(prevRoot + 1); child != -1 && child < root; child = innerDocs.nextSetBit(child + 1)) { + for (int child = innerDocs.nextSetBit(prevRoot + 1); child != -1 + && child < root; child = innerDocs.nextSetBit(child + 1)) { if (values.advanceExact(child)) { if (++count > maxChildren) { break; @@ -606,8 +623,7 @@ public class MultiValueModeTests extends ESTestCase { } } - - public void testSingleValuedOrds() throws Exception { + public void testSingleValuedOrds() throws Exception { final int numDocs = scaledRandomIntBetween(1, 100); final int[] array = new int[numDocs]; for (int i = 0; i < array.length; ++i) { @@ -619,6 +635,7 @@ public class MultiValueModeTests extends ESTestCase { } final Supplier multiValues = () -> DocValues.singleton(new AbstractSortedDocValues() { private int docID = -1; + @Override public boolean advanceExact(int target) throws IOException { docID = target; @@ -652,7 +669,7 @@ public class MultiValueModeTests extends ESTestCase { verifySortedSet(multiValues, numDocs, rootDocs, innerDocs, randomIntBetween(1, numDocs)); } - public void testMultiValuedOrds() throws Exception { + public void testMultiValuedOrds() throws Exception { final int numDocs = scaledRandomIntBetween(1, 100); final long[][] array = new long[numDocs][]; for (int i = 0; i < numDocs; ++i) { @@ -700,7 +717,7 @@ public class MultiValueModeTests extends ESTestCase { } private void verifySortedSet(Supplier supplier, int maxDoc) throws IOException { - for (MultiValueMode mode : new MultiValueMode[] {MultiValueMode.MIN, MultiValueMode.MAX}) { + for (MultiValueMode mode : new MultiValueMode[] { MultiValueMode.MIN, MultiValueMode.MAX }) { SortedSetDocValues values = supplier.get(); final SortedDocValues selected = mode.select(values); for (int i = 0; i < maxDoc; ++i) { @@ -735,8 +752,9 @@ public class MultiValueModeTests extends ESTestCase { } } - private void verifySortedSet(Supplier supplier, int maxDoc, FixedBitSet rootDocs, FixedBitSet innerDocs, int maxChildren) throws IOException { - for (MultiValueMode mode : new MultiValueMode[] {MultiValueMode.MIN, MultiValueMode.MAX}) { + private void verifySortedSet(Supplier supplier, int maxDoc, FixedBitSet rootDocs, FixedBitSet innerDocs, + int maxChildren) throws IOException { + for (MultiValueMode mode : new MultiValueMode[] { MultiValueMode.MIN, MultiValueMode.MAX }) { SortedSetDocValues values = supplier.get(); final SortedDocValues selected = mode.select(values, rootDocs, new BitSetIterator(innerDocs, 0L), maxChildren); int prevRoot = -1; diff --git a/server/src/test/java/org/elasticsearch/search/SearchTimeoutIT.java b/server/src/test/java/org/elasticsearch/search/SearchTimeoutIT.java index 762a22c823f..0d48135ac00 100644 --- a/server/src/test/java/org/elasticsearch/search/SearchTimeoutIT.java +++ b/server/src/test/java/org/elasticsearch/search/SearchTimeoutIT.java @@ -63,7 +63,7 @@ public class SearchTimeoutIT extends ESIntegTestCase { .setQuery(scriptQuery( new Script(ScriptType.INLINE, "mockscript", SCRIPT_NAME, Collections.emptyMap()))) .setAllowPartialSearchResults(true) - .execute().actionGet(); + .get(); assertThat(searchResponse.isTimedOut(), equalTo(true)); } @@ -75,7 +75,7 @@ public class SearchTimeoutIT extends ESIntegTestCase { .setQuery(scriptQuery( new Script(ScriptType.INLINE, "mockscript", SCRIPT_NAME, Collections.emptyMap()))) .setAllowPartialSearchResults(false) // this line causes timeouts to report failures - .execute().actionGet() + .get() ); assertTrue(ex.toString().contains("Time exceeded")); } diff --git a/server/src/test/java/org/elasticsearch/search/SearchWithRejectionsIT.java b/server/src/test/java/org/elasticsearch/search/SearchWithRejectionsIT.java index 9f0c9ca97ea..817e922da0c 100644 --- a/server/src/test/java/org/elasticsearch/search/SearchWithRejectionsIT.java +++ b/server/src/test/java/org/elasticsearch/search/SearchWithRejectionsIT.java @@ -46,9 +46,9 @@ public class SearchWithRejectionsIT extends ESIntegTestCase { ensureGreen("test"); final int docs = scaledRandomIntBetween(20, 50); for (int i = 0; i < docs; i++) { - client().prepareIndex("test", "type", Integer.toString(i)).setSource("field", "value").execute().actionGet(); + client().prepareIndex("test", "type", Integer.toString(i)).setSource("field", "value").get(); } - IndicesStatsResponse indicesStats = client().admin().indices().prepareStats().execute().actionGet(); + IndicesStatsResponse indicesStats = client().admin().indices().prepareStats().get(); assertThat(indicesStats.getTotal().getSearch().getOpenContexts(), equalTo(0L)); refresh(); @@ -68,8 +68,10 @@ public class SearchWithRejectionsIT extends ESIntegTestCase { } catch (Exception t) { } } - awaitBusy(() -> client().admin().indices().prepareStats().execute().actionGet().getTotal().getSearch().getOpenContexts() == 0, 1, TimeUnit.SECONDS); - indicesStats = client().admin().indices().prepareStats().execute().actionGet(); + awaitBusy( + () -> client().admin().indices().prepareStats().get().getTotal().getSearch().getOpenContexts() == 0, + 1, TimeUnit.SECONDS); + indicesStats = client().admin().indices().prepareStats().get(); assertThat(indicesStats.getTotal().getSearch().getOpenContexts(), equalTo(0L)); } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/AggregationsIntegrationIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/AggregationsIntegrationIT.java index 6ab53d6a62f..1aabeb60af3 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/AggregationsIntegrationIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/AggregationsIntegrationIT.java @@ -64,7 +64,7 @@ public class AggregationsIntegrationIT extends ESIntegTestCase { while (response.getHits().getHits().length > 0) { response = client().prepareSearchScroll(response.getScrollId()) .setScroll(TimeValue.timeValueMinutes(1)) - .execute().actionGet(); + .get(); assertSearchResponse(response); assertNull(response.getAggregations()); total += response.getHits().getHits().length; diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/CombiIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/CombiIT.java index 0992fcdfae1..4e2394ac458 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/CombiIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/CombiIT.java @@ -83,7 +83,7 @@ public class CombiIT extends ESIntegTestCase { .addAggregation(missing("missing_values").field("value")) .addAggregation(terms("values").field("value") .collectMode(aggCollectionMode )) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -117,7 +117,7 @@ public class CombiIT extends ESIntegTestCase { .startObject("name").field("type", "keyword").endObject() .startObject("value").field("type", "integer").endObject() .endObject().endObject() - .endObject()).execute().actionGet(); + .endObject()).get(); ensureSearchable("idx"); @@ -126,7 +126,7 @@ public class CombiIT extends ESIntegTestCase { .addAggregation(histogram("values").field("value1").interval(1) .subAggregation(terms("names").field("name") .collectMode(aggCollectionMode ))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, Matchers.equalTo(0L)); Histogram values = searchResponse.getAggregations().get("values"); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/EquivalenceIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/EquivalenceIT.java index 2a70646a401..d7500f15b78 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/EquivalenceIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/EquivalenceIT.java @@ -130,7 +130,7 @@ public class EquivalenceIT extends ESIntegTestCase { .endObject() .endObject() .endObject() - .endObject()).execute().actionGet(); + .endObject()).get(); for (int i = 0; i < docs.length; ++i) { XContentBuilder source = jsonBuilder() @@ -140,7 +140,7 @@ public class EquivalenceIT extends ESIntegTestCase { source = source.value(docs[i][j]); } source = source.endArray().endObject(); - client().prepareIndex("idx", "type").setSource(source).execute().actionGet(); + client().prepareIndex("idx", "type").setSource(source).get(); } assertNoFailures(client().admin().indices().prepareRefresh("idx"). setIndicesOptions(IndicesOptions.lenientExpandOpen()) @@ -188,7 +188,7 @@ public class EquivalenceIT extends ESIntegTestCase { reqBuilder = reqBuilder.addAggregation(filter("filter" + i, filter)); } - SearchResponse resp = reqBuilder.execute().actionGet(); + SearchResponse resp = reqBuilder.get(); Range range = resp.getAggregations().get("range"); List buckets = range.getBuckets(); @@ -250,7 +250,7 @@ public class EquivalenceIT extends ESIntegTestCase { .endObject() .endObject() .endObject() - .endObject()).execute().actionGet(); + .endObject()).get(); List indexingRequests = new ArrayList<>(); for (int i = 0; i < numDocs; ++i) { @@ -317,7 +317,7 @@ public class EquivalenceIT extends ESIntegTestCase { .executionHint(TermsAggregatorFactory.ExecutionMode.GLOBAL_ORDINALS.toString()) .size(maxNumTerms) .subAggregation(extendedStats("stats").field("num"))) - .execute().actionGet(); + .get(); assertAllSuccessful(resp); assertEquals(numDocs, resp.getHits().getTotalHits().value); @@ -360,7 +360,7 @@ public class EquivalenceIT extends ESIntegTestCase { .endObject() .endObject() .endObject() - .endObject()).execute().actionGet(); + .endObject()).get(); final int numDocs = scaledRandomIntBetween(500, 5000); @@ -382,7 +382,7 @@ public class EquivalenceIT extends ESIntegTestCase { source = source.value(randomFrom(values)); } source = source.endArray().endObject(); - client().prepareIndex("idx", "type").setSource(source).execute().actionGet(); + client().prepareIndex("idx", "type").setSource(source).get(); } assertNoFailures(client().admin().indices().prepareRefresh("idx") .setIndicesOptions(IndicesOptions.lenientExpandOpen()) @@ -403,7 +403,7 @@ public class EquivalenceIT extends ESIntegTestCase { .field("values") .interval(interval) .minDocCount(1)) - .execute().actionGet(); + .get(); assertSearchResponse(resp); @@ -431,7 +431,7 @@ public class EquivalenceIT extends ESIntegTestCase { .endObject() .endObject() .endObject() - .endObject()).execute().actionGet(); + .endObject()).get(); final int numDocs = scaledRandomIntBetween(2500, 5000); logger.info("Indexing [{}] docs", numDocs); @@ -447,7 +447,7 @@ public class EquivalenceIT extends ESIntegTestCase { .field("double_value") .collectMode(randomFrom(SubAggCollectionMode.values())) .subAggregation(percentiles("pcts").field("double_value"))) - .execute().actionGet(); + .get(); assertAllSuccessful(response); assertEquals(numDocs, response.getHits().getTotalHits().value); } @@ -464,7 +464,7 @@ public class EquivalenceIT extends ESIntegTestCase { .addUnboundedTo(6) .addUnboundedFrom(6) .subAggregation(sum("sum").field("f")))) - .execute().actionGet(); + .get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/MetaDataIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/MetaDataIT.java index 93d966d0a4c..9434e3b745f 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/MetaDataIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/MetaDataIT.java @@ -78,7 +78,7 @@ public class MetaDataIT extends ESIntegTestCase { ) ) .addAggregation(maxBucket("the_max_bucket", "the_terms>the_sum").setMetaData(metaData)) - .execute().actionGet(); + .get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/MissingValueIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/MissingValueIT.java index 2fdacd63d3d..40ac3e49f3a 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/MissingValueIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/MissingValueIT.java @@ -54,14 +54,17 @@ public class MissingValueIT extends ESIntegTestCase { @Override protected void setupSuiteScopeCluster() throws Exception { - assertAcked(prepareCreate("idx").addMapping("type", "date", "type=date", "location", "type=geo_point", "str", "type=keyword").get()); + assertAcked(prepareCreate("idx") + .addMapping("type", "date", "type=date", "location", "type=geo_point", "str", "type=keyword").get()); indexRandom(true, client().prepareIndex("idx", "type", "1").setSource(), - client().prepareIndex("idx", "type", "2").setSource("str", "foo", "long", 3L, "double", 5.5, "date", "2015-05-07", "location", "1,2")); + client().prepareIndex("idx", "type", "2") + .setSource("str", "foo", "long", 3L, "double", 5.5, "date", "2015-05-07", "location", "1,2")); } public void testUnmappedTerms() { - SearchResponse response = client().prepareSearch("idx").addAggregation(terms("my_terms").field("non_existing_field").missing("bar")).get(); + SearchResponse response = client().prepareSearch("idx") + .addAggregation(terms("my_terms").field("non_existing_field").missing("bar")).get(); assertSearchResponse(response); Terms terms = response.getAggregations().get("my_terms"); assertEquals(1, terms.getBuckets().size()); @@ -90,14 +93,16 @@ public class MissingValueIT extends ESIntegTestCase { } public void testLongTerms() { - SearchResponse response = client().prepareSearch("idx").addAggregation(terms("my_terms").field("long").missing(4)).get(); + SearchResponse response = client().prepareSearch("idx") + .addAggregation(terms("my_terms").field("long").missing(4)).get(); assertSearchResponse(response); Terms terms = response.getAggregations().get("my_terms"); assertEquals(2, terms.getBuckets().size()); assertEquals(1, terms.getBucketByKey("3").getDocCount()); assertEquals(1, terms.getBucketByKey("4").getDocCount()); - response = client().prepareSearch("idx").addAggregation(terms("my_terms").field("long").missing(3)).get(); + response = client().prepareSearch("idx") + .addAggregation(terms("my_terms").field("long").missing(3)).get(); assertSearchResponse(response); terms = response.getAggregations().get("my_terms"); assertEquals(1, terms.getBuckets().size()); @@ -105,7 +110,8 @@ public class MissingValueIT extends ESIntegTestCase { } public void testDoubleTerms() { - SearchResponse response = client().prepareSearch("idx").addAggregation(terms("my_terms").field("double").missing(4.5)).get(); + SearchResponse response = client().prepareSearch("idx") + .addAggregation(terms("my_terms").field("double").missing(4.5)).get(); assertSearchResponse(response); Terms terms = response.getAggregations().get("my_terms"); assertEquals(2, terms.getBuckets().size()); @@ -120,7 +126,8 @@ public class MissingValueIT extends ESIntegTestCase { } public void testUnmappedHistogram() { - SearchResponse response = client().prepareSearch("idx").addAggregation(histogram("my_histogram").field("non-existing_field").interval(5).missing(12)).get(); + SearchResponse response = client().prepareSearch("idx") + .addAggregation(histogram("my_histogram").field("non-existing_field").interval(5).missing(12)).get(); assertSearchResponse(response); Histogram histogram = response.getAggregations().get("my_histogram"); assertEquals(1, histogram.getBuckets().size()); @@ -129,7 +136,8 @@ public class MissingValueIT extends ESIntegTestCase { } public void testHistogram() { - SearchResponse response = client().prepareSearch("idx").addAggregation(histogram("my_histogram").field("long").interval(5).missing(7)).get(); + SearchResponse response = client().prepareSearch("idx") + .addAggregation(histogram("my_histogram").field("long").interval(5).missing(7)).get(); assertSearchResponse(response); Histogram histogram = response.getAggregations().get("my_histogram"); assertEquals(2, histogram.getBuckets().size()); @@ -138,7 +146,8 @@ public class MissingValueIT extends ESIntegTestCase { assertEquals(5d, histogram.getBuckets().get(1).getKey()); assertEquals(1, histogram.getBuckets().get(1).getDocCount()); - response = client().prepareSearch("idx").addAggregation(histogram("my_histogram").field("long").interval(5).missing(3)).get(); + response = client().prepareSearch("idx") + .addAggregation(histogram("my_histogram").field("long").interval(5).missing(3)).get(); assertSearchResponse(response); histogram = response.getAggregations().get("my_histogram"); assertEquals(1, histogram.getBuckets().size()); @@ -171,21 +180,24 @@ public class MissingValueIT extends ESIntegTestCase { } public void testCardinality() { - SearchResponse response = client().prepareSearch("idx").addAggregation(cardinality("card").field("long").missing(2)).get(); + SearchResponse response = client().prepareSearch("idx") + .addAggregation(cardinality("card").field("long").missing(2)).get(); assertSearchResponse(response); Cardinality cardinality = response.getAggregations().get("card"); assertEquals(2, cardinality.getValue()); } public void testPercentiles() { - SearchResponse response = client().prepareSearch("idx").addAggregation(percentiles("percentiles").field("long").missing(1000)).get(); + SearchResponse response = client().prepareSearch("idx") + .addAggregation(percentiles("percentiles").field("long").missing(1000)).get(); assertSearchResponse(response); Percentiles percentiles = response.getAggregations().get("percentiles"); assertEquals(1000, percentiles.percentile(100), 0); } public void testStats() { - SearchResponse response = client().prepareSearch("idx").addAggregation(stats("stats").field("long").missing(5)).get(); + SearchResponse response = client().prepareSearch("idx") + .addAggregation(stats("stats").field("long").missing(5)).get(); assertSearchResponse(response); Stats stats = response.getAggregations().get("stats"); assertEquals(2, stats.getCount()); @@ -193,7 +205,8 @@ public class MissingValueIT extends ESIntegTestCase { } public void testUnmappedGeoBounds() { - SearchResponse response = client().prepareSearch("idx").addAggregation(geoBounds("bounds").field("non_existing_field").missing("2,1")).get(); + SearchResponse response = client().prepareSearch("idx") + .addAggregation(geoBounds("bounds").field("non_existing_field").missing("2,1")).get(); assertSearchResponse(response); GeoBounds bounds = response.getAggregations().get("bounds"); assertThat(bounds.bottomRight().lat(), closeTo(2.0, 1E-5)); @@ -203,7 +216,8 @@ public class MissingValueIT extends ESIntegTestCase { } public void testGeoBounds() { - SearchResponse response = client().prepareSearch("idx").addAggregation(geoBounds("bounds").field("location").missing("2,1")).get(); + SearchResponse response = client().prepareSearch("idx") + .addAggregation(geoBounds("bounds").field("location").missing("2,1")).get(); assertSearchResponse(response); GeoBounds bounds = response.getAggregations().get("bounds"); assertThat(bounds.bottomRight().lat(), closeTo(1.0, 1E-5)); @@ -213,7 +227,8 @@ public class MissingValueIT extends ESIntegTestCase { } public void testGeoCentroid() { - SearchResponse response = client().prepareSearch("idx").addAggregation(geoCentroid("centroid").field("location").missing("2,1")).get(); + SearchResponse response = client().prepareSearch("idx") + .addAggregation(geoCentroid("centroid").field("location").missing("2,1")).get(); assertSearchResponse(response); GeoCentroid centroid = response.getAggregations().get("centroid"); GeoPoint point = new GeoPoint(1.5, 1.5); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/AdjacencyMatrixIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/AdjacencyMatrixIT.java index 47ce018ddfd..75fed841f7e 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/AdjacencyMatrixIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/AdjacencyMatrixIT.java @@ -101,7 +101,7 @@ public class AdjacencyMatrixIT extends ESIntegTestCase { builders.add(client().prepareIndex("idx", "type", "" + i).setSource(source)); } } - prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").execute().actionGet(); + prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").get(); for (int i = 0; i < 2; i++) { builders.add(client().prepareIndex("empty_bucket_idx", "type", "" + i) .setSource(jsonBuilder().startObject().field("value", i * 2).endObject())); @@ -114,7 +114,7 @@ public class AdjacencyMatrixIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(adjacencyMatrix("tags", newMap("tag1", termQuery("tag", "tag1")).add("tag2", termQuery("tag", "tag2")))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -147,7 +147,7 @@ public class AdjacencyMatrixIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(adjacencyMatrix("tags", "\t", newMap("tag1", termQuery("tag", "tag1")).add("tag2", termQuery("tag", "tag2")))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -172,7 +172,7 @@ public class AdjacencyMatrixIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(adjacencyMatrix("tags", newMap("all", emptyFilter).add("tag1", termQuery("tag", "tag1")))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -197,7 +197,7 @@ public class AdjacencyMatrixIT extends ESIntegTestCase { .add("tag2", termQuery("tag", "tag2")) .add("both", boolQ)) .subAggregation(avg("avg_value").field("value"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -309,7 +309,7 @@ public class AdjacencyMatrixIT extends ESIntegTestCase { try { client().prepareSearch("idx") .addAggregation(adjacencyMatrix("tags", "\t", filtersMap)) - .execute().actionGet(); + .get(); fail("SearchPhaseExecutionException should have been thrown"); } catch (SearchPhaseExecutionException ex) { assertThat(ex.getCause().getMessage(), containsString("Number of filters is too large")); @@ -342,7 +342,7 @@ public class AdjacencyMatrixIT extends ESIntegTestCase { .addAggregation(adjacencyMatrix("tags", newMap("tag1", termQuery("tag", "tag1")).add("tag2", termQuery("tag", "tag2"))) .subAggregation(avg("avg_value"))) - .execute().actionGet(); + .get(); fail("expected execution to fail - an attempt to have a context based numeric sub-aggregation, but there is not value source" + "context which the sub-aggregation can inherit"); @@ -356,7 +356,7 @@ public class AdjacencyMatrixIT extends ESIntegTestCase { SearchResponse searchResponse = client() .prepareSearch("empty_bucket_idx").setQuery(matchAllQuery()).addAggregation(histogram("histo").field("value").interval(1L) .minDocCount(0).subAggregation(adjacencyMatrix("matrix", newMap("all", matchAllQuery())))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/BooleanTermsIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/BooleanTermsIT.java index da70bbe4407..8cbdcc41a98 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/BooleanTermsIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/BooleanTermsIT.java @@ -87,7 +87,7 @@ public class BooleanTermsIT extends ESIntegTestCase { .addAggregation(terms("terms") .field(SINGLE_VALUED_FIELD_NAME) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -121,7 +121,7 @@ public class BooleanTermsIT extends ESIntegTestCase { .addAggregation(terms("terms") .field(MULTI_VALUED_FIELD_NAME) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -156,7 +156,7 @@ public class BooleanTermsIT extends ESIntegTestCase { .field(SINGLE_VALUED_FIELD_NAME) .size(between(1, 5)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramIT.java index 73983a7ca09..6363560cecc 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramIT.java @@ -204,7 +204,7 @@ public class DateHistogramIT extends ESIntegTestCase { public void testSingleValuedField() throws Exception { SearchResponse response = client().prepareSearch("idx") .addAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.MONTH)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -238,8 +238,10 @@ public class DateHistogramIT extends ESIntegTestCase { public void testSingleValuedFieldWithTimeZone() throws Exception { SearchResponse response = client().prepareSearch("idx") - .addAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(1).timeZone(DateTimeZone.forID("+01:00"))).execute() - .actionGet(); + .addAggregation(dateHistogram("histo").field("date") + .dateHistogramInterval(DateHistogramInterval.DAY) + .minDocCount(1) + .timeZone(DateTimeZone.forID("+01:00"))).get(); DateTimeZone tz = DateTimeZone.forID("+01:00"); assertSearchResponse(response); @@ -303,8 +305,7 @@ public class DateHistogramIT extends ESIntegTestCase { .addAggregation(dateHistogram("histo").field("date") .dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(1) .timeZone(tz).format(format)) - .execute() - .actionGet(); + .get(); assertSearchResponse(response); Histogram histo = response.getAggregations().get("histo"); @@ -338,7 +339,7 @@ public class DateHistogramIT extends ESIntegTestCase { .field("date") .dateHistogramInterval(DateHistogramInterval.MONTH) .order(BucketOrder.key(true))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -361,7 +362,7 @@ public class DateHistogramIT extends ESIntegTestCase { .field("date") .dateHistogramInterval(DateHistogramInterval.MONTH) .order(BucketOrder.key(false))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -383,7 +384,7 @@ public class DateHistogramIT extends ESIntegTestCase { .field("date") .dateHistogramInterval(DateHistogramInterval.MONTH) .order(BucketOrder.count(true))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -405,7 +406,7 @@ public class DateHistogramIT extends ESIntegTestCase { .field("date") .dateHistogramInterval(DateHistogramInterval.MONTH) .order(BucketOrder.count(false))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -425,7 +426,7 @@ public class DateHistogramIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.MONTH) .subAggregation(sum("sum").field("value"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -486,7 +487,7 @@ public class DateHistogramIT extends ESIntegTestCase { .dateHistogramInterval(DateHistogramInterval.MONTH) .order(BucketOrder.aggregation("sum", true)) .subAggregation(max("sum").field("value"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -509,7 +510,7 @@ public class DateHistogramIT extends ESIntegTestCase { .dateHistogramInterval(DateHistogramInterval.MONTH) .order(BucketOrder.aggregation("sum", false)) .subAggregation(max("sum").field("value"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -532,7 +533,7 @@ public class DateHistogramIT extends ESIntegTestCase { .dateHistogramInterval(DateHistogramInterval.MONTH) .order(BucketOrder.aggregation("stats", "sum", false)) .subAggregation(stats("stats").field("value"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -555,7 +556,7 @@ public class DateHistogramIT extends ESIntegTestCase { .dateHistogramInterval(DateHistogramInterval.MONTH) .order(BucketOrder.aggregation("max_constant", randomBoolean())) .subAggregation(max("max_constant").field("constant"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -584,7 +585,7 @@ public class DateHistogramIT extends ESIntegTestCase { .dateHistogramInterval(DateHistogramInterval.MONTH) .field("dates") .subAggregation(avg("avg").field("value")))) - .execute().actionGet(); + .get(); fail("Expected an exception"); } catch (SearchPhaseExecutionException e) { ElasticsearchException[] rootCauses = e.guessRootCauses(); @@ -609,7 +610,7 @@ public class DateHistogramIT extends ESIntegTestCase { .addAggregation(dateHistogram("histo") .field("date") .script(new Script(ScriptType.INLINE, "mockscript", DateScriptMocksPlugin.LONG_PLUS_ONE_MONTH, params)) - .dateHistogramInterval(DateHistogramInterval.MONTH)).execute().actionGet(); + .dateHistogramInterval(DateHistogramInterval.MONTH)).get(); assertSearchResponse(response); @@ -654,7 +655,7 @@ public class DateHistogramIT extends ESIntegTestCase { public void testMultiValuedField() throws Exception { SearchResponse response = client().prepareSearch("idx") .addAggregation(dateHistogram("histo").field("dates").dateHistogramInterval(DateHistogramInterval.MONTH)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -699,7 +700,7 @@ public class DateHistogramIT extends ESIntegTestCase { .field("dates") .dateHistogramInterval(DateHistogramInterval.MONTH) .order(BucketOrder.count(false))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -748,7 +749,7 @@ public class DateHistogramIT extends ESIntegTestCase { .addAggregation(dateHistogram("histo") .field("dates") .script(new Script(ScriptType.INLINE, "mockscript", DateScriptMocksPlugin.LONG_PLUS_ONE_MONTH, params)) - .dateHistogramInterval(DateHistogramInterval.MONTH)).execute().actionGet(); + .dateHistogramInterval(DateHistogramInterval.MONTH)).get(); assertSearchResponse(response); @@ -802,7 +803,7 @@ public class DateHistogramIT extends ESIntegTestCase { .addAggregation(dateHistogram("histo").script( new Script(ScriptType.INLINE, "mockscript", DateScriptMocksPlugin.EXTRACT_FIELD, params)) .dateHistogramInterval(DateHistogramInterval.MONTH)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -841,7 +842,7 @@ public class DateHistogramIT extends ESIntegTestCase { .addAggregation(dateHistogram("histo").script( new Script(ScriptType.INLINE, "mockscript", DateScriptMocksPlugin.EXTRACT_FIELD, params)) .dateHistogramInterval(DateHistogramInterval.MONTH)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -894,7 +895,7 @@ public class DateHistogramIT extends ESIntegTestCase { public void testUnmapped() throws Exception { SearchResponse response = client().prepareSearch("idx_unmapped") .addAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.MONTH)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -907,7 +908,7 @@ public class DateHistogramIT extends ESIntegTestCase { public void testPartiallyUnmapped() throws Exception { SearchResponse response = client().prepareSearch("idx", "idx_unmapped") .addAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.MONTH)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -944,7 +945,7 @@ public class DateHistogramIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .addAggregation(histogram("histo").field("value").interval(1L).minDocCount(0) .subAggregation(dateHistogram("date_histo").field("value").interval(1))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); @@ -964,11 +965,12 @@ public class DateHistogramIT extends ESIntegTestCase { } public void testSingleValueWithTimeZone() throws Exception { - prepareCreate("idx2").addMapping("type", "date", "type=date").execute().actionGet(); + prepareCreate("idx2").addMapping("type", "date", "type=date").get(); IndexRequestBuilder[] reqs = new IndexRequestBuilder[5]; DateTime date = date("2014-03-11T00:00:00+00:00"); for (int i = 0; i < reqs.length; i++) { - reqs[i] = client().prepareIndex("idx2", "type", "" + i).setSource(jsonBuilder().startObject().timeField("date", date).endObject()); + reqs[i] = client().prepareIndex("idx2", "type", "" + i) + .setSource(jsonBuilder().startObject().timeField("date", date).endObject()); date = date.plusHours(1); } indexRandom(true, reqs); @@ -980,7 +982,7 @@ public class DateHistogramIT extends ESIntegTestCase { .timeZone(DateTimeZone.forID("-02:00")) .dateHistogramInterval(DateHistogramInterval.DAY) .format("yyyy-MM-dd:HH-mm-ssZZ")) - .execute().actionGet(); + .get(); assertThat(response.getHits().getTotalHits().value, equalTo(5L)); @@ -1010,7 +1012,7 @@ public class DateHistogramIT extends ESIntegTestCase { prepareCreate("idx2") .setSettings( Settings.builder().put(indexSettings()).put("index.number_of_shards", 1) - .put("index.number_of_replicas", 0)).execute().actionGet(); + .put("index.number_of_replicas", 0)).get(); int numOfBuckets = randomIntBetween(3, 6); int emptyBucketIndex = randomIntBetween(1, numOfBuckets - 2); // should be in the middle @@ -1076,7 +1078,7 @@ public class DateHistogramIT extends ESIntegTestCase { // when explicitly specifying a format, the extended bounds should be defined by the same format .extendedBounds(new ExtendedBounds(format(boundsMin, pattern), format(boundsMax, pattern))) .format(pattern)) - .execute().actionGet(); + .get(); if (invalidBoundsError) { fail("Expected an exception to be thrown when bounds.min is greater than bounds.max"); @@ -1118,7 +1120,7 @@ public class DateHistogramIT extends ESIntegTestCase { String index = "test12278"; prepareCreate(index) .setSettings(Settings.builder().put(indexSettings()).put("index.number_of_shards", 1).put("index.number_of_replicas", 0)) - .execute().actionGet(); + .get(); DateMathParser parser = Joda.getStrictStandardDateFormatter().toDateMathParser(); @@ -1138,14 +1140,16 @@ public class DateHistogramIT extends ESIntegTestCase { // retrieve those docs with the same time zone and extended bounds response = client() .prepareSearch(index) - .setQuery(QueryBuilders.rangeQuery("date").from("now/d").to("now/d").includeLower(true).includeUpper(true).timeZone(timezone.getID())) + .setQuery(QueryBuilders.rangeQuery("date") + .from("now/d").to("now/d").includeLower(true).includeUpper(true).timeZone(timezone.getID())) .addAggregation( - dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.hours(1)).timeZone(timezone).minDocCount(0) - .extendedBounds(new ExtendedBounds("now/d", "now/d+23h")) - ).execute().actionGet(); + dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.hours(1)) + .timeZone(timezone).minDocCount(0).extendedBounds(new ExtendedBounds("now/d", "now/d+23h")) + ).get(); assertSearchResponse(response); - assertThat("Expected 24 buckets for one day aggregation with hourly interval", response.getHits().getTotalHits().value, equalTo(2L)); + assertThat("Expected 24 buckets for one day aggregation with hourly interval", response.getHits().getTotalHits().value, + equalTo(2L)); Histogram histo = response.getAggregations().get("histo"); assertThat(histo, notNullValue()); @@ -1156,7 +1160,8 @@ public class DateHistogramIT extends ESIntegTestCase { for (int i = 0; i < buckets.size(); i++) { Histogram.Bucket bucket = buckets.get(i); assertThat(bucket, notNullValue()); - assertThat("InternalBucket " + i + " had wrong key", (DateTime) bucket.getKey(), equalTo(new DateTime(timeZoneStartToday.getMillis() + (i * 60 * 60 * 1000), DateTimeZone.UTC))); + assertThat("InternalBucket " + i + " had wrong key", (DateTime) bucket.getKey(), + equalTo(new DateTime(timeZoneStartToday.getMillis() + (i * 60 * 60 * 1000), DateTimeZone.UTC))); if (i == 0 || i == 12) { assertThat(bucket.getDocCount(), equalTo(1L)); } else { @@ -1174,7 +1179,7 @@ public class DateHistogramIT extends ESIntegTestCase { String index = "test23776"; prepareCreate(index) .setSettings(Settings.builder().put(indexSettings()).put("index.number_of_shards", 1).put("index.number_of_replicas", 0)) - .execute().actionGet(); + .get(); List builders = new ArrayList<>(); builders.add(indexDoc(index, DateTime.parse("2016-01-03T08:00:00.000Z"), 1)); @@ -1189,9 +1194,10 @@ public class DateHistogramIT extends ESIntegTestCase { response = client() .prepareSearch(index) .addAggregation( - dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.days(1)).offset("+6h").minDocCount(0) + dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.days(1)) + .offset("+6h").minDocCount(0) .extendedBounds(new ExtendedBounds("2016-01-01T06:00:00Z", "2016-01-08T08:00:00Z")) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); Histogram histo = response.getAggregations().get("histo"); @@ -1221,11 +1227,15 @@ public class DateHistogramIT extends ESIntegTestCase { } public void testSingleValueWithMultipleDateFormatsFromMapping() throws Exception { - String mappingJson = Strings.toString(jsonBuilder().startObject().startObject("type").startObject("properties").startObject("date").field("type", "date").field("format", "dateOptionalTime||dd-MM-yyyy").endObject().endObject().endObject().endObject()); - prepareCreate("idx2").addMapping("type", mappingJson, XContentType.JSON).execute().actionGet(); + String mappingJson = Strings.toString(jsonBuilder().startObject() + .startObject("type").startObject("properties") + .startObject("date").field("type", "date").field("format", "dateOptionalTime||dd-MM-yyyy") + .endObject().endObject().endObject().endObject()); + prepareCreate("idx2").addMapping("type", mappingJson, XContentType.JSON).get(); IndexRequestBuilder[] reqs = new IndexRequestBuilder[5]; for (int i = 0; i < reqs.length; i++) { - reqs[i] = client().prepareIndex("idx2", "type", "" + i).setSource(jsonBuilder().startObject().field("date", "10-03-2014").endObject()); + reqs[i] = client().prepareIndex("idx2", "type", "" + i) + .setSource(jsonBuilder().startObject().field("date", "10-03-2014").endObject()); } indexRandom(true, reqs); @@ -1234,7 +1244,7 @@ public class DateHistogramIT extends ESIntegTestCase { .addAggregation(dateHistogram("date_histo") .field("date") .dateHistogramInterval(DateHistogramInterval.DAY)) - .execute().actionGet(); + .get(); assertSearchHits(response, "0", "1", "2", "3", "4"); @@ -1252,8 +1262,9 @@ public class DateHistogramIT extends ESIntegTestCase { public void testIssue6965() { SearchResponse response = client().prepareSearch("idx") - .addAggregation(dateHistogram("histo").field("date").timeZone(DateTimeZone.forID("+01:00")).dateHistogramInterval(DateHistogramInterval.MONTH).minDocCount(0)) - .execute().actionGet(); + .addAggregation(dateHistogram("histo").field("date").timeZone(DateTimeZone.forID("+01:00")) + .dateHistogramInterval(DateHistogramInterval.MONTH).minDocCount(0)) + .get(); assertSearchResponse(response); @@ -1293,8 +1304,9 @@ public class DateHistogramIT extends ESIntegTestCase { client().prepareIndex("test9491", "type").setSource("d", "2014-11-08T13:00:00Z")); ensureSearchable("test9491"); SearchResponse response = client().prepareSearch("test9491") - .addAggregation(dateHistogram("histo").field("d").dateHistogramInterval(DateHistogramInterval.YEAR).timeZone(DateTimeZone.forID("Asia/Jerusalem"))) - .execute().actionGet(); + .addAggregation(dateHistogram("histo").field("d").dateHistogramInterval(DateHistogramInterval.YEAR) + .timeZone(DateTimeZone.forID("Asia/Jerusalem"))) + .get(); assertSearchResponse(response); Histogram histo = response.getAggregations().get("histo"); assertThat(histo.getBuckets().size(), equalTo(1)); @@ -1310,9 +1322,10 @@ public class DateHistogramIT extends ESIntegTestCase { client().prepareIndex("test8209", "type").setSource("d", "2014-04-30T00:00:00Z")); ensureSearchable("test8209"); SearchResponse response = client().prepareSearch("test8209") - .addAggregation(dateHistogram("histo").field("d").dateHistogramInterval(DateHistogramInterval.MONTH).timeZone(DateTimeZone.forID("CET")) + .addAggregation(dateHistogram("histo").field("d").dateHistogramInterval(DateHistogramInterval.MONTH) + .timeZone(DateTimeZone.forID("CET")) .minDocCount(0)) - .execute().actionGet(); + .get(); assertSearchResponse(response); Histogram histo = response.getAggregations().get("histo"); assertThat(histo.getBuckets().size(), equalTo(4)); @@ -1333,8 +1346,7 @@ public class DateHistogramIT extends ESIntegTestCase { public void testExceptionOnNegativeInterval() { try { client().prepareSearch("idx") - .addAggregation(dateHistogram("histo").field("date").interval(-TimeUnit.DAYS.toMillis(1)).minDocCount(0)).execute() - .actionGet(); + .addAggregation(dateHistogram("histo").field("date").interval(-TimeUnit.DAYS.toMillis(1)).minDocCount(0)).get(); fail(); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("[interval] must be 1 or greater for histogram aggregation [histo]")); @@ -1357,7 +1369,7 @@ public class DateHistogramIT extends ESIntegTestCase { .addAggregation( dateHistogram("histo").field("dateField").dateHistogramInterval(DateHistogramInterval.MONTH).format("YYYY-MM") .minDocCount(0).extendedBounds(new ExtendedBounds("2018-01", "2018-01"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); Histogram histo = response.getAggregations().get("histo"); assertThat(histo.getBuckets().size(), equalTo(1)); @@ -1377,7 +1389,7 @@ public class DateHistogramIT extends ESIntegTestCase { indexRandom(true, client().prepareIndex(index, "type").setSource("d", "1477954800000")); ensureSearchable(index); SearchResponse response = client().prepareSearch(index).addAggregation(dateHistogram("histo").field("d") - .dateHistogramInterval(DateHistogramInterval.MONTH).timeZone(DateTimeZone.forID("Europe/Berlin"))).execute().actionGet(); + .dateHistogramInterval(DateHistogramInterval.MONTH).timeZone(DateTimeZone.forID("Europe/Berlin"))).get(); assertSearchResponse(response); Histogram histo = response.getAggregations().get("histo"); assertThat(histo.getBuckets().size(), equalTo(1)); @@ -1386,7 +1398,7 @@ public class DateHistogramIT extends ESIntegTestCase { response = client().prepareSearch(index).addAggregation(dateHistogram("histo").field("d") .dateHistogramInterval(DateHistogramInterval.MONTH).timeZone(DateTimeZone.forID("Europe/Berlin")).format("yyyy-MM-dd")) - .execute().actionGet(); + .get(); assertSearchResponse(response); histo = response.getAggregations().get("histo"); assertThat(histo.getBuckets().size(), equalTo(1)); @@ -1409,7 +1421,7 @@ public class DateHistogramIT extends ESIntegTestCase { .addAggregation(dateHistogram("histo").field("date").timeZone(DateTimeZone.forID("Europe/Oslo")) .dateHistogramInterval(DateHistogramInterval.HOUR).minDocCount(0).extendedBounds( new ExtendedBounds("2015-10-25T02:00:00.000+02:00", "2015-10-25T04:00:00.000+01:00"))) - .execute().actionGet(); + .get(); Histogram histo = response.getAggregations().get("histo"); List buckets = histo.getBuckets(); @@ -1504,7 +1516,7 @@ public class DateHistogramIT extends ESIntegTestCase { .setTypes("type") .addAggregation( dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY).order(BucketOrder.compound(order)) - .subAggregation(avg("avg_l").field("l")).subAggregation(sum("sum_d").field("d"))).execute().actionGet(); + .subAggregation(avg("avg_l").field("l")).subAggregation(sum("sum_d").field("d"))).get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramOffsetIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramOffsetIT.java index c8e94d2dd64..52b6bb22f06 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramOffsetIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramOffsetIT.java @@ -41,8 +41,9 @@ import static org.hamcrest.core.IsNull.notNullValue; /** * The serialisation of offsets for the date histogram aggregation was corrected in version 1.4 to allow negative offsets and as such the - * serialisation of negative offsets in these tests would break in pre 1.4 versions. These tests are separated from the other DateHistogramTests so the - * AssertingLocalTransport for these tests can be set to only use versions 1.4 onwards while keeping the other tests using all versions + * serialisation of negative offsets in these tests would break in pre 1.4 versions. These tests are separated from the other + * DateHistogramTests so the AssertingLocalTransport for these tests can be set to only use versions 1.4 onwards while keeping the other + * tests using all versions */ @ESIntegTestCase.SuiteScopeTestCase @ESIntegTestCase.ClusterScope(scope= ESIntegTestCase.Scope.SUITE) @@ -56,7 +57,7 @@ public class DateHistogramOffsetIT extends ESIntegTestCase { @Before public void beforeEachTest() throws IOException { - prepareCreate("idx2").addMapping("type", "date", "type=date").execute().actionGet(); + prepareCreate("idx2").addMapping("type", "date", "type=date").get(); } @After @@ -64,10 +65,12 @@ public class DateHistogramOffsetIT extends ESIntegTestCase { internalCluster().wipeIndices("idx2"); } - private void prepareIndex(DateTime date, int numHours, int stepSizeHours, int idxIdStart) throws IOException, InterruptedException, ExecutionException { + private void prepareIndex(DateTime date, int numHours, int stepSizeHours, int idxIdStart) + throws IOException, InterruptedException, ExecutionException { IndexRequestBuilder[] reqs = new IndexRequestBuilder[numHours]; for (int i = idxIdStart; i < idxIdStart + reqs.length; i++) { - reqs[i - idxIdStart] = client().prepareIndex("idx2", "type", "" + i).setSource(jsonBuilder().startObject().timeField("date", date).endObject()); + reqs[i - idxIdStart] = client().prepareIndex("idx2", "type", "" + i) + .setSource(jsonBuilder().startObject().timeField("date", date).endObject()); date = date.plusHours(stepSizeHours); } indexRandom(true, reqs); @@ -83,7 +86,7 @@ public class DateHistogramOffsetIT extends ESIntegTestCase { .offset("2h") .format(DATE_FORMAT) .dateHistogramInterval(DateHistogramInterval.DAY)) - .execute().actionGet(); + .get(); assertThat(response.getHits().getTotalHits().value, equalTo(5L)); @@ -105,7 +108,7 @@ public class DateHistogramOffsetIT extends ESIntegTestCase { .offset("-2h") .format(DATE_FORMAT) .dateHistogramInterval(DateHistogramInterval.DAY)) - .execute().actionGet(); + .get(); assertThat(response.getHits().getTotalHits().value, equalTo(5L)); @@ -132,7 +135,7 @@ public class DateHistogramOffsetIT extends ESIntegTestCase { .minDocCount(0) .format(DATE_FORMAT) .dateHistogramInterval(DateHistogramInterval.DAY)) - .execute().actionGet(); + .get(); assertThat(response.getHits().getTotalHits().value, equalTo(24L)); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DateRangeIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DateRangeIT.java index fe3ee0d6b72..acda03c0b13 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DateRangeIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DateRangeIT.java @@ -128,7 +128,7 @@ public class DateRangeIT extends ESIntegTestCase { .prepareSearch("idx") .addAggregation( rangeBuilder.addUnboundedTo("a long time ago", "now-50y").addRange("recently", "now-50y", "now-1y") - .addUnboundedFrom("last year", "now-1y").timeZone(DateTimeZone.forID("EST"))).execute().actionGet(); + .addUnboundedFrom("last year", "now-1y").timeZone(DateTimeZone.forID("EST"))).get(); assertSearchResponse(response); @@ -162,7 +162,7 @@ public class DateRangeIT extends ESIntegTestCase { .addUnboundedTo(date(2, 15)) .addRange(date(2, 15), date(3, 15)) .addUnboundedFrom(date(3, 15))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -208,7 +208,7 @@ public class DateRangeIT extends ESIntegTestCase { .addUnboundedTo("2012-02-15") .addRange("2012-02-15", "2012-03-15") .addUnboundedFrom("2012-03-15")) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -255,7 +255,7 @@ public class DateRangeIT extends ESIntegTestCase { .addUnboundedTo("2012-02-15") .addRange("2012-02-15", "2012-03-15") .addUnboundedFrom("2012-03-15")) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -309,7 +309,7 @@ public class DateRangeIT extends ESIntegTestCase { .addRange("2012-02-15", "2012-02-15||+1M") .addUnboundedFrom("2012-02-15||+1M") .timeZone(timezone)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -355,7 +355,7 @@ public class DateRangeIT extends ESIntegTestCase { .addUnboundedTo("r1", date(2, 15)) .addRange("r2", date(2, 15), date(3, 15)) .addUnboundedFrom("r3", date(3, 15))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -411,7 +411,7 @@ public class DateRangeIT extends ESIntegTestCase { .addRange("r2", date(2, 15), date(3, 15)) .addUnboundedFrom("r3", date(3, 15)) .subAggregation(sum("sum").field("value"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -488,7 +488,7 @@ public class DateRangeIT extends ESIntegTestCase { .addUnboundedTo(date(2, 15)) .addRange(date(2, 15), date(3, 15)) .addUnboundedFrom(date(3, 15))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -544,8 +544,7 @@ public class DateRangeIT extends ESIntegTestCase { .addAggregation(dateRange("range") .field("dates") .script(new Script(ScriptType.INLINE, "mockscript", DateScriptMocksPlugin.DOUBLE_PLUS_ONE_MONTH, params)) - .addUnboundedTo(date(2, 15)).addRange(date(2, 15), date(3, 15)).addUnboundedFrom(date(3, 15))).execute() - .actionGet(); + .addUnboundedTo(date(2, 15)).addRange(date(2, 15), date(3, 15)).addUnboundedFrom(date(3, 15))).get(); assertSearchResponse(response); @@ -603,7 +602,7 @@ public class DateRangeIT extends ESIntegTestCase { .addUnboundedTo(date(2, 15)) .addRange(date(2, 15), date(3, 15)) .addUnboundedFrom(date(3, 15))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -663,7 +662,7 @@ public class DateRangeIT extends ESIntegTestCase { .addAggregation( dateRange("range").script(new Script(ScriptType.INLINE, "mockscript", DateScriptMocksPlugin.EXTRACT_FIELD, params)) .addUnboundedTo(date(2, 15)).addRange(date(2, 15), date(3, 15)) - .addUnboundedFrom(date(3, 15))).execute().actionGet(); + .addUnboundedFrom(date(3, 15))).get(); assertSearchResponse(response); @@ -702,7 +701,7 @@ public class DateRangeIT extends ESIntegTestCase { } public void testUnmapped() throws Exception { - client().admin().cluster().prepareHealth("idx_unmapped").setWaitForYellowStatus().execute().actionGet(); + client().admin().cluster().prepareHealth("idx_unmapped").setWaitForYellowStatus().get(); SearchResponse response = client().prepareSearch("idx_unmapped") .addAggregation(dateRange("range") @@ -710,7 +709,7 @@ public class DateRangeIT extends ESIntegTestCase { .addUnboundedTo(date(2, 15)) .addRange(date(2, 15), date(3, 15)) .addUnboundedFrom(date(3, 15))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -756,7 +755,7 @@ public class DateRangeIT extends ESIntegTestCase { .addUnboundedTo("2012-02-15") .addRange("2012-02-15", "2012-03-15") .addUnboundedFrom("2012-03-15")) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -802,7 +801,7 @@ public class DateRangeIT extends ESIntegTestCase { .addUnboundedTo(date(2, 15)) .addRange(date(2, 15), date(3, 15)) .addUnboundedFrom(date(3, 15))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -846,7 +845,7 @@ public class DateRangeIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .addAggregation(histogram("histo").field("value").interval(1L).minDocCount(0) .subAggregation(dateRange("date_range").field("value").addRange("0-1", 0, 1))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); @@ -870,7 +869,7 @@ public class DateRangeIT extends ESIntegTestCase { try { client().prepareSearch("idx") .addAggregation(dateRange("my_date_range_agg").field("value")) - .execute().actionGet(); + .get(); fail(); } catch (SearchPhaseExecutionException spee){ Throwable rootCause = spee.getCause().getCause(); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DiversifiedSamplerIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DiversifiedSamplerIT.java index ac601022c78..f1c8277a42b 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DiversifiedSamplerIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DiversifiedSamplerIT.java @@ -110,7 +110,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase { .order(BucketOrder.aggregation("sample>max_price.value", asc)) .subAggregation(sampler("sample").shardSize(100) .subAggregation(max("max_price").field("price"))) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); Terms genres = response.getAggregations().get("genres"); Collection genreBuckets = genres.getBuckets(); @@ -141,8 +141,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase { .setQuery(new TermQueryBuilder("genre", "fantasy")) .setFrom(0).setSize(60) .addAggregation(sampleAgg) - .execute() - .actionGet(); + .get(); assertSearchResponse(response); Sampler sample = response.getAggregations().get("sample"); Terms authors = sample.getAggregations().get("authors"); @@ -164,7 +163,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase { rootTerms.subAggregation(sampleAgg); SearchResponse response = client().prepareSearch("test").setSearchType(SearchType.QUERY_THEN_FETCH) - .addAggregation(rootTerms).execute().actionGet(); + .addAggregation(rootTerms).get(); assertSearchResponse(response); Terms genres = response.getAggregations().get("genres"); List genreBuckets = genres.getBuckets(); @@ -194,7 +193,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase { rootSample.subAggregation(sampleAgg); SearchResponse response = client().prepareSearch("test").setSearchType(SearchType.QUERY_THEN_FETCH).addAggregation(rootSample) - .execute().actionGet(); + .get(); assertSearchResponse(response); Sampler genreSample = response.getAggregations().get("genreSample"); Sampler sample = genreSample.getAggregations().get("sample"); @@ -220,7 +219,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase { sampleAgg.subAggregation(terms("authors").field("author")); SearchResponse response = client().prepareSearch("idx_unmapped_author", "test").setSearchType(SearchType.QUERY_THEN_FETCH) .setQuery(new TermQueryBuilder("genre", "fantasy")).setFrom(0).setSize(60).addAggregation(sampleAgg) - .execute().actionGet(); + .get(); assertSearchResponse(response); Sampler sample = response.getAggregations().get("sample"); assertThat(sample.getDocCount(), greaterThan(0L)); @@ -235,7 +234,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase { sampleAgg.field("author").maxDocsPerValue(MAX_DOCS_PER_AUTHOR).executionHint(randomExecutionHint()); sampleAgg.subAggregation(terms("authors").field("author")); SearchResponse response = client().prepareSearch("idx_unmapped", "idx_unmapped_author").setSearchType(SearchType.QUERY_THEN_FETCH) - .setQuery(new TermQueryBuilder("genre", "fantasy")).setFrom(0).setSize(60).addAggregation(sampleAgg).execute().actionGet(); + .setQuery(new TermQueryBuilder("genre", "fantasy")).setFrom(0).setSize(60).addAggregation(sampleAgg).get(); assertSearchResponse(response); Sampler sample = response.getAggregations().get("sample"); assertThat(sample.getDocCount(), equalTo(0L)); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DoubleTermsIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DoubleTermsIT.java index fc808a6ecaf..a80aa4142eb 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DoubleTermsIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DoubleTermsIT.java @@ -276,7 +276,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase { () -> client() .prepareSearch("high_card_idx").addAggregation(terms("terms").field(SINGLE_VALUED_FIELD_NAME) .minDocCount(randomInt(1)).size(0).collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet()); + .get()); assertThat(exception.getMessage(), containsString("[size] must be greater than 0. Found [0] in [terms]")); } @@ -292,7 +292,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase { // Find total number of unique terms SearchResponse allResponse = client().prepareSearch("idx") .addAggregation(terms("terms").field(field).size(10000).collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(allResponse); Terms terms = allResponse.getAggregations().get("terms"); assertThat(terms, notNullValue()); @@ -305,7 +305,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase { for (int partition = 0; partition < numPartitions; partition++) { SearchResponse response = client().prepareSearch("idx").addAggregation(terms("terms").field(field) .includeExclude(new IncludeExclude(partition, numPartitions)).collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(response); terms = response.getAggregations().get("terms"); assertThat(terms, notNullValue()); @@ -474,7 +474,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase { .addAggregation(terms("terms") .field(SINGLE_VALUED_FIELD_NAME) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -499,7 +499,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase { .field(SINGLE_VALUED_FIELD_NAME) .collectMode(randomFrom(SubAggCollectionMode.values())) .format("0000.00")) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -531,7 +531,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase { .subAggregation(avg("avg_i").field(SINGLE_VALUED_FIELD_NAME)) .subAggregation( terms("subTerms").field(MULTI_VALUED_FIELD_NAME).collectMode( - randomFrom(SubAggCollectionMode.values())))).execute().actionGet(); + randomFrom(SubAggCollectionMode.values())))).get(); assertSearchResponse(response); @@ -570,7 +570,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase { .addAggregation( terms("num_tags").field("num_tag").collectMode(randomFrom(SubAggCollectionMode.values())) .order(BucketOrder.aggregation("filter", asc)) - .subAggregation(filter("filter", QueryBuilders.matchAllQuery()))).execute().actionGet(); + .subAggregation(filter("filter", QueryBuilders.matchAllQuery()))).get(); assertSearchResponse(response); @@ -611,7 +611,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase { .subAggregation( filter("filter1", QueryBuilders.matchAllQuery()).subAggregation( filter("filter2", QueryBuilders.matchAllQuery()).subAggregation( - max("max").field(SINGLE_VALUED_FIELD_NAME))))).execute().actionGet(); + max("max").field(SINGLE_VALUED_FIELD_NAME))))).get(); assertSearchResponse(response); @@ -661,7 +661,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase { client().prepareSearch(index) .addAggregation( terms("terms").field(SINGLE_VALUED_FIELD_NAME).collectMode(randomFrom(SubAggCollectionMode.values())) - .order(BucketOrder.aggregation("avg_i", true))).execute().actionGet(); + .order(BucketOrder.aggregation("avg_i", true))).get(); fail("Expected search to fail when trying to sort terms aggregation by sug-aggregation that doesn't exist"); @@ -682,7 +682,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase { .order(BucketOrder.aggregation("num_tags", true)) .subAggregation( terms("num_tags").field("num_tags").collectMode(randomFrom(SubAggCollectionMode.values())))) - .execute().actionGet(); + .get(); fail("Expected search to fail when trying to sort terms aggregation by sug-aggregation which is not of a metrics type"); @@ -699,7 +699,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase { .addAggregation( terms("terms").field(SINGLE_VALUED_FIELD_NAME + "2").collectMode(randomFrom(SubAggCollectionMode.values())) .order(BucketOrder.aggregation("stats.foo", true)) - .subAggregation(stats("stats").field(SINGLE_VALUED_FIELD_NAME))).execute().actionGet(); + .subAggregation(stats("stats").field(SINGLE_VALUED_FIELD_NAME))).get(); fail("Expected search to fail when trying to sort terms aggregation by multi-valued sug-aggregation " + "with an unknown specified metric to order by"); @@ -717,7 +717,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase { .addAggregation( terms("terms").field(SINGLE_VALUED_FIELD_NAME).collectMode(randomFrom(SubAggCollectionMode.values())) .order(BucketOrder.aggregation("stats", true)) - .subAggregation(stats("stats").field(SINGLE_VALUED_FIELD_NAME))).execute().actionGet(); + .subAggregation(stats("stats").field(SINGLE_VALUED_FIELD_NAME))).get(); fail("Expected search to fail when trying to sort terms aggregation by multi-valued sug-aggregation " + "where the metric name is not specified"); @@ -735,7 +735,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase { .addAggregation( terms("terms").field(SINGLE_VALUED_FIELD_NAME).collectMode(randomFrom(SubAggCollectionMode.values())) .order(BucketOrder.aggregation("stats.avg", asc)) - .subAggregation(stats("stats").field(SINGLE_VALUED_FIELD_NAME))).execute().actionGet(); + .subAggregation(stats("stats").field(SINGLE_VALUED_FIELD_NAME))).get(); assertSearchResponse(response); @@ -763,7 +763,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase { .addAggregation( terms("terms").field(SINGLE_VALUED_FIELD_NAME).collectMode(randomFrom(SubAggCollectionMode.values())) .order(BucketOrder.aggregation("stats.avg", asc)) - .subAggregation(stats("stats").field(SINGLE_VALUED_FIELD_NAME))).execute().actionGet(); + .subAggregation(stats("stats").field(SINGLE_VALUED_FIELD_NAME))).get(); assertSearchResponse(response); @@ -791,7 +791,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase { .addAggregation( terms("terms").field(SINGLE_VALUED_FIELD_NAME).collectMode(randomFrom(SubAggCollectionMode.values())) .order(BucketOrder.aggregation("stats.variance", asc)) - .subAggregation(extendedStats("stats").field(SINGLE_VALUED_FIELD_NAME))).execute().actionGet(); + .subAggregation(extendedStats("stats").field(SINGLE_VALUED_FIELD_NAME))).get(); assertSearchResponse(response); @@ -889,7 +889,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase { .addAggregation( terms("terms").field(SINGLE_VALUED_FIELD_NAME).collectMode(randomFrom(SubAggCollectionMode.values())) .order(BucketOrder.compound(order)).subAggregation(avg("avg_l").field("l")) - .subAggregation(sum("sum_d").field("d"))).execute().actionGet(); + .subAggregation(sum("sum_d").field("d"))).get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/FilterIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/FilterIT.java index bda9d4dd9e2..b9baad45f8d 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/FilterIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/FilterIT.java @@ -78,7 +78,7 @@ public class FilterIT extends ESIntegTestCase { builders.add(client().prepareIndex("idx", "type", ""+i).setSource(source)); } } - prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").execute().actionGet(); + prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").get(); for (int i = 0; i < 2; i++) { builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder() .startObject() @@ -92,7 +92,7 @@ public class FilterIT extends ESIntegTestCase { public void testSimple() throws Exception { SearchResponse response = client().prepareSearch("idx") .addAggregation(filter("tag1", termQuery("tag", "tag1"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -107,7 +107,7 @@ public class FilterIT extends ESIntegTestCase { // https://github.com/elastic/elasticsearch/issues/8438 public void testEmptyFilterDeclarations() throws Exception { QueryBuilder emptyFilter = new BoolQueryBuilder(); - SearchResponse response = client().prepareSearch("idx").addAggregation(filter("tag1", emptyFilter)).execute().actionGet(); + SearchResponse response = client().prepareSearch("idx").addAggregation(filter("tag1", emptyFilter)).get(); assertSearchResponse(response); @@ -120,7 +120,7 @@ public class FilterIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(filter("tag1", termQuery("tag", "tag1")) .subAggregation(avg("avg_value").field("value"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -167,7 +167,7 @@ public class FilterIT extends ESIntegTestCase { client().prepareSearch("idx") .addAggregation(filter("tag1", termQuery("tag", "tag1")) .subAggregation(avg("avg_value"))) - .execute().actionGet(); + .get(); fail("expected execution to fail - an attempt to have a context based numeric sub-aggregation, but there is not value source" + "context which the sub-aggregation can inherit"); @@ -182,7 +182,7 @@ public class FilterIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .addAggregation(histogram("histo").field("value").interval(1L).minDocCount(0) .subAggregation(filter("filter", matchAllQuery()))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/FiltersIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/FiltersIT.java index 0b786c54d0f..79d4d4525d6 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/FiltersIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/FiltersIT.java @@ -98,7 +98,7 @@ public class FiltersIT extends ESIntegTestCase { builders.add(client().prepareIndex("idx", "type", "" + i).setSource(source)); } } - prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").execute().actionGet(); + prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").get(); for (int i = 0; i < 2; i++) { builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder() .startObject() @@ -113,7 +113,7 @@ public class FiltersIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx").addAggregation( filters("tags", randomOrder(new KeyedFilter("tag1", termQuery("tag", "tag1")), new KeyedFilter("tag2", termQuery("tag", "tag2"))))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -139,7 +139,7 @@ public class FiltersIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(filters("tags", randomOrder(new KeyedFilter("all", emptyFilter), new KeyedFilter("tag1", termQuery("tag", "tag1"))))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -157,7 +157,7 @@ public class FiltersIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(filters("tags", randomOrder(new KeyedFilter("tag1", termQuery("tag", "tag1")), new KeyedFilter("tag2", termQuery("tag", "tag2")))).subAggregation(avg("avg_value").field("value"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -233,7 +233,7 @@ public class FiltersIT extends ESIntegTestCase { filters("tags", randomOrder(new KeyedFilter("tag1", termQuery("tag", "tag1")), new KeyedFilter("tag2", termQuery("tag", "tag2")))).subAggregation(avg("avg_value"))) - .execute().actionGet(); + .get(); fail("expected execution to fail - an attempt to have a context based numeric sub-aggregation, but there is not value source" + "context which the sub-aggregation can inherit"); @@ -248,7 +248,7 @@ public class FiltersIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .addAggregation(histogram("histo").field("value").interval(1L).minDocCount(0) .subAggregation(filters("filters", new KeyedFilter("all", matchAllQuery())))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); @@ -266,7 +266,7 @@ public class FiltersIT extends ESIntegTestCase { public void testSimpleNonKeyed() throws Exception { SearchResponse response = client().prepareSearch("idx") - .addAggregation(filters("tags", termQuery("tag", "tag1"), termQuery("tag", "tag2"))).execute().actionGet(); + .addAggregation(filters("tags", termQuery("tag", "tag1"), termQuery("tag", "tag2"))).get(); assertSearchResponse(response); @@ -292,7 +292,7 @@ public class FiltersIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx").addAggregation( filters("tags", randomOrder(new KeyedFilter("tag1", termQuery("tag", "tag1")), new KeyedFilter("tag2", termQuery("tag", "tag2")))).otherBucket(true)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -319,7 +319,7 @@ public class FiltersIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(filters("tags", randomOrder(new KeyedFilter("tag1", termQuery("tag", "tag1")), new KeyedFilter("tag2", termQuery("tag", "tag2")))).otherBucket(true).otherBucketKey("foobar")) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -344,8 +344,7 @@ public class FiltersIT extends ESIntegTestCase { public void testOtherNonKeyed() throws Exception { SearchResponse response = client().prepareSearch("idx") - .addAggregation(filters("tags", termQuery("tag", "tag1"), termQuery("tag", "tag2")).otherBucket(true)).execute() - .actionGet(); + .addAggregation(filters("tags", termQuery("tag", "tag1"), termQuery("tag", "tag2")).otherBucket(true)).get(); assertSearchResponse(response); @@ -376,7 +375,7 @@ public class FiltersIT extends ESIntegTestCase { .addAggregation(filters("tags", randomOrder(new KeyedFilter("tag1", termQuery("tag", "tag1")), new KeyedFilter("tag2", termQuery("tag", "tag2")))).otherBucket(true) .subAggregation(avg("avg_value").field("value"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -445,7 +444,7 @@ public class FiltersIT extends ESIntegTestCase { .addAggregation(histogram("histo").field("value").interval(1L).minDocCount(0) .subAggregation(filters("filters", new KeyedFilter("foo", matchAllQuery())) .otherBucket(true).otherBucketKey("bar"))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoDistanceIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoDistanceIT.java index cb0e29f6c53..02313694210 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoDistanceIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoDistanceIT.java @@ -82,11 +82,11 @@ public class GeoDistanceIT extends ESIntegTestCase { Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); prepareCreate("idx").setSettings(settings) .addMapping("type", "location", "type=geo_point", "city", "type=keyword") - .execute().actionGet(); + .get(); prepareCreate("idx-multi") .addMapping("type", "location", "type=geo_point", "city", "type=keyword") - .execute().actionGet(); + .get(); createIndex("idx_unmapped"); @@ -111,9 +111,12 @@ public class GeoDistanceIT extends ESIntegTestCase { cities.clear(); cities.addAll(Arrays.asList( - indexCity("idx-multi", "city1", "52.3890, 4.637", "50.097679,14.441314"), // first point is within the ~17.5km, the second is ~710km - indexCity("idx-multi", "city2", "52.540, 13.409", "52.0945, 5.116"), // first point is ~576km, the second is within the ~35km - indexCity("idx-multi", "city3", "32.0741, 34.777"))); // above 1000km + // first point is within the ~17.5km, the second is ~710km + indexCity("idx-multi", "city1", "52.3890, 4.637", "50.097679,14.441314"), + // first point is ~576km, the second is within the ~35km + indexCity("idx-multi", "city2", "52.540, 13.409", "52.0945, 5.116"), + // above 1000km + indexCity("idx-multi", "city3", "32.0741, 34.777"))); // random cities with no location for (String cityName : Arrays.asList("london", "singapour", "tokyo", "milan")) { @@ -121,7 +124,7 @@ public class GeoDistanceIT extends ESIntegTestCase { } indexRandom(true, cities); prepareCreate("empty_bucket_idx") - .addMapping("type", "value", "type=integer", "location", "type=geo_point").execute().actionGet(); + .addMapping("type", "value", "type=integer", "location", "type=geo_point").get(); List builders = new ArrayList<>(); for (int i = 0; i < 2; i++) { builders.add(client().prepareIndex("empty_bucket_idx", "type", "" + i).setSource(jsonBuilder() @@ -142,7 +145,7 @@ public class GeoDistanceIT extends ESIntegTestCase { .addUnboundedTo(500) .addRange(500, 1000) .addUnboundedFrom(1000)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -189,7 +192,7 @@ public class GeoDistanceIT extends ESIntegTestCase { .addUnboundedTo("ring1", 500) .addRange("ring2", 500, 1000) .addUnboundedFrom("ring3", 1000)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -229,7 +232,7 @@ public class GeoDistanceIT extends ESIntegTestCase { } public void testUnmapped() throws Exception { - client().admin().cluster().prepareHealth("idx_unmapped").setWaitForYellowStatus().execute().actionGet(); + client().admin().cluster().prepareHealth("idx_unmapped").setWaitForYellowStatus().get(); SearchResponse response = client().prepareSearch("idx_unmapped") .addAggregation(geoDistance("amsterdam_rings", new GeoPoint(52.3760, 4.894)) @@ -238,7 +241,7 @@ public class GeoDistanceIT extends ESIntegTestCase { .addUnboundedTo(500) .addRange(500, 1000) .addUnboundedFrom(1000)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -285,7 +288,7 @@ public class GeoDistanceIT extends ESIntegTestCase { .addUnboundedTo(500) .addRange(500, 1000) .addUnboundedFrom(1000)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -334,7 +337,7 @@ public class GeoDistanceIT extends ESIntegTestCase { .addUnboundedFrom(1000) .subAggregation(terms("cities").field("city") .collectMode(randomFrom(SubAggCollectionMode.values())))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -414,8 +417,9 @@ public class GeoDistanceIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx") .setQuery(matchAllQuery()) .addAggregation(histogram("histo").field("value").interval(1L).minDocCount(0) - .subAggregation(geoDistance("geo_dist", new GeoPoint(52.3760, 4.894)).field("location").addRange("0-100", 0.0, 100.0))) - .execute().actionGet(); + .subAggregation(geoDistance("geo_dist", new GeoPoint(52.3760, 4.894)).field("location") + .addRange("0-100", 0.0, 100.0))) + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); @@ -441,7 +445,7 @@ public class GeoDistanceIT extends ESIntegTestCase { try { client().prepareSearch("idx") .addAggregation(geoDistance("geo_dist", new GeoPoint(52.3760, 4.894))) - .execute().actionGet(); + .get(); fail(); } catch (SearchPhaseExecutionException spee){ Throwable rootCause = spee.getCause().getCause(); @@ -459,7 +463,7 @@ public class GeoDistanceIT extends ESIntegTestCase { .addUnboundedTo(500) .addRange(500, 1000) .addUnboundedFrom(1000)) - .execute().actionGet(); + .get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoHashGridIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoHashGridIT.java index 2b63a2ca633..d264de22e21 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoHashGridIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoHashGridIT.java @@ -150,7 +150,7 @@ public class GeoHashGridIT extends ESIntegTestCase { .field("location") .precision(precision) ) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -181,7 +181,7 @@ public class GeoHashGridIT extends ESIntegTestCase { .field("location") .precision(precision) ) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -211,7 +211,7 @@ public class GeoHashGridIT extends ESIntegTestCase { .precision(precision) ) ) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -238,7 +238,7 @@ public class GeoHashGridIT extends ESIntegTestCase { .field("location") .precision(precision) ) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -255,7 +255,7 @@ public class GeoHashGridIT extends ESIntegTestCase { .field("location") .precision(precision) ) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -281,7 +281,7 @@ public class GeoHashGridIT extends ESIntegTestCase { .shardSize(100) .precision(precision) ) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -309,8 +309,7 @@ public class GeoHashGridIT extends ESIntegTestCase { final int shardSize = 10000; IllegalArgumentException exception = expectThrows(IllegalArgumentException.class, () -> client().prepareSearch("idx") - .addAggregation(geohashGrid("geohashgrid").field("location").size(size).shardSize(shardSize)).execute() - .actionGet()); + .addAggregation(geohashGrid("geohashgrid").field("location").size(size).shardSize(shardSize)).get()); assertThat(exception.getMessage(), containsString("[size] must be greater than 0. Found [0] in [geohashgrid]")); } @@ -320,7 +319,7 @@ public class GeoHashGridIT extends ESIntegTestCase { IllegalArgumentException exception = expectThrows(IllegalArgumentException.class, () -> client().prepareSearch("idx") .addAggregation(geohashGrid("geohashgrid").field("location").size(size).shardSize(shardSize)) - .execute().actionGet()); + .get()); assertThat(exception.getMessage(), containsString("[shardSize] must be greater than 0. Found [0] in [geohashgrid]")); } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GlobalIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GlobalIT.java index 429b8c71f72..a2370eb6f79 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GlobalIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GlobalIT.java @@ -74,7 +74,7 @@ public class GlobalIT extends ESIntegTestCase { .setQuery(QueryBuilders.termQuery("tag", "tag1")) .addAggregation(global("global") .subAggregation(stats("value_stats").field("value"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -107,7 +107,7 @@ public class GlobalIT extends ESIntegTestCase { .setQuery(QueryBuilders.termQuery("tag", "tag1")) .addAggregation(global("global") .subAggregation(global("inner_global"))) - .execute().actionGet(); + .get(); fail("expected to fail executing non-top-level global aggregator. global aggregations are only allowed as top level" + "aggregations"); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/HistogramIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/HistogramIT.java index b3b105bf366..bee32d571b6 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/HistogramIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/HistogramIT.java @@ -209,7 +209,7 @@ public class HistogramIT extends ESIntegTestCase { public void testSingleValuedField() throws Exception { SearchResponse response = client().prepareSearch("idx") .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -233,7 +233,7 @@ public class HistogramIT extends ESIntegTestCase { SearchResponse response = client() .prepareSearch("idx") .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval1).offset(offset)) - .execute().actionGet(); + .get(); // from setup we have between 6 and 20 documents, each with value 1 in test field int expectedNumberOfBuckets = (offset >= (numDocs % interval + 1)) ? numValueBuckets : numValueBuckets + 1; @@ -264,7 +264,7 @@ public class HistogramIT extends ESIntegTestCase { SearchResponse response = client() .prepareSearch("idx") .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval).offset(offset)) - .execute().actionGet(); + .get(); assertSearchResponse(response); // shifting by offset>2 creates new extra bucket [0,offset-1] // if offset is >= number of values in original last bucket, that effect is canceled @@ -297,7 +297,7 @@ public class HistogramIT extends ESIntegTestCase { public void testSingleValuedFieldOrderedByKeyAsc() throws Exception { SearchResponse response = client().prepareSearch("idx") .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval).order(BucketOrder.key(true))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -319,7 +319,7 @@ public class HistogramIT extends ESIntegTestCase { public void testsingleValuedFieldOrderedByKeyDesc() throws Exception { SearchResponse response = client().prepareSearch("idx") .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval).order(BucketOrder.key(false))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -341,7 +341,7 @@ public class HistogramIT extends ESIntegTestCase { public void testSingleValuedFieldOrderedByCountAsc() throws Exception { SearchResponse response = client().prepareSearch("idx") .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval).order(BucketOrder.count(true))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -369,7 +369,7 @@ public class HistogramIT extends ESIntegTestCase { public void testSingleValuedFieldOrderedByCountDesc() throws Exception { SearchResponse response = client().prepareSearch("idx") .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval).order(BucketOrder.count(false))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -398,7 +398,7 @@ public class HistogramIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -442,7 +442,7 @@ public class HistogramIT extends ESIntegTestCase { .interval(interval) .order(BucketOrder.aggregation("sum", true)) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -485,7 +485,7 @@ public class HistogramIT extends ESIntegTestCase { .interval(interval) .order(BucketOrder.aggregation("sum", false)) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -528,7 +528,7 @@ public class HistogramIT extends ESIntegTestCase { .interval(interval) .order(BucketOrder.aggregation("stats.sum", false)) .subAggregation(stats("stats").field(SINGLE_VALUED_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -574,7 +574,7 @@ public class HistogramIT extends ESIntegTestCase { .order(BucketOrder.aggregation("filter>max", asc)) .subAggregation(filter("filter", matchAllQuery()) .subAggregation(max("max").field(SINGLE_VALUED_FIELD_NAME)))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -612,7 +612,7 @@ public class HistogramIT extends ESIntegTestCase { .interval(interval) .order(BucketOrder.aggregation("max_constant", randomBoolean())) .subAggregation(max("max_constant").field("constant"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -643,7 +643,7 @@ public class HistogramIT extends ESIntegTestCase { .interval(interval) .field(MULTI_VALUED_FIELD_NAME) .subAggregation(avg("avg").field("value")))) - .execute().actionGet(); + .get(); fail("Expected an exception"); } catch (SearchPhaseExecutionException e) { ElasticsearchException[] rootCauses = e.guessRootCauses(); @@ -668,7 +668,7 @@ public class HistogramIT extends ESIntegTestCase { .field(SINGLE_VALUED_FIELD_NAME) .script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_value + 1", emptyMap())) .interval(interval)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -696,7 +696,7 @@ public class HistogramIT extends ESIntegTestCase { public void testMultiValuedField() throws Exception { SearchResponse response = client().prepareSearch("idx") .addAggregation(histogram("histo").field(MULTI_VALUED_FIELD_NAME).interval(interval)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -718,7 +718,7 @@ public class HistogramIT extends ESIntegTestCase { public void testMultiValuedFieldOrderedByKeyDesc() throws Exception { SearchResponse response = client().prepareSearch("idx") .addAggregation(histogram("histo").field(MULTI_VALUED_FIELD_NAME).interval(interval).order(BucketOrder.key(false))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -744,7 +744,7 @@ public class HistogramIT extends ESIntegTestCase { .field(MULTI_VALUED_FIELD_NAME) .script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_value + 1", emptyMap())) .interval(interval)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -780,7 +780,7 @@ public class HistogramIT extends ESIntegTestCase { histogram("histo") .script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "doc['l_value'].value", emptyMap())) .interval(interval)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -804,7 +804,7 @@ public class HistogramIT extends ESIntegTestCase { histogram("histo") .script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "doc['l_values']", emptyMap())) .interval(interval)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -825,7 +825,7 @@ public class HistogramIT extends ESIntegTestCase { public void testUnmapped() throws Exception { SearchResponse response = client().prepareSearch("idx_unmapped") .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -839,7 +839,7 @@ public class HistogramIT extends ESIntegTestCase { public void testPartiallyUnmapped() throws Exception { SearchResponse response = client().prepareSearch("idx", "idx_unmapped") .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -899,7 +899,7 @@ public class HistogramIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(1L).minDocCount(0) .subAggregation(histogram("sub_histo").field(SINGLE_VALUED_FIELD_NAME).interval(1L))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); @@ -957,7 +957,7 @@ public class HistogramIT extends ESIntegTestCase { .interval(interval) .minDocCount(0) .extendedBounds(boundsMin, boundsMax)) - .execute().actionGet(); + .get(); if (invalidBoundsError) { fail("Expected an exception to be thrown when bounds.min is greater than bounds.max"); @@ -1034,7 +1034,7 @@ public class HistogramIT extends ESIntegTestCase { .interval(interval) .minDocCount(0) .extendedBounds(boundsMin, boundsMax)) - .execute().actionGet(); + .get(); if (invalidBoundsError) { fail("Expected an exception to be thrown when bounds.min is greater than bounds.max"); @@ -1073,7 +1073,7 @@ public class HistogramIT extends ESIntegTestCase { public void testExeptionOnNegativerInterval() { try { client().prepareSearch("empty_bucket_idx") - .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(-1).minDocCount(0)).execute().actionGet(); + .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(-1).minDocCount(0)).get(); fail(); } catch (IllegalArgumentException e) { assertThat(e.toString(), containsString("[interval] must be >0 for histogram aggregation [histo]")); @@ -1181,7 +1181,7 @@ public class HistogramIT extends ESIntegTestCase { .setTypes("type") .addAggregation( histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(1).order(BucketOrder.compound(order)) - .subAggregation(avg("avg_l").field("l")).subAggregation(sum("sum_d").field("d"))).execute().actionGet(); + .subAggregation(avg("avg_l").field("l")).subAggregation(sum("sum_d").field("d"))).get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/IpRangeIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/IpRangeIT.java index ffa7f970151..efc9ba4eda8 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/IpRangeIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/IpRangeIT.java @@ -243,7 +243,7 @@ public class IpRangeIT extends ESIntegTestCase { client().prepareSearch("idx").addAggregation( AggregationBuilders.ipRange("my_range") .field("ip")) - .execute().actionGet(); + .get(); fail(); } catch (SearchPhaseExecutionException spee){ Throwable rootCause = spee.getCause().getCause(); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/LongTermsIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/LongTermsIT.java index 1e67b59ee32..481050acee4 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/LongTermsIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/LongTermsIT.java @@ -270,7 +270,7 @@ public class LongTermsIT extends AbstractTermsTestCase { .collectMode(randomFrom(SubAggCollectionMode.values())) .minDocCount(randomInt(1)) .size(0)) - .execute().actionGet()); + .get()); assertThat(exception.getMessage(), containsString("[size] must be greater than 0. Found [0] in [terms]")); } @@ -285,7 +285,7 @@ public class LongTermsIT extends AbstractTermsTestCase { private void runTestFieldWithPartitionedFiltering(String field) throws Exception { // Find total number of unique terms SearchResponse allResponse = client().prepareSearch("idx") - .addAggregation(terms("terms").field(field).collectMode(randomFrom(SubAggCollectionMode.values()))).execute().actionGet(); + .addAggregation(terms("terms").field(field).collectMode(randomFrom(SubAggCollectionMode.values()))).get(); assertSearchResponse(allResponse); Terms terms = allResponse.getAggregations().get("terms"); assertThat(terms, notNullValue()); @@ -300,7 +300,7 @@ public class LongTermsIT extends AbstractTermsTestCase { .addAggregation( terms("terms").field(field).includeExclude(new IncludeExclude(partition, numPartitions)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(response); terms = response.getAggregations().get("terms"); assertThat(terms, notNullValue()); @@ -472,7 +472,7 @@ public class LongTermsIT extends AbstractTermsTestCase { .addAggregation(terms("terms") .field(SINGLE_VALUED_FIELD_NAME) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -497,7 +497,7 @@ public class LongTermsIT extends AbstractTermsTestCase { .field(SINGLE_VALUED_FIELD_NAME) .collectMode(randomFrom(SubAggCollectionMode.values())) .format("0000")) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -608,7 +608,7 @@ public class LongTermsIT extends AbstractTermsTestCase { .subAggregation(filter("filter1", QueryBuilders.matchAllQuery()).subAggregation( filter("filter2", QueryBuilders.matchAllQuery()) .subAggregation(max("max").field(SINGLE_VALUED_FIELD_NAME)))) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); @@ -660,7 +660,7 @@ public class LongTermsIT extends AbstractTermsTestCase { .field(SINGLE_VALUED_FIELD_NAME) .collectMode(randomFrom(SubAggCollectionMode.values())) .order(BucketOrder.aggregation("avg_i", true)) - ).execute().actionGet(); + ).get(); fail("Expected search to fail when trying to sort terms aggregation by sug-aggregation that doesn't exist"); @@ -680,7 +680,7 @@ public class LongTermsIT extends AbstractTermsTestCase { .order(BucketOrder.aggregation("num_tags", true)) .subAggregation(terms("num_tags").field("num_tags") .collectMode(randomFrom(SubAggCollectionMode.values()))) - ).execute().actionGet(); + ).get(); fail("Expected search to fail when trying to sort terms aggregation by sug-aggregation which is not of a metrics type"); @@ -699,7 +699,7 @@ public class LongTermsIT extends AbstractTermsTestCase { .collectMode(randomFrom(SubAggCollectionMode.values())) .order(BucketOrder.aggregation("stats.foo", true)) .subAggregation(stats("stats").field(SINGLE_VALUED_FIELD_NAME)) - ).execute().actionGet(); + ).get(); fail("Expected search to fail when trying to sort terms aggregation by multi-valued sug-aggregation " + "with an unknown specified metric to order by"); @@ -719,7 +719,7 @@ public class LongTermsIT extends AbstractTermsTestCase { .collectMode(randomFrom(SubAggCollectionMode.values())) .order(BucketOrder.aggregation("stats", true)) .subAggregation(stats("stats").field(SINGLE_VALUED_FIELD_NAME)) - ).execute().actionGet(); + ).get(); fail("Expected search to fail when trying to sort terms aggregation by multi-valued sug-aggregation " + "where the metric name is not specified"); @@ -738,7 +738,7 @@ public class LongTermsIT extends AbstractTermsTestCase { .collectMode(randomFrom(SubAggCollectionMode.values())) .order(BucketOrder.aggregation("stats.avg", asc)) .subAggregation(stats("stats").field(SINGLE_VALUED_FIELD_NAME)) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); @@ -768,7 +768,7 @@ public class LongTermsIT extends AbstractTermsTestCase { .collectMode(randomFrom(SubAggCollectionMode.values())) .order(BucketOrder.aggregation("stats.avg", asc)) .subAggregation(stats("stats").field(SINGLE_VALUED_FIELD_NAME)) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); @@ -798,7 +798,7 @@ public class LongTermsIT extends AbstractTermsTestCase { .collectMode(randomFrom(SubAggCollectionMode.values())) .order(BucketOrder.aggregation("stats.variance", asc)) .subAggregation(extendedStats("stats").field(SINGLE_VALUED_FIELD_NAME)) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); @@ -865,7 +865,7 @@ public class LongTermsIT extends AbstractTermsTestCase { .order(BucketOrder.compound(order)) .subAggregation(avg("avg_l").field("l")) .subAggregation(sum("sum_d").field("d")) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/MinDocCountIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/MinDocCountIT.java index 3013b59edce..d0e8dcf4d0b 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/MinDocCountIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/MinDocCountIT.java @@ -318,7 +318,7 @@ public class MinDocCountIT extends AbstractTermsTestCase { .order(order) .size(cardinality + randomInt(10)) .minDocCount(0)) - .execute().actionGet(); + .get(); assertAllSuccessful(allTermsResponse); final Terms allTerms = allTermsResponse.getAggregations().get("terms"); @@ -381,7 +381,7 @@ public class MinDocCountIT extends AbstractTermsTestCase { .setSize(0) .setQuery(QUERY) .addAggregation(histogram("histo").field("d").interval(interval).order(order).minDocCount(0)) - .execute().actionGet(); + .get(); final Histogram allHisto = allResponse.getAggregations().get("histo"); @@ -390,7 +390,7 @@ public class MinDocCountIT extends AbstractTermsTestCase { .setSize(0) .setQuery(QUERY) .addAggregation(histogram("histo").field("d").interval(interval).order(order).minDocCount(minDocCount)) - .execute().actionGet(); + .get(); assertSubset(allHisto, (Histogram) response.getAggregations().get("histo"), minDocCount); } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/MissingIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/MissingIT.java index 4788aac5bf9..5e56123261c 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/MissingIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/MissingIT.java @@ -75,7 +75,7 @@ public class MissingIT extends ESIntegTestCase { .endObject())); } - prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").execute().actionGet(); + prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").get(); for (int i = 0; i < 2; i++) { builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder() .startObject() @@ -90,7 +90,7 @@ public class MissingIT extends ESIntegTestCase { public void testUnmapped() throws Exception { SearchResponse response = client().prepareSearch("unmapped_idx") .addAggregation(missing("missing_tag").field("tag")) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -104,7 +104,7 @@ public class MissingIT extends ESIntegTestCase { public void testPartiallyUnmapped() throws Exception { SearchResponse response = client().prepareSearch("idx", "unmapped_idx") .addAggregation(missing("missing_tag").field("tag")) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -118,7 +118,7 @@ public class MissingIT extends ESIntegTestCase { public void testSimple() throws Exception { SearchResponse response = client().prepareSearch("idx") .addAggregation(missing("missing_tag").field("tag")) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -133,7 +133,7 @@ public class MissingIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx", "unmapped_idx") .addAggregation(missing("missing_tag").field("tag") .subAggregation(avg("avg_value").field("value"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -157,7 +157,8 @@ public class MissingIT extends ESIntegTestCase { assertThat(avgValue, notNullValue()); assertThat(avgValue.getName(), equalTo("avg_value")); assertThat(avgValue.getValue(), equalTo((double) sum / (numDocsMissing + numDocsUnmapped))); - assertThat((double) ((InternalAggregation)missing).getProperty("avg_value.value"), equalTo((double) sum / (numDocsMissing + numDocsUnmapped))); + assertThat((double) ((InternalAggregation)missing).getProperty("avg_value.value"), + equalTo((double) sum / (numDocsMissing + numDocsUnmapped))); } public void testEmptyAggregation() throws Exception { @@ -165,7 +166,7 @@ public class MissingIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .addAggregation(histogram("histo").field("value").interval(1L).minDocCount(0) .subAggregation(missing("missing").field("value"))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/NaNSortingIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/NaNSortingIT.java index 22b6e252522..ef0b7420b50 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/NaNSortingIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/NaNSortingIT.java @@ -99,7 +99,8 @@ public class NaNSortingIT extends ESIntegTestCase { public String name; - public abstract ValuesSourceAggregationBuilder.LeafOnly> builder(); + public abstract ValuesSourceAggregationBuilder.LeafOnly> builder(); public String sortKey() { return name; @@ -115,11 +116,12 @@ public class NaNSortingIT extends ESIntegTestCase { final int numDocs = randomIntBetween(2, 10); for (int i = 0; i < numDocs; ++i) { final long value = randomInt(5); - XContentBuilder source = jsonBuilder().startObject().field("long_value", value).field("double_value", value + 0.05).field("string_value", "str_" + value); + XContentBuilder source = jsonBuilder().startObject().field("long_value", value).field("double_value", value + 0.05) + .field("string_value", "str_" + value); if (randomBoolean()) { source.field("numeric_value", randomDouble()); } - client().prepareIndex("idx", "type").setSource(source.endObject()).execute().actionGet(); + client().prepareIndex("idx", "type").setSource(source.endObject()).get(); } refresh(); ensureSearchable(); @@ -151,8 +153,9 @@ public class NaNSortingIT extends ESIntegTestCase { final boolean asc = randomBoolean(); SubAggregation agg = randomFrom(SubAggregation.values()); SearchResponse response = client().prepareSearch("idx") - .addAggregation(terms("terms").field(fieldName).collectMode(randomFrom(SubAggCollectionMode.values())).subAggregation(agg.builder()).order(BucketOrder.aggregation(agg.sortKey(), asc))) - .execute().actionGet(); + .addAggregation(terms("terms").field(fieldName).collectMode(randomFrom(SubAggCollectionMode.values())) + .subAggregation(agg.builder()).order(BucketOrder.aggregation(agg.sortKey(), asc))) + .get(); assertSearchResponse(response); final Terms terms = response.getAggregations().get("terms"); @@ -176,8 +179,9 @@ public class NaNSortingIT extends ESIntegTestCase { SubAggregation agg = randomFrom(SubAggregation.values()); SearchResponse response = client().prepareSearch("idx") .addAggregation(histogram("histo") - .field("long_value").interval(randomIntBetween(1, 2)).subAggregation(agg.builder()).order(BucketOrder.aggregation(agg.sortKey(), asc))) - .execute().actionGet(); + .field("long_value").interval(randomIntBetween(1, 2)) + .subAggregation(agg.builder()).order(BucketOrder.aggregation(agg.sortKey(), asc))) + .get(); assertSearchResponse(response); final Histogram histo = response.getAggregations().get("histo"); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/NestedIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/NestedIT.java index beebb6dda91..d68c85ab652 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/NestedIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/NestedIT.java @@ -110,7 +110,7 @@ public class NestedIT extends ESIntegTestCase { builders.add(client().prepareIndex("idx", "type", ""+i+1).setSource(source)); } - prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer", "nested", "type=nested").execute().actionGet(); + prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer", "nested", "type=nested").get(); ensureGreen("empty_bucket_idx"); for (int i = 0; i < 2; i++) { builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder() @@ -170,7 +170,7 @@ public class NestedIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(nested("nested", "nested") .subAggregation(stats("nested_value_stats").field("nested.value"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -208,7 +208,7 @@ public class NestedIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .addAggregation(nested("nested", "value") .subAggregation(stats("nested_value_stats").field("nested.value"))) - .execute().actionGet(); + .get(); Nested nested = searchResponse.getAggregations().get("nested"); assertThat(nested, Matchers.notNullValue()); @@ -221,7 +221,7 @@ public class NestedIT extends ESIntegTestCase { .addAggregation(nested("nested", "nested") .subAggregation(terms("values").field("nested.value").size(100) .collectMode(aggCollectionMode))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -273,7 +273,7 @@ public class NestedIT extends ESIntegTestCase { .collectMode(aggCollectionMode) .subAggregation(nested("nested", "nested") .subAggregation(max("max_value").field("nested.value")))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -335,7 +335,7 @@ public class NestedIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .addAggregation(histogram("histo").field("value").interval(1L).minDocCount(0) .subAggregation(nested("nested", "nested"))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); @@ -354,7 +354,7 @@ public class NestedIT extends ESIntegTestCase { client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(nested("object_field", "incorrect")) - .execute().actionGet(); + .get(); fail(); } catch (SearchPhaseExecutionException e) { assertThat(e.toString(), containsString("[nested] nested path [incorrect] is not nested")); @@ -399,8 +399,14 @@ public class NestedIT extends ESIntegTestCase { ensureGreen("idx2"); List indexRequests = new ArrayList<>(2); - indexRequests.add(client().prepareIndex("idx2", "provider", "1").setSource("{\"dates\": {\"month\": {\"label\": \"2014-11\", \"end\": \"2014-11-30\", \"start\": \"2014-11-01\"}, \"day\": \"2014-11-30\"}, \"comments\": [{\"cid\": 3,\"identifier\": \"29111\"}, {\"cid\": 4,\"tags\": [{\"tid\" :44,\"name\": \"Roles\"}], \"identifier\": \"29101\"}]}", XContentType.JSON)); - indexRequests.add(client().prepareIndex("idx2", "provider", "2").setSource("{\"dates\": {\"month\": {\"label\": \"2014-12\", \"end\": \"2014-12-31\", \"start\": \"2014-12-01\"}, \"day\": \"2014-12-03\"}, \"comments\": [{\"cid\": 1, \"identifier\": \"29111\"}, {\"cid\": 2,\"tags\": [{\"tid\" : 22, \"name\": \"DataChannels\"}], \"identifier\": \"29101\"}]}", XContentType.JSON)); + indexRequests.add(client().prepareIndex("idx2", "provider", "1") + .setSource("{\"dates\": {\"month\": {\"label\": \"2014-11\", \"end\": \"2014-11-30\", \"start\": \"2014-11-01\"}, " + + "\"day\": \"2014-11-30\"}, \"comments\": [{\"cid\": 3,\"identifier\": \"29111\"}, {\"cid\": 4,\"tags\": [" + + "{\"tid\" :44,\"name\": \"Roles\"}], \"identifier\": \"29101\"}]}", XContentType.JSON)); + indexRequests.add(client().prepareIndex("idx2", "provider", "2") + .setSource("{\"dates\": {\"month\": {\"label\": \"2014-12\", \"end\": \"2014-12-31\", \"start\": \"2014-12-01\"}, " + + "\"day\": \"2014-12-03\"}, \"comments\": [{\"cid\": 1, \"identifier\": \"29111\"}, {\"cid\": 2,\"tags\": [" + + "{\"tid\" : 22, \"name\": \"DataChannels\"}], \"identifier\": \"29101\"}]}", XContentType.JSON)); indexRandom(true, indexRequests); SearchResponse response = client().prepareSearch("idx2").setTypes("provider") @@ -647,7 +653,8 @@ public class NestedIT extends ESIntegTestCase { response = client().prepareSearch("classes").addAggregation(nested("to_method", "methods") .subAggregation(terms("return_type").field("methods.return_type").subAggregation( - filter("num_string_params", nestedQuery("methods.parameters", termQuery("methods.parameters.type", "String"), ScoreMode.None)) + filter("num_string_params", nestedQuery("methods.parameters", + termQuery("methods.parameters.type", "String"), ScoreMode.None)) ) )).get(); toMethods = response.getAggregations().get("to_method"); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/RangeIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/RangeIT.java index ec2b9e8d380..c6b05e3c4f7 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/RangeIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/RangeIT.java @@ -107,7 +107,7 @@ public class RangeIT extends ESIntegTestCase { .endObject())); } createIndex("idx_unmapped"); - prepareCreate("empty_bucket_idx").addMapping("type", SINGLE_VALUED_FIELD_NAME, "type=integer").execute().actionGet(); + prepareCreate("empty_bucket_idx").addMapping("type", SINGLE_VALUED_FIELD_NAME, "type=integer").get(); for (int i = 0; i < 2; i++) { builders.add(client().prepareIndex("empty_bucket_idx", "type", "" + i).setSource(jsonBuilder() .startObject() @@ -142,7 +142,7 @@ public class RangeIT extends ESIntegTestCase { .addUnboundedTo(3) .addRange(3, 6) .addUnboundedFrom(6))) - .execute().actionGet(); + .get(); assertSearchResponse(response); Terms terms = response.getAggregations().get("terms"); @@ -204,7 +204,7 @@ public class RangeIT extends ESIntegTestCase { .addUnboundedTo(3) .addRange(3, 6) .addUnboundedFrom(6)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -248,7 +248,7 @@ public class RangeIT extends ESIntegTestCase { .prepareSearch("idx") .addAggregation( range("range").field(SINGLE_VALUED_FIELD_NAME).addUnboundedTo(3).addRange(3, 6).addUnboundedFrom(6).format("#")) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -294,7 +294,7 @@ public class RangeIT extends ESIntegTestCase { .addUnboundedTo("r1", 3) .addRange("r2", 3, 6) .addUnboundedFrom("r3", 6)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -341,7 +341,7 @@ public class RangeIT extends ESIntegTestCase { .addRange(3, 6) .addUnboundedFrom(6) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -473,7 +473,7 @@ public class RangeIT extends ESIntegTestCase { .addUnboundedTo(3) .addRange(3, 6) .addUnboundedFrom(6)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -647,7 +647,7 @@ public class RangeIT extends ESIntegTestCase { .field(MULTI_VALUED_FIELD_NAME) .addUnboundedTo(-1) .addUnboundedFrom(1000)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -682,7 +682,7 @@ public class RangeIT extends ESIntegTestCase { client().prepareSearch("idx") .addAggregation(range("foobar") .field(SINGLE_VALUED_FIELD_NAME)) - .execute().actionGet(); + .get(); fail(); } catch (SearchPhaseExecutionException spee){ Throwable rootCause = spee.getCause().getCause(); @@ -766,7 +766,7 @@ public class RangeIT extends ESIntegTestCase { .addUnboundedTo(3) .addRange(3, 6) .addUnboundedFrom(6)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -806,7 +806,7 @@ public class RangeIT extends ESIntegTestCase { } public void testPartiallyUnmapped() throws Exception { - client().admin().cluster().prepareHealth("idx_unmapped").setWaitForYellowStatus().execute().actionGet(); + client().admin().cluster().prepareHealth("idx_unmapped").setWaitForYellowStatus().get(); SearchResponse response = client().prepareSearch("idx", "idx_unmapped") .addAggregation(range("range") @@ -814,7 +814,7 @@ public class RangeIT extends ESIntegTestCase { .addUnboundedTo(3) .addRange(3, 6) .addUnboundedFrom(6)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -861,7 +861,7 @@ public class RangeIT extends ESIntegTestCase { .addRange(3, 6) .addRange(4, 5) .addUnboundedFrom(4)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -994,7 +994,7 @@ public class RangeIT extends ESIntegTestCase { .addUnboundedTo(50.0) .addRange(50.0, 150.0) .addUnboundedFrom(150.0)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -1029,7 +1029,7 @@ public class RangeIT extends ESIntegTestCase { .addUnboundedTo(50.0) .addRange(50.0, 150.0) .addUnboundedFrom(150.0)) - .execute().actionGet(); + .get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/ReverseNestedIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/ReverseNestedIT.java index 6a3a9731612..b2a2460026d 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/ReverseNestedIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/ReverseNestedIT.java @@ -614,7 +614,8 @@ public class ReverseNestedIT extends ESIntegTestCase { nested("nested_1", "sku").subAggregation( filter("filter_by_sku", termQuery("sku.sku_type", "bar1")).subAggregation( nested("nested_2", "sku.colors").subAggregation( - filter("filter_sku_color", termQuery("sku.colors.name", "red")).subAggregation( + filter("filter_sku_color", termQuery("sku.colors.name", "red")) + .subAggregation( reverseNested("reverse_to_sku").path("sku").subAggregation( count("sku_count").field("sku.sku_type") ) diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/SamplerIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/SamplerIT.java index c135f284dd2..2ac5e74345f 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/SamplerIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/SamplerIT.java @@ -90,8 +90,10 @@ public class SamplerIT extends ESIntegTestCase { for (int i = 0; i < data.length; i++) { String[] parts = data[i].split(","); - client().prepareIndex("test", "book", "" + i).setSource("author", parts[5], "name", parts[2], "genre", parts[8], "price",Float.parseFloat(parts[3])).get(); - client().prepareIndex("idx_unmapped_author", "book", "" + i).setSource("name", parts[2], "genre", parts[8],"price",Float.parseFloat(parts[3])).get(); + client().prepareIndex("test", "book", "" + i) + .setSource("author", parts[5], "name", parts[2], "genre", parts[8], "price",Float.parseFloat(parts[3])).get(); + client().prepareIndex("idx_unmapped_author", "book", "" + i) + .setSource("name", parts[2], "genre", parts[8],"price",Float.parseFloat(parts[3])).get(); } client().admin().indices().refresh(new RefreshRequest("test")).get(); } @@ -106,7 +108,7 @@ public class SamplerIT extends ESIntegTestCase { .order(BucketOrder.aggregation("sample>max_price.value", asc)) .subAggregation(sampler("sample").shardSize(100) .subAggregation(max("max_price").field("price"))) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); Terms genres = response.getAggregations().get("genres"); List genreBuckets = genres.getBuckets(); @@ -131,7 +133,7 @@ public class SamplerIT extends ESIntegTestCase { SamplerAggregationBuilder sampleAgg = sampler("sample").shardSize(100); sampleAgg.subAggregation(terms("authors").field("author")); SearchResponse response = client().prepareSearch("test").setSearchType(SearchType.QUERY_THEN_FETCH) - .setQuery(new TermQueryBuilder("genre", "fantasy")).setFrom(0).setSize(60).addAggregation(sampleAgg).execute().actionGet(); + .setQuery(new TermQueryBuilder("genre", "fantasy")).setFrom(0).setSize(60).addAggregation(sampleAgg).get(); assertSearchResponse(response); Sampler sample = response.getAggregations().get("sample"); Terms authors = sample.getAggregations().get("authors"); @@ -152,8 +154,7 @@ public class SamplerIT extends ESIntegTestCase { .setQuery(new TermQueryBuilder("genre", "fantasy")) .setFrom(0).setSize(60) .addAggregation(sampleAgg) - .execute() - .actionGet(); + .get(); assertSearchResponse(response); Sampler sample = response.getAggregations().get("sample"); assertThat(sample.getDocCount(), equalTo(0L)); @@ -169,8 +170,7 @@ public class SamplerIT extends ESIntegTestCase { .setQuery(new TermQueryBuilder("genre", "fantasy")) .setFrom(0).setSize(60).setExplain(true) .addAggregation(sampleAgg) - .execute() - .actionGet(); + .get(); assertSearchResponse(response); Sampler sample = response.getAggregations().get("sample"); assertThat(sample.getDocCount(), greaterThan(0L)); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/ShardReduceIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/ShardReduceIT.java index 7567e3c1441..18ab80305dd 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/ShardReduceIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/ShardReduceIT.java @@ -92,8 +92,9 @@ public class ShardReduceIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .setQuery(QueryBuilders.matchAllQuery()) .addAggregation(global("global") - .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(0))) - .execute().actionGet(); + .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY) + .minDocCount(0))) + .get(); assertSearchResponse(response); @@ -106,8 +107,9 @@ public class ShardReduceIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .setQuery(QueryBuilders.matchAllQuery()) .addAggregation(filter("filter", QueryBuilders.matchAllQuery()) - .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(0))) - .execute().actionGet(); + .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY) + .minDocCount(0))) + .get(); assertSearchResponse(response); @@ -120,8 +122,9 @@ public class ShardReduceIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .setQuery(QueryBuilders.matchAllQuery()) .addAggregation(missing("missing").field("foobar") - .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(0))) - .execute().actionGet(); + .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY) + .minDocCount(0))) + .get(); assertSearchResponse(response); @@ -136,8 +139,9 @@ public class ShardReduceIT extends ESIntegTestCase { .addAggregation(global("global") .subAggregation(filter("filter", QueryBuilders.matchAllQuery()) .subAggregation(missing("missing").field("foobar") - .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(0))))) - .execute().actionGet(); + .subAggregation(dateHistogram("histo").field("date") + .dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(0))))) + .get(); assertSearchResponse(response); @@ -152,8 +156,9 @@ public class ShardReduceIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .setQuery(QueryBuilders.matchAllQuery()) .addAggregation(nested("nested", "nested") - .subAggregation(dateHistogram("histo").field("nested.date").dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(0))) - .execute().actionGet(); + .subAggregation(dateHistogram("histo").field("nested.date").dateHistogramInterval(DateHistogramInterval.DAY) + .minDocCount(0))) + .get(); assertSearchResponse(response); @@ -167,8 +172,9 @@ public class ShardReduceIT extends ESIntegTestCase { .setQuery(QueryBuilders.matchAllQuery()) .addAggregation(terms("terms").field("term-s") .collectMode(randomFrom(SubAggCollectionMode.values())) - .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(0))) - .execute().actionGet(); + .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY) + .minDocCount(0))) + .get(); assertSearchResponse(response); @@ -182,8 +188,9 @@ public class ShardReduceIT extends ESIntegTestCase { .setQuery(QueryBuilders.matchAllQuery()) .addAggregation(terms("terms").field("term-l") .collectMode(randomFrom(SubAggCollectionMode.values())) - .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(0))) - .execute().actionGet(); + .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY) + .minDocCount(0))) + .get(); assertSearchResponse(response); @@ -197,8 +204,9 @@ public class ShardReduceIT extends ESIntegTestCase { .setQuery(QueryBuilders.matchAllQuery()) .addAggregation(terms("terms").field("term-d") .collectMode(randomFrom(SubAggCollectionMode.values())) - .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(0))) - .execute().actionGet(); + .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY) + .minDocCount(0))) + .get(); assertSearchResponse(response); @@ -211,8 +219,9 @@ public class ShardReduceIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .setQuery(QueryBuilders.matchAllQuery()) .addAggregation(range("range").field("value").addRange("r1", 0, 10) - .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(0))) - .execute().actionGet(); + .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY) + .minDocCount(0))) + .get(); assertSearchResponse(response); @@ -225,8 +234,9 @@ public class ShardReduceIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .setQuery(QueryBuilders.matchAllQuery()) .addAggregation(dateRange("range").field("date").addRange("r1", "2014-01-01", "2014-01-10") - .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(0))) - .execute().actionGet(); + .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY) + .minDocCount(0))) + .get(); assertSearchResponse(response); @@ -239,8 +249,9 @@ public class ShardReduceIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .setQuery(QueryBuilders.matchAllQuery()) .addAggregation(ipRange("range").field("ip").addRange("r1", "10.0.0.1", "10.0.0.10") - .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(0))) - .execute().actionGet(); + .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY) + .minDocCount(0))) + .get(); assertSearchResponse(response); @@ -253,8 +264,9 @@ public class ShardReduceIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .setQuery(QueryBuilders.matchAllQuery()) .addAggregation(histogram("topHisto").field("value").interval(5) - .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(0))) - .execute().actionGet(); + .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY) + .minDocCount(0))) + .get(); assertSearchResponse(response); @@ -267,8 +279,9 @@ public class ShardReduceIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .setQuery(QueryBuilders.matchAllQuery()) .addAggregation(dateHistogram("topHisto").field("date").dateHistogramInterval(DateHistogramInterval.MONTH) - .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(0))) - .execute().actionGet(); + .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY) + .minDocCount(0))) + .get(); assertSearchResponse(response); @@ -282,8 +295,9 @@ public class ShardReduceIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .setQuery(QueryBuilders.matchAllQuery()) .addAggregation(geohashGrid("grid").field("location") - .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(0))) - .execute().actionGet(); + .subAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY) + .minDocCount(0))) + .get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/ShardSizeTermsIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/ShardSizeTermsIT.java index 4c03ca9a84e..2953324c58c 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/ShardSizeTermsIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/ShardSizeTermsIT.java @@ -41,7 +41,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase { .setQuery(matchAllQuery()) .addAggregation(terms("keys").field("key").size(3) .collectMode(randomFrom(SubAggCollectionMode.values())).order(BucketOrder.count(false))) - .execute().actionGet(); + .get(); Terms terms = response.getAggregations().get("keys"); List buckets = terms.getBuckets(); @@ -64,7 +64,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase { .setQuery(matchAllQuery()) .addAggregation(terms("keys").field("key").size(3).shardSize(3) .collectMode(randomFrom(SubAggCollectionMode.values())).order(BucketOrder.count(false))) - .execute().actionGet(); + .get(); Terms terms = response.getAggregations().get("keys"); List buckets = terms.getBuckets(); @@ -88,7 +88,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase { .setQuery(matchAllQuery()) .addAggregation(terms("keys").field("key").size(3) .collectMode(randomFrom(SubAggCollectionMode.values())).shardSize(5).order(BucketOrder.count(false))) - .execute().actionGet(); + .get(); Terms terms = response.getAggregations().get("keys"); List buckets = terms.getBuckets(); @@ -112,7 +112,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase { .setQuery(matchAllQuery()) .addAggregation(terms("keys").field("key").size(3) .collectMode(randomFrom(SubAggCollectionMode.values())).shardSize(5).order(BucketOrder.count(false))) - .execute().actionGet(); + .get(); Terms terms = response.getAggregations().get("keys"); List buckets = terms.getBuckets(); @@ -135,7 +135,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase { .setQuery(matchAllQuery()) .addAggregation(terms("keys").field("key").size(3) .collectMode(randomFrom(SubAggCollectionMode.values())).order(BucketOrder.key(true))) - .execute().actionGet(); + .get(); Terms terms = response.getAggregations().get("keys"); List buckets = terms.getBuckets(); @@ -158,7 +158,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase { .setQuery(matchAllQuery()) .addAggregation(terms("keys").field("key").size(3) .collectMode(randomFrom(SubAggCollectionMode.values())).order(BucketOrder.count(false))) - .execute().actionGet(); + .get(); Terms terms = response.getAggregations().get("keys"); List buckets = terms.getBuckets(); @@ -181,7 +181,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase { .setQuery(matchAllQuery()) .addAggregation(terms("keys").field("key").size(3).shardSize(3) .collectMode(randomFrom(SubAggCollectionMode.values())).order(BucketOrder.count(false))) - .execute().actionGet(); + .get(); Terms terms = response.getAggregations().get("keys"); List buckets = terms.getBuckets(); @@ -204,7 +204,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase { .setQuery(matchAllQuery()) .addAggregation(terms("keys").field("key").size(3) .collectMode(randomFrom(SubAggCollectionMode.values())).shardSize(5).order(BucketOrder.count(false))) - .execute().actionGet(); + .get(); Terms terms = response.getAggregations().get("keys"); List buckets = terms.getBuckets(); @@ -228,7 +228,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase { .setQuery(matchAllQuery()) .addAggregation(terms("keys").field("key").size(3) .collectMode(randomFrom(SubAggCollectionMode.values())).shardSize(5).order(BucketOrder.count(false))) - .execute().actionGet(); + .get(); Terms terms = response.getAggregations().get("keys"); List buckets = terms.getBuckets(); @@ -251,7 +251,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase { .setQuery(matchAllQuery()) .addAggregation(terms("keys").field("key").size(3) .collectMode(randomFrom(SubAggCollectionMode.values())).order(BucketOrder.key(true))) - .execute().actionGet(); + .get(); Terms terms = response.getAggregations().get("keys"); List buckets = terms.getBuckets(); @@ -274,7 +274,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase { .setQuery(matchAllQuery()) .addAggregation(terms("keys").field("key").size(3) .collectMode(randomFrom(SubAggCollectionMode.values())).order(BucketOrder.count(false))) - .execute().actionGet(); + .get(); Terms terms = response.getAggregations().get("keys"); List buckets = terms.getBuckets(); @@ -297,7 +297,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase { .setQuery(matchAllQuery()) .addAggregation(terms("keys").field("key").size(3).shardSize(3) .collectMode(randomFrom(SubAggCollectionMode.values())).order(BucketOrder.count(false))) - .execute().actionGet(); + .get(); Terms terms = response.getAggregations().get("keys"); List buckets = terms.getBuckets(); @@ -320,7 +320,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase { .setQuery(matchAllQuery()) .addAggregation(terms("keys").field("key").size(3) .collectMode(randomFrom(SubAggCollectionMode.values())).shardSize(5).order(BucketOrder.count(false))) - .execute().actionGet(); + .get(); Terms terms = response.getAggregations().get("keys"); List buckets = terms.getBuckets(); @@ -343,7 +343,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase { .setQuery(matchAllQuery()) .addAggregation(terms("keys").field("key").size(3) .collectMode(randomFrom(SubAggCollectionMode.values())).shardSize(5).order(BucketOrder.count(false))) - .execute().actionGet(); + .get(); Terms terms = response.getAggregations().get("keys"); List buckets = terms.getBuckets(); @@ -366,7 +366,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase { .setQuery(matchAllQuery()) .addAggregation(terms("keys").field("key").size(3) .collectMode(randomFrom(SubAggCollectionMode.values())).order(BucketOrder.key(true))) - .execute().actionGet(); + .get(); Terms terms = response.getAggregations().get("keys"); List buckets = terms.getBuckets(); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/ShardSizeTestCase.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/ShardSizeTestCase.java index 7dc2385e838..4e4bfce5ecb 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/ShardSizeTestCase.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/ShardSizeTestCase.java @@ -90,11 +90,11 @@ public abstract class ShardSizeTestCase extends ESIntegTestCase { indexRandom(true, docs); - SearchResponse resp = client().prepareSearch("idx").setTypes("type").setRouting(routing1).setQuery(matchAllQuery()).execute().actionGet(); + SearchResponse resp = client().prepareSearch("idx").setTypes("type").setRouting(routing1).setQuery(matchAllQuery()).get(); assertSearchResponse(resp); long totalOnOne = resp.getHits().getTotalHits().value; assertThat(totalOnOne, is(15L)); - resp = client().prepareSearch("idx").setTypes("type").setRouting(routing2).setQuery(matchAllQuery()).execute().actionGet(); + resp = client().prepareSearch("idx").setTypes("type").setRouting(routing2).setQuery(matchAllQuery()).get(); assertSearchResponse(resp); long totalOnTwo = resp.getHits().getTotalHits().value; assertThat(totalOnTwo, is(12L)); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/SignificantTermsSignificanceScoreIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/SignificantTermsSignificanceScoreIT.java index 79d0a0ad17e..658f8308571 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/SignificantTermsSignificanceScoreIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/SignificantTermsSignificanceScoreIT.java @@ -132,7 +132,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase { ); } - SearchResponse response = request.execute().actionGet(); + SearchResponse response = request.get(); assertSearchResponse(response); StringTerms classes = response.getAggregations().get("class"); assertThat(classes.getBuckets().size(), equalTo(2)); @@ -154,7 +154,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase { // we run the same test again but this time we do not call assertSearchResponse() before the assertions // the reason is that this would trigger toXContent and we would like to check that this has no potential side effects - response = request.execute().actionGet(); + response = request.get(); classes = (StringTerms) response.getAggregations().get("class"); assertThat(classes.getBuckets().size(), equalTo(2)); @@ -283,7 +283,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase { .subAggregation(significantTerms("sig_terms").field(TEXT_FIELD))); } - SearchResponse response = request.execute().actionGet(); + SearchResponse response = request.get(); assertSearchResponse(response); @@ -392,7 +392,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase { .minDocCount(1))); } - request.execute().actionGet(); + request.get(); } @@ -437,7 +437,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase { significanceHeuristicExpectingSuperset))); } - SearchResponse response1 = request1.execute().actionGet(); + SearchResponse response1 = request1.get(); assertSearchResponse(response1); SearchRequestBuilder request2; @@ -470,7 +470,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase { .significanceHeuristic(significanceHeuristicExpectingSeparateSets))); } - SearchResponse response2 = request2.execute().actionGet(); + SearchResponse response2 = request2.get(); StringTerms classes = response1.getAggregations().get("class"); @@ -522,7 +522,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase { .significanceHeuristic(heuristic) .minDocCount(1).shardSize(1000).size(1000))); } - SearchResponse response = request.execute().actionGet(); + SearchResponse response = request.get(); assertSearchResponse(response); assertSearchResponse(response); @@ -600,7 +600,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase { .significanceHeuristic(scriptHeuristic) .minDocCount(1).shardSize(2).size(2))); } - SearchResponse response = request.execute().actionGet(); + SearchResponse response = request.get(); assertSearchResponse(response); for (Terms.Bucket classBucket : ((Terms) response.getAggregations().get("class")).getBuckets()) { SignificantTerms sigTerms = classBucket.getAggregations().get("mySignificantTerms"); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/TermsDocCountErrorIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/TermsDocCountErrorIT.java index 8fa965ab46d..04fe0d57518 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/TermsDocCountErrorIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/TermsDocCountErrorIT.java @@ -270,7 +270,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .showTermDocCountError(true) .size(10000).shardSize(10000) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -282,7 +282,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(size) .shardSize(shardSize) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -299,7 +299,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .showTermDocCountError(true) .size(10000).shardSize(10000) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -311,7 +311,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(size) .shardSize(shardSize) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -322,7 +322,8 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { int size = randomIntBetween(1, 20); int shardSize = randomIntBetween(size, size * 2); - SearchResponse testResponse = client().prepareSearch("idx_with_routing").setTypes("type").setRouting(String.valueOf(between(1, numRoutingValues))) + SearchResponse testResponse = client().prepareSearch("idx_with_routing").setTypes("type") + .setRouting(String.valueOf(between(1, numRoutingValues))) .addAggregation(terms("terms") .executionHint(randomExecutionHint()) .field(STRING_FIELD_NAME) @@ -330,7 +331,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(size) .shardSize(shardSize) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -348,7 +349,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(10000).shardSize(10000) .order(BucketOrder.count(true)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -361,7 +362,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .shardSize(shardSize) .order(BucketOrder.count(true)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -379,7 +380,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(10000).shardSize(10000) .order(BucketOrder.key(true)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -392,7 +393,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .shardSize(shardSize) .order(BucketOrder.key(true)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -410,7 +411,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(10000).shardSize(10000) .order(BucketOrder.key(false)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -423,7 +424,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .shardSize(shardSize) .order(BucketOrder.key(false)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -442,7 +443,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .order(BucketOrder.aggregation("sortAgg", true)) .collectMode(randomFrom(SubAggCollectionMode.values())) .subAggregation(sum("sortAgg").field(LONG_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -456,7 +457,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .order(BucketOrder.aggregation("sortAgg", true)) .collectMode(randomFrom(SubAggCollectionMode.values())) .subAggregation(sum("sortAgg").field(LONG_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -475,7 +476,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .order(BucketOrder.aggregation("sortAgg", false)) .collectMode(randomFrom(SubAggCollectionMode.values())) .subAggregation(sum("sortAgg").field(LONG_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -489,7 +490,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .order(BucketOrder.aggregation("sortAgg", false)) .collectMode(randomFrom(SubAggCollectionMode.values())) .subAggregation(sum("sortAgg").field(LONG_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -506,7 +507,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .showTermDocCountError(true) .size(10000).shardSize(10000) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -518,7 +519,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(size) .shardSize(shardSize) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -535,7 +536,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .showTermDocCountError(true) .size(10000).shardSize(10000) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -547,7 +548,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(size) .shardSize(shardSize) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -558,7 +559,8 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { int size = randomIntBetween(1, 20); int shardSize = randomIntBetween(size, size * 2); - SearchResponse testResponse = client().prepareSearch("idx_with_routing").setTypes("type").setRouting(String.valueOf(between(1, numRoutingValues))) + SearchResponse testResponse = client().prepareSearch("idx_with_routing").setTypes("type") + .setRouting(String.valueOf(between(1, numRoutingValues))) .addAggregation(terms("terms") .executionHint(randomExecutionHint()) .field(LONG_FIELD_NAME) @@ -566,7 +568,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(size) .shardSize(shardSize) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -584,7 +586,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(10000).shardSize(10000) .order(BucketOrder.count(true)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -597,7 +599,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .shardSize(shardSize) .order(BucketOrder.count(true)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -615,7 +617,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(10000).shardSize(10000) .order(BucketOrder.key(true)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -628,7 +630,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .shardSize(shardSize) .order(BucketOrder.key(true)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -646,7 +648,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(10000).shardSize(10000) .order(BucketOrder.key(false)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -659,7 +661,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .shardSize(shardSize) .order(BucketOrder.key(false)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -678,7 +680,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .order(BucketOrder.aggregation("sortAgg", true)) .collectMode(randomFrom(SubAggCollectionMode.values())) .subAggregation(sum("sortAgg").field(LONG_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -692,7 +694,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .order(BucketOrder.aggregation("sortAgg", true)) .collectMode(randomFrom(SubAggCollectionMode.values())) .subAggregation(sum("sortAgg").field(LONG_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -711,7 +713,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .order(BucketOrder.aggregation("sortAgg", false)) .collectMode(randomFrom(SubAggCollectionMode.values())) .subAggregation(sum("sortAgg").field(DOUBLE_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -725,7 +727,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .order(BucketOrder.aggregation("sortAgg", false)) .collectMode(randomFrom(SubAggCollectionMode.values())) .subAggregation(sum("sortAgg").field(DOUBLE_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -742,7 +744,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .showTermDocCountError(true) .size(10000).shardSize(10000) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -754,7 +756,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(size) .shardSize(shardSize) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -771,7 +773,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .showTermDocCountError(true) .size(10000).shardSize(10000) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -783,7 +785,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(size) .shardSize(shardSize) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -794,7 +796,8 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { int size = randomIntBetween(1, 20); int shardSize = randomIntBetween(size, size * 2); - SearchResponse testResponse = client().prepareSearch("idx_with_routing").setTypes("type").setRouting(String.valueOf(between(1, numRoutingValues))) + SearchResponse testResponse = client().prepareSearch("idx_with_routing").setTypes("type") + .setRouting(String.valueOf(between(1, numRoutingValues))) .addAggregation(terms("terms") .executionHint(randomExecutionHint()) .field(DOUBLE_FIELD_NAME) @@ -802,7 +805,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(size) .shardSize(shardSize) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -820,7 +823,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(10000).shardSize(10000) .order(BucketOrder.count(true)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -833,7 +836,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .shardSize(shardSize) .order(BucketOrder.count(true)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -851,7 +854,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(10000).shardSize(10000) .order(BucketOrder.key(true)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -864,7 +867,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .shardSize(shardSize) .order(BucketOrder.key(true)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -882,7 +885,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .size(10000).shardSize(10000) .order(BucketOrder.key(false)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -895,7 +898,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .shardSize(shardSize) .order(BucketOrder.key(false)) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -914,7 +917,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .order(BucketOrder.aggregation("sortAgg", true)) .collectMode(randomFrom(SubAggCollectionMode.values())) .subAggregation(sum("sortAgg").field(LONG_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -928,7 +931,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .order(BucketOrder.aggregation("sortAgg", true)) .collectMode(randomFrom(SubAggCollectionMode.values())) .subAggregation(sum("sortAgg").field(LONG_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -947,7 +950,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .order(BucketOrder.aggregation("sortAgg", false)) .collectMode(randomFrom(SubAggCollectionMode.values())) .subAggregation(sum("sortAgg").field(LONG_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(accurateResponse); @@ -961,7 +964,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .order(BucketOrder.aggregation("sortAgg", false)) .collectMode(randomFrom(SubAggCollectionMode.values())) .subAggregation(sum("sortAgg").field(LONG_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(testResponse); @@ -981,7 +984,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase { .showTermDocCountError(true) .size(5).shardSize(5) .collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(response); Terms terms = response.getAggregations().get("terms"); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/TermsShardMinDocCountIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/TermsShardMinDocCountIT.java index 8d14d0cecd4..0f685ded62c 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/TermsShardMinDocCountIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/TermsShardMinDocCountIT.java @@ -74,10 +74,10 @@ public class TermsShardMinDocCountIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch(index) .addAggregation( (filter("inclass", QueryBuilders.termQuery("class", true))) - .subAggregation(significantTerms("mySignificantTerms").field("text").minDocCount(2).size(2).executionHint(randomExecutionHint())) + .subAggregation(significantTerms("mySignificantTerms").field("text").minDocCount(2).size(2) + .executionHint(randomExecutionHint())) ) - .execute() - .actionGet(); + .get(); assertSearchResponse(response); InternalFilter filteredBucket = response.getAggregations().get("inclass"); SignificantTerms sigterms = filteredBucket.getAggregations().get("mySignificantTerms"); @@ -87,10 +87,11 @@ public class TermsShardMinDocCountIT extends ESIntegTestCase { response = client().prepareSearch(index) .addAggregation( (filter("inclass", QueryBuilders.termQuery("class", true))) - .subAggregation(significantTerms("mySignificantTerms").field("text").minDocCount(2).shardMinDocCount(2).size(2).executionHint(randomExecutionHint())) + .subAggregation(significantTerms("mySignificantTerms").field("text").minDocCount(2) + .shardMinDocCount(2).size(2) + .executionHint(randomExecutionHint())) ) - .execute() - .actionGet(); + .get(); assertSearchResponse(response); filteredBucket = response.getAggregations().get("inclass"); sigterms = filteredBucket.getAggregations().get("mySignificantTerms"); @@ -132,10 +133,10 @@ public class TermsShardMinDocCountIT extends ESIntegTestCase { // first, check that indeed when not setting the shardMinDocCount parameter 0 terms are returned SearchResponse response = client().prepareSearch(index) .addAggregation( - terms("myTerms").field("text").minDocCount(2).size(2).executionHint(randomExecutionHint()).order(BucketOrder.key(true)) + terms("myTerms").field("text").minDocCount(2).size(2).executionHint(randomExecutionHint()) + .order(BucketOrder.key(true)) ) - .execute() - .actionGet(); + .get(); assertSearchResponse(response); Terms sigterms = response.getAggregations().get("myTerms"); assertThat(sigterms.getBuckets().size(), equalTo(0)); @@ -143,10 +144,10 @@ public class TermsShardMinDocCountIT extends ESIntegTestCase { response = client().prepareSearch(index) .addAggregation( - terms("myTerms").field("text").minDocCount(2).shardMinDocCount(2).size(2).executionHint(randomExecutionHint()).order(BucketOrder.key(true)) + terms("myTerms").field("text").minDocCount(2).shardMinDocCount(2).size(2).executionHint(randomExecutionHint()) + .order(BucketOrder.key(true)) ) - .execute() - .actionGet(); + .get(); assertSearchResponse(response); sigterms = response.getAggregations().get("myTerms"); assertThat(sigterms.getBuckets().size(), equalTo(2)); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregatorTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregatorTests.java index 0abfe871e6e..e9911a7034c 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregatorTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregatorTests.java @@ -352,7 +352,8 @@ public class NestedAggregatorTests extends AggregatorTestCase { new ConstantScoreQuery(bq.build()), nestedBuilder, fieldType); assertEquals(NESTED_AGG, nested.getName()); - // The bug manifests if 6 docs are returned, because currentRootDoc isn't reset the previous child docs from the first segment are emitted as hits. + // The bug manifests if 6 docs are returned, because currentRootDoc isn't reset the previous child docs from the first + // segment are emitted as hits. assertEquals(4L, nested.getDocCount()); } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsIT.java index 3ef91ff4753..274fb2d4ffd 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsIT.java @@ -153,7 +153,7 @@ public class StringTermsIT extends AbstractTermsTestCase { .startArray(MULTI_VALUED_FIELD_NAME).value("val" + Strings.padStart(i + "", 3, '0')) .value("val" + Strings.padStart((i + 1) + "", 3, '0')).endArray().endObject())); } - prepareCreate("empty_bucket_idx").addMapping("type", SINGLE_VALUED_FIELD_NAME, "type=integer").execute().actionGet(); + prepareCreate("empty_bucket_idx").addMapping("type", SINGLE_VALUED_FIELD_NAME, "type=integer").get(); for (int i = 0; i < 2; i++) { builders.add(client().prepareIndex("empty_bucket_idx", "type", "" + i).setSource( @@ -248,8 +248,7 @@ public class StringTermsIT extends AbstractTermsTestCase { .prepareSearch("high_card_idx") .addAggregation( terms("terms").executionHint(randomExecutionHint()).field(SINGLE_VALUED_FIELD_NAME) - .collectMode(randomFrom(SubAggCollectionMode.values())).minDocCount(minDocCount).size(0)).execute() - .actionGet()); + .collectMode(randomFrom(SubAggCollectionMode.values())).minDocCount(minDocCount).size(0)).get()); assertThat(exception.getMessage(), containsString("[size] must be greater than 0. Found [0] in [terms]")); } @@ -265,7 +264,7 @@ public class StringTermsIT extends AbstractTermsTestCase { // Find total number of unique terms SearchResponse allResponse = client().prepareSearch("idx").setTypes("type") .addAggregation(terms("terms").field(field).size(10000).collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(allResponse); Terms terms = allResponse.getAggregations().get("terms"); assertThat(terms, notNullValue()); @@ -278,7 +277,7 @@ public class StringTermsIT extends AbstractTermsTestCase { for (int partition = 0; partition < numPartitions; partition++) { SearchResponse response = client().prepareSearch("idx").setTypes("type").addAggregation(terms("terms").field(field) .includeExclude(new IncludeExclude(partition, numPartitions)).collectMode(randomFrom(SubAggCollectionMode.values()))) - .execute().actionGet(); + .get(); assertSearchResponse(response); terms = response.getAggregations().get("terms"); assertThat(terms, notNullValue()); @@ -512,7 +511,7 @@ public class StringTermsIT extends AbstractTermsTestCase { .setTypes("type") .addAggregation( terms("terms").executionHint(randomExecutionHint()).field(SINGLE_VALUED_FIELD_NAME) - .collectMode(randomFrom(SubAggCollectionMode.values()))).execute().actionGet(); + .collectMode(randomFrom(SubAggCollectionMode.values()))).get(); assertSearchResponse(response); @@ -537,7 +536,7 @@ public class StringTermsIT extends AbstractTermsTestCase { .addAggregation( filter("filter", termQuery(MULTI_VALUED_FIELD_NAME, "val3")).subAggregation( terms("terms").field(MULTI_VALUED_FIELD_NAME).collectMode(randomFrom(SubAggCollectionMode.values())))) - .execute().actionGet(); + .get(); assertThat(response.getFailedShards(), equalTo(0)); @@ -567,7 +566,7 @@ public class StringTermsIT extends AbstractTermsTestCase { .collectMode(randomFrom(SubAggCollectionMode.values())) .order(BucketOrder.aggregation("inner_terms>avg", asc)) .subAggregation(terms("inner_terms").field(MULTI_VALUED_FIELD_NAME).subAggregation(avg("avg").field("i")))) - .execute().actionGet(); + .get(); fail("Expected an exception"); } catch (SearchPhaseExecutionException e) { ElasticsearchException[] rootCauses = e.guessRootCauses(); @@ -593,7 +592,7 @@ public class StringTermsIT extends AbstractTermsTestCase { .addAggregation( terms("tags").executionHint(randomExecutionHint()).field("tag") .collectMode(randomFrom(SubAggCollectionMode.values())).order(BucketOrder.aggregation("filter", asc)) - .subAggregation(filter("filter", QueryBuilders.matchAllQuery()))).execute().actionGet(); + .subAggregation(filter("filter", QueryBuilders.matchAllQuery()))).get(); assertSearchResponse(response); @@ -635,7 +634,7 @@ public class StringTermsIT extends AbstractTermsTestCase { .subAggregation( filter("filter1", QueryBuilders.matchAllQuery()).subAggregation( filter("filter2", QueryBuilders.matchAllQuery()).subAggregation( - stats("stats").field("i"))))).execute().actionGet(); + stats("stats").field("i"))))).get(); assertSearchResponse(response); @@ -698,7 +697,7 @@ public class StringTermsIT extends AbstractTermsTestCase { .subAggregation( filter("filter1", QueryBuilders.matchAllQuery()).subAggregation( filter(filter2Name, QueryBuilders.matchAllQuery()).subAggregation( - stats(statsName).field("i"))))).execute().actionGet(); + stats(statsName).field("i"))))).get(); assertSearchResponse(response); @@ -761,7 +760,7 @@ public class StringTermsIT extends AbstractTermsTestCase { .subAggregation( filter("filter1", QueryBuilders.matchAllQuery()).subAggregation( filter(filter2Name, QueryBuilders.matchAllQuery()).subAggregation( - stats(statsName).field("i"))))).execute().actionGet(); + stats(statsName).field("i"))))).get(); assertSearchResponse(response); @@ -812,7 +811,7 @@ public class StringTermsIT extends AbstractTermsTestCase { .addAggregation( terms("terms").executionHint(randomExecutionHint()).field(SINGLE_VALUED_FIELD_NAME) .collectMode(randomFrom(SubAggCollectionMode.values())) - .order(BucketOrder.aggregation("avg_i", true))).execute().actionGet(); + .order(BucketOrder.aggregation("avg_i", true))).get(); fail("Expected search to fail when trying to sort terms aggregation by sug-aggregation that doesn't exist"); @@ -832,7 +831,7 @@ public class StringTermsIT extends AbstractTermsTestCase { .collectMode(randomFrom(SubAggCollectionMode.values())) .order(BucketOrder.aggregation("values", true)) .subAggregation(terms("values").field("i").collectMode(randomFrom(SubAggCollectionMode.values())))) - .execute().actionGet(); + .get(); fail("Expected search to fail when trying to sort terms aggregation by sug-aggregation " + "which is not of a metrics or single-bucket type"); @@ -853,7 +852,7 @@ public class StringTermsIT extends AbstractTermsTestCase { terms("terms").executionHint(randomExecutionHint()).field(SINGLE_VALUED_FIELD_NAME) .collectMode(randomFrom(SubAggCollectionMode.values())) .order(BucketOrder.aggregation("stats.foo", true)).subAggregation(stats("stats").field("i"))) - .execute().actionGet(); + .get(); fail("Expected search to fail when trying to sort terms aggregation by multi-valued sug-aggregation " + "with an unknown specified metric to order by. response had " + response.getFailedShards() + " failed shards."); @@ -891,7 +890,7 @@ public class StringTermsIT extends AbstractTermsTestCase { .addAggregation( terms("terms").executionHint(randomExecutionHint()).field(SINGLE_VALUED_FIELD_NAME) .collectMode(randomFrom(SubAggCollectionMode.values())).order(BucketOrder.aggregation("stats.avg", asc)) - .subAggregation(stats("stats").field("i"))).execute().actionGet(); + .subAggregation(stats("stats").field("i"))).get(); assertSearchResponse(response); @@ -921,7 +920,7 @@ public class StringTermsIT extends AbstractTermsTestCase { .addAggregation( terms("terms").executionHint(randomExecutionHint()).field(SINGLE_VALUED_FIELD_NAME) .collectMode(randomFrom(SubAggCollectionMode.values())).order(BucketOrder.aggregation("stats.avg", asc)) - .subAggregation(stats("stats").field("i"))).execute().actionGet(); + .subAggregation(stats("stats").field("i"))).get(); assertSearchResponse(response); @@ -953,7 +952,7 @@ public class StringTermsIT extends AbstractTermsTestCase { terms("terms").executionHint(randomExecutionHint()).field(SINGLE_VALUED_FIELD_NAME) .collectMode(randomFrom(SubAggCollectionMode.values())) .order(BucketOrder.aggregation("stats.sum_of_squares", asc)) - .subAggregation(extendedStats("stats").field("i"))).execute().actionGet(); + .subAggregation(extendedStats("stats").field("i"))).get(); assertSearchResponse(response); @@ -987,7 +986,7 @@ public class StringTermsIT extends AbstractTermsTestCase { .order(BucketOrder.aggregation("stats.sum_of_squares", asc)) .subAggregation(extendedStats("stats").field("i")) .subAggregation(terms("subTerms").field("s_values").collectMode(randomFrom(SubAggCollectionMode.values())))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -1063,7 +1062,7 @@ public class StringTermsIT extends AbstractTermsTestCase { .addAggregation( terms("terms").executionHint(randomExecutionHint()).field(SINGLE_VALUED_FIELD_NAME) .collectMode(randomFrom(SubAggCollectionMode.values())).order(BucketOrder.compound(order)) - .subAggregation(avg("avg_l").field("l")).subAggregation(sum("sum_d").field("d"))).execute().actionGet(); + .subAggregation(avg("avg_l").field("l")).subAggregation(sum("sum_d").field("d"))).get(); assertSearchResponse(response); @@ -1093,7 +1092,7 @@ public class StringTermsIT extends AbstractTermsTestCase { .setTypes("type") .addAggregation( terms("terms").collectMode(randomFrom(SubAggCollectionMode.values())).executionHint(randomExecutionHint()) - .field(IndexFieldMapper.NAME)).execute().actionGet(); + .field(IndexFieldMapper.NAME)).get(); assertSearchResponse(response); Terms terms = response.getAggregations().get("terms"); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/AvgIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/AvgIT.java index bff289e59eb..d8696d461e4 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/AvgIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/AvgIT.java @@ -68,7 +68,7 @@ public class AvgIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx") .setQuery(matchAllQuery()) .addAggregation(histogram("histo").field("value").interval(1L).minDocCount(0).subAggregation(avg("avg").field("value"))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); @@ -87,7 +87,7 @@ public class AvgIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx_unmapped") .setQuery(matchAllQuery()) .addAggregation(avg("avg").field("value")) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); @@ -102,7 +102,7 @@ public class AvgIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(avg("avg").field("value")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -116,7 +116,7 @@ public class AvgIT extends AbstractNumericTestCase { public void testSingleValuedFieldGetProperty() throws Exception { SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) - .addAggregation(global("global").subAggregation(avg("avg").field("value"))).execute().actionGet(); + .addAggregation(global("global").subAggregation(avg("avg").field("value"))).get(); assertHitCount(searchResponse, 10); @@ -142,7 +142,7 @@ public class AvgIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx", "idx_unmapped") .setQuery(matchAllQuery()) .addAggregation(avg("avg").field("value")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -158,7 +158,7 @@ public class AvgIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(avg("avg").field("value") .script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, VALUE_SCRIPT, Collections.emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -175,7 +175,7 @@ public class AvgIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(avg("avg").field("value") .script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, VALUE_SCRIPT, params))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -187,7 +187,7 @@ public class AvgIT extends AbstractNumericTestCase { public void testSingleValuedField_WithFormatter() throws Exception { SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) - .addAggregation(avg("avg").format("#").field("value")).execute().actionGet(); + .addAggregation(avg("avg").format("#").field("value")).get(); assertHitCount(searchResponse, 10); @@ -203,7 +203,7 @@ public class AvgIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(avg("avg").field("values")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -219,7 +219,7 @@ public class AvgIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(avg("avg").field("values") .script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, VALUE_SCRIPT, Collections.emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -236,7 +236,7 @@ public class AvgIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(avg("avg").field("values") .script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, VALUE_SCRIPT, params))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -252,7 +252,7 @@ public class AvgIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(avg("avg") .script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, VALUE_FIELD_SCRIPT, Collections.emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -271,7 +271,7 @@ public class AvgIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(avg("avg") .script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, SUM_FIELD_PARAMS_SCRIPT, params))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -287,7 +287,7 @@ public class AvgIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(avg("avg") .script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, SUM_VALUES_FIELD_SCRIPT, Collections.emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -306,7 +306,7 @@ public class AvgIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(avg("avg") .script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, SUM_FIELD_PARAMS_SCRIPT, params))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/CardinalityIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/CardinalityIT.java index b3213306da3..c607295ab49 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/CardinalityIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/CardinalityIT.java @@ -126,7 +126,7 @@ public class CardinalityIT extends ESIntegTestCase { .startObject("d_values") .field("type", "double") .endObject() - .endObject().endObject().endObject()).execute().actionGet(); + .endObject().endObject().endObject()).get(); numDocs = randomIntBetween(2, 100); precisionThreshold = randomIntBetween(0, 1 << randomInt(20)); @@ -174,7 +174,7 @@ public class CardinalityIT extends ESIntegTestCase { public void testUnmapped() throws Exception { SearchResponse response = client().prepareSearch("idx_unmapped").setTypes("type") .addAggregation(cardinality("cardinality").precisionThreshold(precisionThreshold).field("str_value")) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -187,7 +187,7 @@ public class CardinalityIT extends ESIntegTestCase { public void testPartiallyUnmapped() throws Exception { SearchResponse response = client().prepareSearch("idx", "idx_unmapped").setTypes("type") .addAggregation(cardinality("cardinality").precisionThreshold(precisionThreshold).field("str_value")) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -200,7 +200,7 @@ public class CardinalityIT extends ESIntegTestCase { public void testSingleValuedString() throws Exception { SearchResponse response = client().prepareSearch("idx").setTypes("type") .addAggregation(cardinality("cardinality").precisionThreshold(precisionThreshold).field("str_value")) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -213,7 +213,7 @@ public class CardinalityIT extends ESIntegTestCase { public void testSingleValuedNumeric() throws Exception { SearchResponse response = client().prepareSearch("idx").setTypes("type") .addAggregation(cardinality("cardinality").precisionThreshold(precisionThreshold).field(singleNumericField())) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -228,7 +228,7 @@ public class CardinalityIT extends ESIntegTestCase { .addAggregation( global("global").subAggregation( cardinality("cardinality").precisionThreshold(precisionThreshold).field(singleNumericField()))) - .execute().actionGet(); + .get(); assertSearchResponse(searchResponse); @@ -252,7 +252,7 @@ public class CardinalityIT extends ESIntegTestCase { public void testSingleValuedNumericHashed() throws Exception { SearchResponse response = client().prepareSearch("idx").setTypes("type") .addAggregation(cardinality("cardinality").precisionThreshold(precisionThreshold).field(singleNumericField())) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -265,7 +265,7 @@ public class CardinalityIT extends ESIntegTestCase { public void testMultiValuedString() throws Exception { SearchResponse response = client().prepareSearch("idx").setTypes("type") .addAggregation(cardinality("cardinality").precisionThreshold(precisionThreshold).field("str_values")) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -278,7 +278,7 @@ public class CardinalityIT extends ESIntegTestCase { public void testMultiValuedNumeric() throws Exception { SearchResponse response = client().prepareSearch("idx").setTypes("type") .addAggregation(cardinality("cardinality").precisionThreshold(precisionThreshold).field(multiNumericField(false))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -291,7 +291,7 @@ public class CardinalityIT extends ESIntegTestCase { public void testMultiValuedNumericHashed() throws Exception { SearchResponse response = client().prepareSearch("idx").setTypes("type") .addAggregation(cardinality("cardinality").precisionThreshold(precisionThreshold).field(multiNumericField(true))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -307,7 +307,7 @@ public class CardinalityIT extends ESIntegTestCase { cardinality("cardinality") .precisionThreshold(precisionThreshold) .script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "doc['str_value'].value", emptyMap()))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -323,7 +323,7 @@ public class CardinalityIT extends ESIntegTestCase { cardinality("cardinality") .precisionThreshold(precisionThreshold) .script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "doc['str_values']", emptyMap()))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -337,7 +337,7 @@ public class CardinalityIT extends ESIntegTestCase { Script script = new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "doc[' + singleNumericField() + '].value", emptyMap()); SearchResponse response = client().prepareSearch("idx").setTypes("type") .addAggregation(cardinality("cardinality").precisionThreshold(precisionThreshold).script(script)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -352,7 +352,7 @@ public class CardinalityIT extends ESIntegTestCase { new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "doc[' + multiNumericField(false) + ']", Collections.emptyMap()); SearchResponse response = client().prepareSearch("idx").setTypes("type") .addAggregation(cardinality("cardinality").precisionThreshold(precisionThreshold).script(script)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -369,7 +369,7 @@ public class CardinalityIT extends ESIntegTestCase { .precisionThreshold(precisionThreshold) .field("str_value") .script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_value", emptyMap()))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -386,7 +386,7 @@ public class CardinalityIT extends ESIntegTestCase { .precisionThreshold(precisionThreshold) .field("str_values") .script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_value", emptyMap()))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -403,7 +403,7 @@ public class CardinalityIT extends ESIntegTestCase { .precisionThreshold(precisionThreshold) .field(singleNumericField()) .script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_value", emptyMap()))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -420,7 +420,7 @@ public class CardinalityIT extends ESIntegTestCase { .precisionThreshold(precisionThreshold) .field(multiNumericField(false)) .script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_value", emptyMap()))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -435,7 +435,7 @@ public class CardinalityIT extends ESIntegTestCase { .addAggregation(terms("terms").field("str_value") .collectMode(randomFrom(SubAggCollectionMode.values())) .subAggregation(cardinality("cardinality").precisionThreshold(precisionThreshold).field("str_values"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsIT.java index 7325ae877aa..4aa16d6f1d5 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsIT.java @@ -82,7 +82,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation( histogram("histo").field("value").interval(1L).minDocCount(0).subAggregation(extendedStats("stats").field("value"))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); @@ -109,7 +109,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx_unmapped") .setQuery(matchAllQuery()) .addAggregation(extendedStats("stats").field("value")) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); @@ -152,7 +152,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(extendedStats("stats").field("value").sigma(sigma)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -176,7 +176,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(extendedStats("stats").field("value")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -197,7 +197,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase { public void testSingleValuedField_WithFormatter() throws Exception { double sigma = randomDouble() * randomIntBetween(1, 10); SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) - .addAggregation(extendedStats("stats").format("0000.0").field("value").sigma(sigma)).execute().actionGet(); + .addAggregation(extendedStats("stats").format("0000.0").field("value").sigma(sigma)).get(); assertHitCount(searchResponse, 10); @@ -225,7 +225,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase { @Override public void testSingleValuedFieldGetProperty() throws Exception { SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) - .addAggregation(global("global").subAggregation(extendedStats("stats").field("value"))).execute().actionGet(); + .addAggregation(global("global").subAggregation(extendedStats("stats").field("value"))).get(); assertHitCount(searchResponse, 10); @@ -274,7 +274,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx", "idx_unmapped") .setQuery(matchAllQuery()) .addAggregation(extendedStats("stats").field("value").sigma(sigma)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -303,7 +303,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase { .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value + 1", Collections.emptyMap())) .sigma(sigma)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -333,7 +333,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase { .field("value") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value + inc", params)) .sigma(sigma)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -357,7 +357,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(extendedStats("stats").field("values").sigma(sigma)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -386,7 +386,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase { .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", Collections.emptyMap())) .sigma(sigma)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -444,7 +444,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase { .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "doc['value'].value", Collections.emptyMap())) .sigma(sigma)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -476,7 +476,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase { extendedStats("stats") .script(script) .sigma(sigma)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -504,7 +504,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase { .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "doc['values']", Collections.emptyMap())) .sigma(sigma)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -537,7 +537,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase { extendedStats("stats") .script(script) .sigma(sigma)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -561,7 +561,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase { .addAggregation(terms("value").field("value") .subAggregation(missing("values").field("values") .subAggregation(extendedStats("stats").field("value")))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/GeoBoundsIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/GeoBoundsIT.java index 63fb41b16df..baf9aab19dc 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/GeoBoundsIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/GeoBoundsIT.java @@ -51,7 +51,7 @@ public class GeoBoundsIT extends AbstractGeoTestCase { SearchResponse response = client().prepareSearch(IDX_NAME) .addAggregation(geoBounds(aggName).field(SINGLE_VALUED_FIELD_NAME) .wrapLongitude(false)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -72,7 +72,7 @@ public class GeoBoundsIT extends AbstractGeoTestCase { .setQuery(matchAllQuery()) .addAggregation( global("global").subAggregation(geoBounds(aggName).field(SINGLE_VALUED_FIELD_NAME).wrapLongitude(false))) - .execute().actionGet(); + .get(); assertSearchResponse(searchResponse); @@ -105,7 +105,7 @@ public class GeoBoundsIT extends AbstractGeoTestCase { SearchResponse response = client().prepareSearch(IDX_NAME) .addAggregation(geoBounds(aggName).field(MULTI_VALUED_FIELD_NAME) .wrapLongitude(false)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -125,7 +125,7 @@ public class GeoBoundsIT extends AbstractGeoTestCase { SearchResponse response = client().prepareSearch(UNMAPPED_IDX_NAME) .addAggregation(geoBounds(aggName).field(SINGLE_VALUED_FIELD_NAME) .wrapLongitude(false)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -142,7 +142,7 @@ public class GeoBoundsIT extends AbstractGeoTestCase { SearchResponse response = client().prepareSearch(IDX_NAME, UNMAPPED_IDX_NAME) .addAggregation(geoBounds(aggName).field(SINGLE_VALUED_FIELD_NAME) .wrapLongitude(false)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -162,7 +162,7 @@ public class GeoBoundsIT extends AbstractGeoTestCase { .setQuery(matchAllQuery()) .addAggregation(geoBounds(aggName).field(SINGLE_VALUED_FIELD_NAME) .wrapLongitude(false)) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); GeoBounds geoBounds = searchResponse.getAggregations().get(aggName); @@ -178,7 +178,7 @@ public class GeoBoundsIT extends AbstractGeoTestCase { SearchResponse response = client().prepareSearch(DATELINE_IDX_NAME) .addAggregation(geoBounds(aggName).field(SINGLE_VALUED_FIELD_NAME) .wrapLongitude(false)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -202,7 +202,7 @@ public class GeoBoundsIT extends AbstractGeoTestCase { GeoPoint geoValuesBottomRight = new GeoPoint(-24, -175); SearchResponse response = client().prepareSearch(DATELINE_IDX_NAME) .addAggregation(geoBounds(aggName).field(SINGLE_VALUED_FIELD_NAME).wrapLongitude(true)) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -224,7 +224,7 @@ public class GeoBoundsIT extends AbstractGeoTestCase { SearchResponse response = client().prepareSearch(HIGH_CARD_IDX_NAME) .addAggregation(terms("terms").field(NUMBER_FIELD_NAME).subAggregation(geoBounds(aggName).field(SINGLE_VALUED_FIELD_NAME) .wrapLongitude(false))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -249,7 +249,7 @@ public class GeoBoundsIT extends AbstractGeoTestCase { public void testSingleValuedFieldWithZeroLon() throws Exception { SearchResponse response = client().prepareSearch(IDX_ZERO_NAME) - .addAggregation(geoBounds(aggName).field(SINGLE_VALUED_FIELD_NAME).wrapLongitude(false)).execute().actionGet(); + .addAggregation(geoBounds(aggName).field(SINGLE_VALUED_FIELD_NAME).wrapLongitude(false)).get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/GeoCentroidIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/GeoCentroidIT.java index 7806364119f..dfc503219ed 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/GeoCentroidIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/GeoCentroidIT.java @@ -49,7 +49,7 @@ public class GeoCentroidIT extends AbstractGeoTestCase { SearchResponse response = client().prepareSearch(EMPTY_IDX_NAME) .setQuery(matchAllQuery()) .addAggregation(geoCentroid(aggName).field(SINGLE_VALUED_FIELD_NAME)) - .execute().actionGet(); + .get(); assertSearchResponse(response); GeoCentroid geoCentroid = response.getAggregations().get(aggName); @@ -64,7 +64,7 @@ public class GeoCentroidIT extends AbstractGeoTestCase { public void testUnmapped() throws Exception { SearchResponse response = client().prepareSearch(UNMAPPED_IDX_NAME) .addAggregation(geoCentroid(aggName).field(SINGLE_VALUED_FIELD_NAME)) - .execute().actionGet(); + .get(); assertSearchResponse(response); GeoCentroid geoCentroid = response.getAggregations().get(aggName); @@ -78,7 +78,7 @@ public class GeoCentroidIT extends AbstractGeoTestCase { public void testPartiallyUnmapped() throws Exception { SearchResponse response = client().prepareSearch(IDX_NAME, UNMAPPED_IDX_NAME) .addAggregation(geoCentroid(aggName).field(SINGLE_VALUED_FIELD_NAME)) - .execute().actionGet(); + .get(); assertSearchResponse(response); GeoCentroid geoCentroid = response.getAggregations().get(aggName); @@ -94,7 +94,7 @@ public class GeoCentroidIT extends AbstractGeoTestCase { SearchResponse response = client().prepareSearch(IDX_NAME) .setQuery(matchAllQuery()) .addAggregation(geoCentroid(aggName).field(SINGLE_VALUED_FIELD_NAME)) - .execute().actionGet(); + .get(); assertSearchResponse(response); GeoCentroid geoCentroid = response.getAggregations().get(aggName); @@ -110,7 +110,7 @@ public class GeoCentroidIT extends AbstractGeoTestCase { SearchResponse response = client().prepareSearch(IDX_NAME) .setQuery(matchAllQuery()) .addAggregation(global("global").subAggregation(geoCentroid(aggName).field(SINGLE_VALUED_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(response); Global global = response.getAggregations().get("global"); @@ -140,7 +140,7 @@ public class GeoCentroidIT extends AbstractGeoTestCase { SearchResponse searchResponse = client().prepareSearch(IDX_NAME) .setQuery(matchAllQuery()) .addAggregation(geoCentroid(aggName).field(MULTI_VALUED_FIELD_NAME)) - .execute().actionGet(); + .get(); assertSearchResponse(searchResponse); GeoCentroid geoCentroid = searchResponse.getAggregations().get(aggName); @@ -156,7 +156,7 @@ public class GeoCentroidIT extends AbstractGeoTestCase { SearchResponse response = client().prepareSearch(HIGH_CARD_IDX_NAME) .addAggregation(geohashGrid("geoGrid").field(SINGLE_VALUED_FIELD_NAME) .subAggregation(geoCentroid(aggName).field(SINGLE_VALUED_FIELD_NAME))) - .execute().actionGet(); + .get(); assertSearchResponse(response); GeoHashGrid grid = response.getAggregations().get("geoGrid"); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/HDRPercentileRanksIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/HDRPercentileRanksIT.java index c6d1ebb63aa..13e40ced711 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/HDRPercentileRanksIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/HDRPercentileRanksIT.java @@ -128,7 +128,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { percentileRanks("percentile_ranks", new double[]{10, 15}) .field("value").method(PercentilesMethod.HDR) .numberOfSignificantValueDigits(sigDigits))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); @@ -154,7 +154,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .method(PercentilesMethod.HDR) .numberOfSignificantValueDigits(sigDigits) .field("value")) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); @@ -177,7 +177,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .addAggregation( percentileRanks("percentile_ranks", pcts).method(PercentilesMethod.HDR).numberOfSignificantValueDigits(sigDigits) .field("value")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -196,7 +196,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .method(PercentilesMethod.HDR) .numberOfSignificantValueDigits(sigDigits) .field("value")) - .execute().actionGet()); + .get()); assertThat(e.getMessage(), equalTo("[values] must not be null: [percentile_ranks]")); } @@ -211,7 +211,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .method(PercentilesMethod.HDR) .numberOfSignificantValueDigits(sigDigits) .field("value")) - .execute().actionGet()); + .get()); assertThat(e.getMessage(), equalTo("[values] must not be an empty array: [percentile_ranks]")); } @@ -228,7 +228,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .method(PercentilesMethod.HDR) .numberOfSignificantValueDigits(sigDigits) .field("value"))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -255,7 +255,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .addAggregation( percentileRanks("percentile_ranks", pcts).method(PercentilesMethod.HDR).numberOfSignificantValueDigits(sigDigits) .field("value")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -273,7 +273,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .addAggregation( percentileRanks("percentile_ranks", pcts).method(PercentilesMethod.HDR).numberOfSignificantValueDigits(sigDigits) .field("value")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -294,7 +294,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .numberOfSignificantValueDigits(sigDigits) .field("value") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -317,7 +317,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .numberOfSignificantValueDigits(sigDigits) .field("value") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - dec", params))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -335,7 +335,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .addAggregation( percentileRanks("percentile_ranks", pcts).method(PercentilesMethod.HDR).numberOfSignificantValueDigits(sigDigits) .field("values")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -356,7 +356,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .numberOfSignificantValueDigits(sigDigits) .field("values") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -376,7 +376,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .numberOfSignificantValueDigits(sigDigits) .field("values") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "20 - _value", emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -399,7 +399,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .numberOfSignificantValueDigits(sigDigits) .field("values") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - dec", params))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -419,7 +419,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .method(PercentilesMethod.HDR) .numberOfSignificantValueDigits(sigDigits) .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "doc['value'].value", emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -444,7 +444,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .method(PercentilesMethod.HDR) .numberOfSignificantValueDigits(sigDigits) .script(script)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -467,7 +467,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .method(PercentilesMethod.HDR) .numberOfSignificantValueDigits(sigDigits) .script(script)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -489,7 +489,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .method(PercentilesMethod.HDR) .numberOfSignificantValueDigits(sigDigits) .script(script)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -508,7 +508,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase { .subAggregation( percentileRanks("percentile_ranks", new double[]{99}).field("value").method(PercentilesMethod.HDR) .numberOfSignificantValueDigits(sigDigits)) - .order(BucketOrder.aggregation("percentile_ranks", "99", asc))).execute().actionGet(); + .order(BucketOrder.aggregation("percentile_ranks", "99", asc))).get(); assertHitCount(searchResponse, 10); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/HDRPercentilesIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/HDRPercentilesIT.java index 0104f7647f7..a18dcf914e6 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/HDRPercentilesIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/HDRPercentilesIT.java @@ -130,7 +130,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase { .numberOfSignificantValueDigits(sigDigits) .method(PercentilesMethod.HDR) .percentiles(10, 15))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); @@ -153,7 +153,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation( percentiles("percentiles").numberOfSignificantValueDigits(sigDigits).method(PercentilesMethod.HDR).field("value") - .percentiles(0, 10, 15, 100)).execute().actionGet(); + .percentiles(0, 10, 15, 100)).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); @@ -176,7 +176,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase { .addAggregation( percentiles("percentiles").numberOfSignificantValueDigits(sigDigits).method(PercentilesMethod.HDR).field("value") .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -195,7 +195,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase { global("global").subAggregation( percentiles("percentiles").numberOfSignificantValueDigits(sigDigits).method(PercentilesMethod.HDR) .field("value") - .percentiles(pcts))).execute().actionGet(); + .percentiles(pcts))).get(); assertHitCount(searchResponse, 10); @@ -223,7 +223,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase { .addAggregation( percentiles("percentiles").numberOfSignificantValueDigits(sigDigits).method(PercentilesMethod.HDR).field("value") .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -245,7 +245,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase { .field("value") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap())) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -270,7 +270,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase { .field("value") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - dec", params)) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -288,7 +288,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase { .addAggregation( percentiles("percentiles").numberOfSignificantValueDigits(sigDigits).method(PercentilesMethod.HDR).field("values") .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -310,7 +310,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase { .field("values") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap())) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -331,7 +331,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase { .field("values") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "20 - _value", emptyMap())) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -356,7 +356,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase { .field("values") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - dec", params)) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -377,7 +377,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase { .method(PercentilesMethod.HDR) .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "doc['value'].value", emptyMap())) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -403,7 +403,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase { .method(PercentilesMethod.HDR) .script(script) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -427,7 +427,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase { .method(PercentilesMethod.HDR) .script(script) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -450,7 +450,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase { .method(PercentilesMethod.HDR) .script(script) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -471,7 +471,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase { .method(PercentilesMethod.HDR) .numberOfSignificantValueDigits(sigDigits) .percentiles(99)) - .order(BucketOrder.aggregation("percentiles", "99", asc))).execute().actionGet(); + .order(BucketOrder.aggregation("percentiles", "99", asc))).get(); assertHitCount(searchResponse, 10); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/MaxIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/MaxIT.java index c5667e7830f..cc2da2d386b 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/MaxIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/MaxIT.java @@ -63,7 +63,7 @@ public class MaxIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx") .setQuery(matchAllQuery()) .addAggregation(histogram("histo").field("value").interval(1L).minDocCount(0).subAggregation(max("max").field("value"))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); @@ -82,7 +82,7 @@ public class MaxIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx_unmapped") .setQuery(matchAllQuery()) .addAggregation(max("max").field("value")) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); @@ -97,7 +97,7 @@ public class MaxIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(max("max").field("value")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -109,7 +109,7 @@ public class MaxIT extends AbstractNumericTestCase { public void testSingleValuedFieldWithFormatter() throws Exception { SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) - .addAggregation(max("max").format("0000.0").field("value")).execute().actionGet(); + .addAggregation(max("max").format("0000.0").field("value")).get(); assertHitCount(searchResponse, 10); @@ -123,7 +123,7 @@ public class MaxIT extends AbstractNumericTestCase { @Override public void testSingleValuedFieldGetProperty() throws Exception { SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) - .addAggregation(global("global").subAggregation(max("max").field("value"))).execute().actionGet(); + .addAggregation(global("global").subAggregation(max("max").field("value"))).get(); assertHitCount(searchResponse, 10); @@ -149,7 +149,7 @@ public class MaxIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx", "idx_unmapped") .setQuery(matchAllQuery()) .addAggregation(max("max").field("value")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -167,7 +167,7 @@ public class MaxIT extends AbstractNumericTestCase { max("max") .field("value") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value + 1", emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -202,7 +202,7 @@ public class MaxIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(max("max").field("values")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -257,7 +257,7 @@ public class MaxIT extends AbstractNumericTestCase { .addAggregation( max("max") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "doc['value'].value", emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -400,7 +400,7 @@ public class MaxIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(max("max").field("values")) .addAggregation(count("count").field("values")) - .execute().actionGet(); + .get(); Max max = searchResponse.getAggregations().get("max"); assertThat(max, notNullValue()); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/MedianAbsoluteDeviationIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/MedianAbsoluteDeviationIT.java index e04905a38ec..1d30d283f6f 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/MedianAbsoluteDeviationIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/MedianAbsoluteDeviationIT.java @@ -127,8 +127,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase { prepareCreate("empty_bucket_idx") .addMapping("type", "value", "type=integer") - .execute() - .actionGet(); + .get(); builders = new ArrayList<>(); for (int i = 0; i < 2; i++) { @@ -166,8 +165,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase { .subAggregation( randomBuilder() .field("value"))) - .execute() - .actionGet(); + .get(); assertHitCount(response, 2); @@ -190,8 +188,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase { .addAggregation( randomBuilder() .field("value")) - .execute() - .actionGet(); + .get(); assertHitCount(response, 0); @@ -209,8 +206,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase { .addAggregation( randomBuilder() .field("value")) - .execute() - .actionGet(); + .get(); assertHitCount(response, NUMBER_OF_DOCS); @@ -230,8 +226,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase { .subAggregation( randomBuilder() .field("value"))) - .execute() - .actionGet(); + .get(); assertHitCount(response, NUMBER_OF_DOCS); @@ -256,8 +251,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase { .addAggregation( randomBuilder() .field("value")) - .execute() - .actionGet(); + .get(); assertHitCount(response, NUMBER_OF_DOCS); @@ -276,8 +270,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase { randomBuilder() .field("value") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value + 1", Collections.emptyMap()))) - .execute() - .actionGet(); + .get(); assertHitCount(response, NUMBER_OF_DOCS); @@ -303,8 +296,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase { randomBuilder() .field("value") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value + inc", params))) - .execute() - .actionGet(); + .get(); assertHitCount(response, NUMBER_OF_DOCS); @@ -326,8 +318,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase { .addAggregation( randomBuilder() .field("values")) - .execute() - .actionGet(); + .get(); assertHitCount(response, NUMBER_OF_DOCS); @@ -346,8 +337,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase { randomBuilder() .field("values") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value + 1", Collections.emptyMap()))) - .execute() - .actionGet(); + .get(); assertHitCount(response, NUMBER_OF_DOCS); @@ -372,8 +362,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase { randomBuilder() .field("values") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value + inc", params))) - .execute() - .actionGet(); + .get(); assertHitCount(response, NUMBER_OF_DOCS); @@ -394,8 +383,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase { .addAggregation( randomBuilder() .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "doc['value'].value", Collections.emptyMap()))) - .execute() - .actionGet(); + .get(); assertHitCount(response, NUMBER_OF_DOCS); @@ -416,8 +404,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase { .addAggregation( randomBuilder() .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "doc['value'].value + inc", params))) - .execute() - .actionGet(); + .get(); assertHitCount(response, NUMBER_OF_DOCS); @@ -443,8 +430,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase { AggregationTestScriptsPlugin.NAME, "doc['values']", Collections.emptyMap()))) - .execute() - .actionGet(); + .get(); assertHitCount(response, NUMBER_OF_DOCS); @@ -469,8 +455,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase { AggregationTestScriptsPlugin.NAME, "[ doc['value'].value, doc['value'].value + inc ]", params))) - .execute() - .actionGet(); + .get(); assertHitCount(response, NUMBER_OF_DOCS); @@ -497,8 +482,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase { .subAggregation( randomBuilder() .field("value"))) - .execute() - .actionGet(); + .get(); assertHitCount(response, NUMBER_OF_DOCS); @@ -547,8 +531,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase { .subAggregation( randomBuilder() .field("value")))) - .execute() - .actionGet(); + .get(); assertHitCount(response, NUMBER_OF_DOCS); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/MinIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/MinIT.java index 929775341f8..69468c86991 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/MinIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/MinIT.java @@ -63,7 +63,7 @@ public class MinIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx") .setQuery(matchAllQuery()) .addAggregation(histogram("histo").field("value").interval(1L).minDocCount(0).subAggregation(min("min").field("value"))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); @@ -82,7 +82,7 @@ public class MinIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx_unmapped") .setQuery(matchAllQuery()) .addAggregation(min("min").field("value")) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); @@ -97,7 +97,7 @@ public class MinIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(min("min").field("value")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -109,7 +109,7 @@ public class MinIT extends AbstractNumericTestCase { public void testSingleValuedFieldWithFormatter() throws Exception { SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) - .addAggregation(min("min").format("0000.0").field("value")).execute().actionGet(); + .addAggregation(min("min").format("0000.0").field("value")).get(); assertHitCount(searchResponse, 10); @@ -124,7 +124,7 @@ public class MinIT extends AbstractNumericTestCase { public void testSingleValuedFieldGetProperty() throws Exception { SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) - .addAggregation(global("global").subAggregation(min("min").field("value"))).execute().actionGet(); + .addAggregation(global("global").subAggregation(min("min").field("value"))).get(); assertHitCount(searchResponse, 10); @@ -150,7 +150,7 @@ public class MinIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx", "idx_unmapped") .setQuery(matchAllQuery()) .addAggregation(min("min").field("value")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -203,7 +203,7 @@ public class MinIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(min("min").field("values")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -412,7 +412,7 @@ public class MinIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(min("min").field("values")) .addAggregation(count("count").field("values")) - .execute().actionGet(); + .get(); Min min = searchResponse.getAggregations().get("min"); assertThat(min, notNullValue()); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/ScriptedMetricIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/ScriptedMetricIT.java index 4b38f58cfd4..2355f4b2cc7 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/ScriptedMetricIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/ScriptedMetricIT.java @@ -277,7 +277,7 @@ public class ScriptedMetricIT extends ESIntegTestCase { // "1". then each test will have // to check that this bucket exists with the appropriate sub // aggregations. - prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").execute().actionGet(); + prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").get(); builders = new ArrayList<>(); for (int i = 0; i < 2; i++) { builders.add(client().prepareIndex("empty_bucket_idx", "type", "" + i).setSource( @@ -507,7 +507,7 @@ public class ScriptedMetricIT extends ESIntegTestCase { .mapScript(mapScript) .combineScript(combineScript) .reduceScript(reduceScript)) - .execute().actionGet(); + .get(); assertSearchResponse(response); assertThat(response.getHits().getTotalHits().value, equalTo(numDocs)); @@ -851,7 +851,7 @@ public class ScriptedMetricIT extends ESIntegTestCase { .mapScript(mapScript) .combineScript(combineScript) .reduceScript(reduceScript)) - .execute().actionGet(); + .get(); assertSearchResponse(response); assertThat(response.getHits().getTotalHits().value, equalTo(numDocs)); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/StatsIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/StatsIT.java index d36890b49c9..025cfa1fe9f 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/StatsIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/StatsIT.java @@ -66,7 +66,7 @@ public class StatsIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx") .setQuery(matchAllQuery()) .addAggregation(histogram("histo").field("value").interval(1L).minDocCount(0).subAggregation(stats("stats").field("value"))) - .execute().actionGet(); + .get(); assertShardExecutionState(searchResponse, 0); @@ -91,7 +91,7 @@ public class StatsIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx_unmapped") .setQuery(matchAllQuery()) .addAggregation(stats("stats").field("value")) - .execute().actionGet(); + .get(); assertShardExecutionState(searchResponse, 0); @@ -125,7 +125,7 @@ public class StatsIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(stats("stats").field("value")) - .execute().actionGet(); + .get(); assertShardExecutionState(searchResponse, 0); @@ -144,7 +144,7 @@ public class StatsIT extends AbstractNumericTestCase { public void testSingleValuedField_WithFormatter() throws Exception { SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) - .addAggregation(stats("stats").format("0000.0").field("value")).execute().actionGet(); + .addAggregation(stats("stats").format("0000.0").field("value")).get(); assertHitCount(searchResponse, 10); @@ -165,7 +165,7 @@ public class StatsIT extends AbstractNumericTestCase { @Override public void testSingleValuedFieldGetProperty() throws Exception { SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) - .addAggregation(global("global").subAggregation(stats("stats").field("value"))).execute().actionGet(); + .addAggregation(global("global").subAggregation(stats("stats").field("value"))).get(); assertHitCount(searchResponse, 10); @@ -204,7 +204,7 @@ public class StatsIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx", "idx_unmapped") .setQuery(matchAllQuery()) .addAggregation(stats("stats").field("value")) - .execute().actionGet(); + .get(); assertShardExecutionState(searchResponse, 0); @@ -275,7 +275,7 @@ public class StatsIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(stats("stats").field("values")) - .execute().actionGet(); + .get(); assertShardExecutionState(searchResponse, 0); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/SumIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/SumIT.java index d8e638195cb..7e143d261e8 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/SumIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/SumIT.java @@ -96,7 +96,7 @@ public class SumIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx") .setQuery(matchAllQuery()) .addAggregation(histogram("histo").field("value").interval(1L).minDocCount(0).subAggregation(sum("sum").field("value"))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); @@ -115,7 +115,7 @@ public class SumIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx_unmapped") .setQuery(matchAllQuery()) .addAggregation(sum("sum").field("value")) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); @@ -130,7 +130,7 @@ public class SumIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(sum("sum").field("value")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -142,7 +142,7 @@ public class SumIT extends AbstractNumericTestCase { public void testSingleValuedFieldWithFormatter() throws Exception { SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) - .addAggregation(sum("sum").format("0000.0").field("value")).execute().actionGet(); + .addAggregation(sum("sum").format("0000.0").field("value")).get(); assertHitCount(searchResponse, 10); @@ -157,7 +157,7 @@ public class SumIT extends AbstractNumericTestCase { public void testSingleValuedFieldGetProperty() throws Exception { SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) - .addAggregation(global("global").subAggregation(sum("sum").field("value"))).execute().actionGet(); + .addAggregation(global("global").subAggregation(sum("sum").field("value"))).get(); assertHitCount(searchResponse, 10); @@ -183,7 +183,7 @@ public class SumIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx", "idx_unmapped") .setQuery(matchAllQuery()) .addAggregation(sum("sum").field("value")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -199,7 +199,7 @@ public class SumIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(sum("sum").field("value").script( new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, VALUE_SCRIPT, Collections.emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -216,7 +216,7 @@ public class SumIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(sum("sum").field("value").script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, VALUE_SCRIPT, params))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -232,7 +232,7 @@ public class SumIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(sum("sum").script( new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, VALUE_FIELD_SCRIPT, Collections.singletonMap("field", "value")))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -249,7 +249,7 @@ public class SumIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(sum("sum").script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, VALUE_FIELD_SCRIPT, params))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -265,7 +265,7 @@ public class SumIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(sum("sum").script( new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, SUM_VALUES_FIELD_SCRIPT, Collections.emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -283,7 +283,7 @@ public class SumIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation( sum("sum").script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, SUM_VALUES_FIELD_SCRIPT, params))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -299,7 +299,7 @@ public class SumIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(sum("sum").field("values")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -316,7 +316,7 @@ public class SumIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(sum("sum").field("values").script( new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, VALUE_SCRIPT, Collections.emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -333,7 +333,7 @@ public class SumIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) .addAggregation(sum("sum").field("values") .script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, VALUE_SCRIPT, params))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -416,7 +416,7 @@ public class SumIT extends AbstractNumericTestCase { SearchResponse response = client().prepareSearch("old_index", "new_index") .addAggregation(sum("sum") .field("route_length_miles")) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -432,7 +432,7 @@ public class SumIT extends AbstractNumericTestCase { .field("transit_mode") .subAggregation(sum("sum") .field("route_length_miles"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/TDigestPercentileRanksIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/TDigestPercentileRanksIT.java index 2528c700d2c..d779b8d8164 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/TDigestPercentileRanksIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/TDigestPercentileRanksIT.java @@ -117,7 +117,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(histogram("histo").field("value").interval(1L).minDocCount(0) .subAggregation(randomCompression(percentileRanks("percentile_ranks", new double[]{10,15}).field("value")))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); @@ -139,7 +139,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation( percentileRanks("percentile_ranks", pcts).method(PercentilesMethod.TDIGEST).field("value")) - .execute().actionGet()); + .get()); assertThat(e.getMessage(), equalTo("[values] must not be null: [percentile_ranks]")); } @@ -150,7 +150,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation( percentileRanks("percentile_ranks", pcts).method(PercentilesMethod.TDIGEST).field("value")) - .execute().actionGet()); + .get()); assertThat(e.getMessage(), equalTo("[values] must not be an empty array: [percentile_ranks]")); } @@ -160,7 +160,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(randomCompression(percentileRanks("percentile_ranks", new double[]{0, 10, 15, 100})) .field("value")) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); @@ -180,7 +180,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(randomCompression(percentileRanks("percentile_ranks", pcts)) .field("value")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -196,8 +196,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation( global("global").subAggregation( - randomCompression(percentileRanks("percentile_ranks", pcts)).field("value"))).execute() - .actionGet(); + randomCompression(percentileRanks("percentile_ranks", pcts)).field("value"))).get(); assertHitCount(searchResponse, 10); @@ -220,7 +219,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(randomCompression(percentileRanks("percentile_ranks", pcts)) .field("value")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -235,7 +234,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(randomCompression(percentileRanks("percentile_ranks", pcts)) .field("value")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -253,7 +252,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { percentileRanks("percentile_ranks", pcts)) .field("value") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -273,7 +272,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { percentileRanks("percentile_ranks", pcts)) .field("value") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - dec", params))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -288,7 +287,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation(randomCompression(percentileRanks("percentile_ranks", pcts)) .field("values")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -306,7 +305,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { percentileRanks("percentile_ranks", pcts)) .field("values") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -323,7 +322,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { percentileRanks("percentile_ranks", pcts)) .field("values") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value * -1", emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -343,7 +342,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { percentileRanks("percentile_ranks", pcts)) .field("values") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - dec", params))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -360,7 +359,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { randomCompression( percentileRanks("percentile_ranks", pcts)) .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "doc['value'].value", emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -381,7 +380,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { .addAggregation( randomCompression( percentileRanks("percentile_ranks", pcts)).script(script)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -399,7 +398,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { randomCompression( percentileRanks("percentile_ranks", pcts)) .script(script)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -418,7 +417,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { randomCompression( percentileRanks("percentile_ranks", pcts)) .script(script)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -434,7 +433,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase { histogram("histo").field("value").interval(2L) .subAggregation(randomCompression(percentileRanks("percentile_ranks", new double[]{99}).field("value"))) .order(BucketOrder.aggregation("percentile_ranks", "99", asc))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/TDigestPercentilesIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/TDigestPercentilesIT.java index cea977b5b7e..fbc1262f8dd 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/TDigestPercentilesIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/TDigestPercentilesIT.java @@ -122,7 +122,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase { .addAggregation(histogram("histo").field("value").interval(1L).minDocCount(0) .subAggregation(randomCompression(percentiles("percentiles").field("value")) .percentiles(10, 15))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); Histogram histo = searchResponse.getAggregations().get("histo"); @@ -144,7 +144,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase { .addAggregation(randomCompression(percentiles("percentiles")) .field("value") .percentiles(0, 10, 15, 100)) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); @@ -165,7 +165,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase { .addAggregation(randomCompression(percentiles("percentiles")) .field("value") .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -181,7 +181,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase { .setQuery(matchAllQuery()) .addAggregation( global("global").subAggregation(randomCompression(percentiles("percentiles")).field("value").percentiles(pcts))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -206,7 +206,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase { .addAggregation(randomCompression(percentiles("percentiles")) .field("value") .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -225,7 +225,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase { .field("value") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap())) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -246,7 +246,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase { .field("value") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - dec", params)) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -260,7 +260,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(randomCompression(percentiles("percentiles")).field("values").percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -279,7 +279,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase { .field("values") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap())) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -297,7 +297,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase { .field("values") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value * -1", emptyMap())) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -318,7 +318,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase { .field("values") .script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - dec", params)) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -337,7 +337,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase { percentiles("percentiles")) .script(script) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -360,7 +360,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase { percentiles("percentiles")) .script(script) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -380,7 +380,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase { percentiles("percentiles")) .script(script) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -400,7 +400,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase { percentiles("percentiles")) .script(script) .percentiles(pcts)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -416,7 +416,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase { histogram("histo").field("value").interval(2L) .subAggregation(randomCompression(percentiles("percentiles").field("value").percentiles(99))) .order(BucketOrder.aggregation("percentiles", "99", asc))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/TopHitsIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/TopHitsIT.java index c5a9096620e..ce8d9c2da83 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/TopHitsIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/TopHitsIT.java @@ -433,7 +433,7 @@ public class TopHitsIT extends ESIntegTestCase { public void testBasicsGetProperty() throws Exception { SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) - .addAggregation(global("global").subAggregation(topHits("hits"))).execute().actionGet(); + .addAggregation(global("global").subAggregation(topHits("hits"))).get(); assertSearchResponse(searchResponse); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/ValueCountIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/ValueCountIT.java index 2161ce71f90..4ed6b754ff2 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/ValueCountIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/ValueCountIT.java @@ -64,10 +64,10 @@ public class ValueCountIT extends ESIntegTestCase { .field("value", i+1) .startArray("values").value(i+2).value(i+3).endArray() .endObject()) - .execute().actionGet(); + .get(); } - client().admin().indices().prepareFlush().execute().actionGet(); - client().admin().indices().prepareRefresh().execute().actionGet(); + client().admin().indices().prepareFlush().get(); + client().admin().indices().prepareRefresh().get(); ensureSearchable(); } @@ -80,7 +80,7 @@ public class ValueCountIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch("idx_unmapped") .setQuery(matchAllQuery()) .addAggregation(count("count").field("value")) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); @@ -94,7 +94,7 @@ public class ValueCountIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(count("count").field("value")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -106,7 +106,7 @@ public class ValueCountIT extends ESIntegTestCase { public void testSingleValuedFieldGetProperty() throws Exception { SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) - .addAggregation(global("global").subAggregation(count("count").field("value"))).execute().actionGet(); + .addAggregation(global("global").subAggregation(count("count").field("value"))).get(); assertHitCount(searchResponse, 10); @@ -130,7 +130,7 @@ public class ValueCountIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch("idx", "idx_unmapped") .setQuery(matchAllQuery()) .addAggregation(count("count").field("value")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -144,7 +144,7 @@ public class ValueCountIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch("idx") .setQuery(matchAllQuery()) .addAggregation(count("count").field("values")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -158,7 +158,7 @@ public class ValueCountIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) .addAggregation(count("count").script( new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, VALUE_FIELD_SCRIPT, Collections.emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -172,7 +172,7 @@ public class ValueCountIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) .addAggregation(count("count").script( new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, SUM_VALUES_FIELD_SCRIPT, Collections.emptyMap()))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -186,7 +186,7 @@ public class ValueCountIT extends ESIntegTestCase { Map params = Collections.singletonMap("field", "value"); SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) .addAggregation(count("count").script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, SUM_FIELD_PARAMS_SCRIPT, params))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); @@ -200,7 +200,7 @@ public class ValueCountIT extends ESIntegTestCase { Map params = Collections.singletonMap("field", "values"); SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery()) .addAggregation(count("count").script( - new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, SUM_FIELD_PARAMS_SCRIPT, params))).execute().actionGet(); + new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, SUM_FIELD_PARAMS_SCRIPT, params))).get(); assertHitCount(searchResponse, 10); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/AvgBucketIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/AvgBucketIT.java index 5b044af53f2..e5504ab02d3 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/AvgBucketIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/AvgBucketIT.java @@ -95,7 +95,7 @@ public class AvgBucketIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) - .addAggregation(avgBucket("avg_bucket", "histo>_count")).execute().actionGet(); + .addAggregation(avgBucket("avg_bucket", "histo>_count")).get(); assertSearchResponse(response); @@ -133,7 +133,7 @@ public class AvgBucketIT extends ESIntegTestCase { .subAggregation( histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) - .subAggregation(avgBucket("avg_bucket", "histo>_count"))).execute().actionGet(); + .subAggregation(avgBucket("avg_bucket", "histo>_count"))).get(); assertSearchResponse(response); @@ -175,7 +175,7 @@ public class AvgBucketIT extends ESIntegTestCase { SearchResponse response = client() .prepareSearch("idx") .addAggregation(terms("terms").field("tag").subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .addAggregation(avgBucket("avg_bucket", "terms>sum")).execute().actionGet(); + .addAggregation(avgBucket("avg_bucket", "terms>sum")).get(); assertSearchResponse(response); @@ -216,7 +216,7 @@ public class AvgBucketIT extends ESIntegTestCase { histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .subAggregation(avgBucket("avg_bucket", "histo>sum"))).execute().actionGet(); + .subAggregation(avgBucket("avg_bucket", "histo>sum"))).get(); assertSearchResponse(response); @@ -270,7 +270,7 @@ public class AvgBucketIT extends ESIntegTestCase { .extendedBounds(minRandomValue, maxRandomValue) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) .subAggregation(avgBucket("avg_bucket", "histo>sum").gapPolicy(GapPolicy.INSERT_ZEROS))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -315,7 +315,7 @@ public class AvgBucketIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(terms("terms").field("tag").includeExclude(new IncludeExclude(null, "tag.*")) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .addAggregation(avgBucket("avg_bucket", "terms>sum")).execute().actionGet(); + .addAggregation(avgBucket("avg_bucket", "terms>sum")).get(); assertSearchResponse(response); @@ -342,7 +342,7 @@ public class AvgBucketIT extends ESIntegTestCase { histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) .subAggregation(avgBucket("avg_histo_bucket", "histo>_count"))) - .addAggregation(avgBucket("avg_terms_bucket", "terms>avg_histo_bucket")).execute().actionGet(); + .addAggregation(avgBucket("avg_terms_bucket", "terms>avg_histo_bucket")).get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/BucketScriptIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/BucketScriptIT.java index 040eb66e7cf..3677da5df9b 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/BucketScriptIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/BucketScriptIT.java @@ -170,7 +170,7 @@ public class BucketScriptIT extends ESIntegTestCase { new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_value0 + _value1 + _value2", Collections.emptyMap()), "field2Sum", "field3Sum", "field4Sum"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -217,7 +217,7 @@ public class BucketScriptIT extends ESIntegTestCase { new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_value0 + _value1 / _value2", Collections.emptyMap()), "field2Sum", "field3Sum", "field4Sum"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -263,7 +263,7 @@ public class BucketScriptIT extends ESIntegTestCase { bucketScript("seriesArithmetic", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_value0 + _value1 + _value2", Collections.emptyMap()) , "field2Sum", "field3Sum", "field4Sum"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -307,7 +307,7 @@ public class BucketScriptIT extends ESIntegTestCase { bucketScript("seriesArithmetic", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_value0", Collections.emptyMap()), "field2Sum"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -351,7 +351,7 @@ public class BucketScriptIT extends ESIntegTestCase { bucketScript("seriesArithmetic", bucketsPathsMap, new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "foo + bar + baz", Collections.emptyMap())))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -399,7 +399,7 @@ public class BucketScriptIT extends ESIntegTestCase { .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(sum("field4Sum").field(FIELD_4_NAME)) .subAggregation(bucketScript("seriesArithmetic", script, "field2Sum", "field3Sum", "field4Sum"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -446,7 +446,7 @@ public class BucketScriptIT extends ESIntegTestCase { new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_value0 + _value1 + _value2", Collections.emptyMap()), "field2Sum", "field3Sum", "field4Sum").gapPolicy(GapPolicy.INSERT_ZEROS))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -492,7 +492,7 @@ public class BucketScriptIT extends ESIntegTestCase { new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "return null", Collections.emptyMap()) ) ) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); @@ -526,7 +526,7 @@ public class BucketScriptIT extends ESIntegTestCase { .subAggregation( bucketScript("seriesArithmetic", new Script(ScriptType.STORED, null, "my_script", Collections.emptyMap()), - "field2Sum", "field3Sum", "field4Sum"))).execute().actionGet(); + "field2Sum", "field3Sum", "field4Sum"))).get(); assertSearchResponse(response); @@ -573,7 +573,7 @@ public class BucketScriptIT extends ESIntegTestCase { new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_value0 + _value1 + _value2", Collections.emptyMap()), "field2Sum", "field3Sum", "field4Sum"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -597,7 +597,7 @@ public class BucketScriptIT extends ESIntegTestCase { bucketScript("seriesArithmetic", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_value0 + _value1 + _value2", Collections.emptyMap()), - "field2Sum", "field3Sum", "field4Sum"))).execute().actionGet(); + "field2Sum", "field3Sum", "field4Sum"))).get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/BucketSelectorIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/BucketSelectorIT.java index 7314533d0b6..b02aae8031d 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/BucketSelectorIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/BucketSelectorIT.java @@ -184,7 +184,7 @@ public class BucketSelectorIT extends ESIntegTestCase { .addAggregation(histogram("histo").field(FIELD_1_NAME).interval(interval) .subAggregation(sum("field2Sum").field(FIELD_2_NAME)).subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(bucketSelector("bucketSelector", script, "field2Sum", "field3Sum"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -218,7 +218,7 @@ public class BucketSelectorIT extends ESIntegTestCase { .subAggregation(sum("field2Sum").field(FIELD_2_NAME)) .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(bucketSelector("bucketSelector", script, "field2Sum", "field3Sum"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -252,7 +252,7 @@ public class BucketSelectorIT extends ESIntegTestCase { .subAggregation(sum("field2Sum").field(FIELD_2_NAME)) .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(bucketSelector("bucketSelector", script, "field2Sum", "field3Sum"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -276,7 +276,7 @@ public class BucketSelectorIT extends ESIntegTestCase { .subAggregation(sum("field2Sum").field(FIELD_2_NAME)) .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(bucketSelector("bucketSelector", script, "field2Sum", "field3Sum"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -309,7 +309,7 @@ public class BucketSelectorIT extends ESIntegTestCase { .interval(interval) .subAggregation(sum("field2Sum").field(FIELD_2_NAME)) .subAggregation(bucketSelector("bucketSelector", script, "field2Sum"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -343,7 +343,7 @@ public class BucketSelectorIT extends ESIntegTestCase { .subAggregation(sum("field2Sum").field(FIELD_2_NAME)) .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(bucketSelector("bucketSelector", bucketPathsMap, script))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -376,7 +376,7 @@ public class BucketSelectorIT extends ESIntegTestCase { .subAggregation(sum("field2Sum").field(FIELD_2_NAME)) .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(bucketSelector("bucketSelector", script, "field2Sum", "field3Sum"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -409,7 +409,7 @@ public class BucketSelectorIT extends ESIntegTestCase { .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(bucketSelector("bucketSelector", script , "field2Sum", "field3Sum") .gapPolicy(GapPolicy.INSERT_ZEROS))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -449,7 +449,7 @@ public class BucketSelectorIT extends ESIntegTestCase { .subAggregation(sum("field2Sum").field(FIELD_2_NAME)) .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(bucketSelector("bucketSelector", script, "field2Sum", "field3Sum"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -482,7 +482,7 @@ public class BucketSelectorIT extends ESIntegTestCase { .subAggregation(sum("field2Sum").field(FIELD_2_NAME)) .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(bucketSelector("bucketSelector", script, "field2Sum", "field3Sum"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -504,7 +504,7 @@ public class BucketSelectorIT extends ESIntegTestCase { .subAggregation(sum("field2Sum").field(FIELD_2_NAME)) .subAggregation(sum("field3Sum").field(FIELD_3_NAME)) .subAggregation(bucketSelector("bucketSelector", script, "field2Sum", "field3Sum"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -539,7 +539,7 @@ public class BucketSelectorIT extends ESIntegTestCase { .minDocCount(0) .subAggregation(derivative("derivative", "_count") .gapPolicy(GapPolicy.INSERT_ZEROS)))) - .execute().actionGet(); + .get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/BucketSortIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/BucketSortIT.java index bc3610fca8e..8618d5a34ba 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/BucketSortIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/BucketSortIT.java @@ -123,7 +123,7 @@ public class BucketSortIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch(INDEX) .setSize(0) .addAggregation(dateHistogram("time_buckets").field(TIME_FIELD).interval(TimeValue.timeValueHours(1).millis())) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -142,7 +142,7 @@ public class BucketSortIT extends ESIntegTestCase { .setSize(0) .addAggregation(dateHistogram("time_buckets").field(TIME_FIELD).interval(TimeValue.timeValueHours(1).millis()) .subAggregation(bucketSort("bucketSort", Collections.emptyList()).size(3))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -159,7 +159,7 @@ public class BucketSortIT extends ESIntegTestCase { .setSize(0) .addAggregation(dateHistogram("time_buckets").field(TIME_FIELD).interval(TimeValue.timeValueHours(1).millis()) .subAggregation(bucketSort("bucketSort", Collections.emptyList()).size(3).from(2))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -177,7 +177,7 @@ public class BucketSortIT extends ESIntegTestCase { .setSize(0) .addAggregation(terms("foos").field(TERM_FIELD) .subAggregation(bucketSort("bucketSort", Arrays.asList(new FieldSortBuilder("_key"))))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -198,7 +198,7 @@ public class BucketSortIT extends ESIntegTestCase { .subAggregation(avg("avg_value").field(VALUE_1_FIELD)) .subAggregation(bucketSort("bucketSort", Arrays.asList( new FieldSortBuilder("avg_value").order(SortOrder.DESC))))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -219,7 +219,7 @@ public class BucketSortIT extends ESIntegTestCase { .subAggregation(avg("avg_value").field(VALUE_1_FIELD)) .subAggregation(bucketSort("bucketSort", Arrays.asList( new FieldSortBuilder("avg_value").order(SortOrder.DESC))).size(2).from(3))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -239,7 +239,7 @@ public class BucketSortIT extends ESIntegTestCase { .subAggregation(bucketSort("bucketSort", Arrays.asList( new FieldSortBuilder("_count").order(SortOrder.ASC), new FieldSortBuilder("avg_value").order(SortOrder.DESC))))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -263,7 +263,7 @@ public class BucketSortIT extends ESIntegTestCase { public void testSortDateHistogramDescending() { SearchResponse response = client().prepareSearch(INDEX) .addAggregation(dateHistogram("time_buckets").field(TIME_FIELD).interval(TimeValue.timeValueHours(1).millis())) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -276,7 +276,7 @@ public class BucketSortIT extends ESIntegTestCase { .addAggregation(dateHistogram("time_buckets").field(TIME_FIELD).interval(TimeValue.timeValueHours(1).millis()) .subAggregation(bucketSort("bucketSort", Arrays.asList( new FieldSortBuilder("_key").order(SortOrder.DESC))))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -299,7 +299,7 @@ public class BucketSortIT extends ESIntegTestCase { .subAggregation(bucketSort("bucketSort", Arrays.asList( new FieldSortBuilder("avg_value").order(SortOrder.DESC))).gapPolicy( BucketHelpers.GapPolicy.SKIP))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -319,7 +319,7 @@ public class BucketSortIT extends ESIntegTestCase { .subAggregation(bucketSort("bucketSort", Arrays.asList( new FieldSortBuilder("avg_value").order(SortOrder.DESC))).gapPolicy( BucketHelpers.GapPolicy.SKIP).size(2))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -341,7 +341,7 @@ public class BucketSortIT extends ESIntegTestCase { new FieldSortBuilder("avg_value_1").order(SortOrder.DESC), new FieldSortBuilder("avg_value_2").order(SortOrder.DESC))).gapPolicy( BucketHelpers.GapPolicy.SKIP))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -364,7 +364,7 @@ public class BucketSortIT extends ESIntegTestCase { new FieldSortBuilder("avg_value_2").order(SortOrder.DESC), new FieldSortBuilder("avg_value_1").order(SortOrder.ASC))).gapPolicy( BucketHelpers.GapPolicy.SKIP))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -385,7 +385,7 @@ public class BucketSortIT extends ESIntegTestCase { .subAggregation(bucketSort("bucketSort", Arrays.asList( new FieldSortBuilder("avg_value").order(SortOrder.DESC))).gapPolicy( BucketHelpers.GapPolicy.INSERT_ZEROS))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -405,7 +405,7 @@ public class BucketSortIT extends ESIntegTestCase { .setQuery(QueryBuilders.existsQuery("non-field")) .addAggregation(terms("foos").field(TERM_FIELD) .subAggregation(bucketSort("bucketSort", Arrays.asList(new FieldSortBuilder("_key"))))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -420,7 +420,7 @@ public class BucketSortIT extends ESIntegTestCase { () -> client().prepareSearch(INDEX) .addAggregation(terms("foos").field(TERM_FIELD) .subAggregation(bucketSort("bucketSort", Arrays.asList(new FieldSortBuilder("invalid"))))) - .execute().actionGet()); + .get()); assertThat(e.getCause().getMessage(), containsString("No aggregation found for path [invalid]")); } @@ -429,7 +429,7 @@ public class BucketSortIT extends ESIntegTestCase { () -> client().prepareSearch(INDEX) .addAggregation(terms("foos").field(TERM_FIELD) .subAggregation(bucketSort("bucketSort", Collections.emptyList()))) - .execute().actionGet()); + .get()); assertThat(e.getCause().getMessage(), containsString("[bucketSort] is configured to perform nothing." + " Please set either of [sort, size, from] to use bucket_sort")); } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/DateDerivativeIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/DateDerivativeIT.java index 95710ead1a4..d3f81b4580f 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/DateDerivativeIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/DateDerivativeIT.java @@ -88,7 +88,7 @@ public class DateDerivativeIT extends ESIntegTestCase { createIndex("idx"); createIndex("idx_unmapped"); // TODO: would be nice to have more random data here - prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").execute().actionGet(); + prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").get(); List builders = new ArrayList<>(); for (int i = 0; i < 2; i++) { builders.add(client().prepareIndex("empty_bucket_idx", "type", "" + i).setSource( @@ -114,7 +114,7 @@ public class DateDerivativeIT extends ESIntegTestCase { .prepareSearch("idx") .addAggregation( dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.MONTH).minDocCount(0) - .subAggregation(derivative("deriv", "_count"))).execute().actionGet(); + .subAggregation(derivative("deriv", "_count"))).get(); assertSearchResponse(response); @@ -156,8 +156,7 @@ public class DateDerivativeIT extends ESIntegTestCase { .prepareSearch("idx") .addAggregation( dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.MONTH).minDocCount(0) - .subAggregation(derivative("deriv", "_count").unit(DateHistogramInterval.DAY))).execute() - .actionGet(); + .subAggregation(derivative("deriv", "_count").unit(DateHistogramInterval.DAY))).get(); assertSearchResponse(response); @@ -216,8 +215,7 @@ public class DateDerivativeIT extends ESIntegTestCase { .addAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY) .timeZone(timezone).minDocCount(0) .subAggregation(derivative("deriv", "_count").unit(DateHistogramInterval.HOUR))) - .execute() - .actionGet(); + .get(); assertSearchResponse(response); @@ -254,8 +252,7 @@ public class DateDerivativeIT extends ESIntegTestCase { .addAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY) .timeZone(timezone).minDocCount(0) .subAggregation(derivative("deriv", "_count").unit(DateHistogramInterval.HOUR))) - .execute() - .actionGet(); + .get(); assertSearchResponse(response); @@ -294,8 +291,7 @@ public class DateDerivativeIT extends ESIntegTestCase { .addAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.HOUR) .timeZone(timezone).minDocCount(0) .subAggregation(derivative("deriv", "_count").unit(DateHistogramInterval.MINUTE))) - .execute() - .actionGet(); + .get(); assertSearchResponse(response); @@ -341,7 +337,7 @@ public class DateDerivativeIT extends ESIntegTestCase { .addAggregation( dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.MONTH).minDocCount(0) .subAggregation(sum("sum").field("value")).subAggregation(derivative("deriv", "sum"))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -411,7 +407,7 @@ public class DateDerivativeIT extends ESIntegTestCase { .prepareSearch("idx") .addAggregation( dateHistogram("histo").field("dates").dateHistogramInterval(DateHistogramInterval.MONTH).minDocCount(0) - .subAggregation(derivative("deriv", "_count"))).execute().actionGet(); + .subAggregation(derivative("deriv", "_count"))).get(); assertSearchResponse(response); @@ -466,7 +462,7 @@ public class DateDerivativeIT extends ESIntegTestCase { .prepareSearch("idx_unmapped") .addAggregation( dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.MONTH).minDocCount(0) - .subAggregation(derivative("deriv", "_count"))).execute().actionGet(); + .subAggregation(derivative("deriv", "_count"))).get(); assertSearchResponse(response); @@ -481,7 +477,7 @@ public class DateDerivativeIT extends ESIntegTestCase { .prepareSearch("idx", "idx_unmapped") .addAggregation( dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.MONTH).minDocCount(0) - .subAggregation(derivative("deriv", "_count"))).execute().actionGet(); + .subAggregation(derivative("deriv", "_count"))).get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/DerivativeIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/DerivativeIT.java index 33a581c63cb..df88ba95f53 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/DerivativeIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/DerivativeIT.java @@ -174,7 +174,7 @@ public class DerivativeIT extends ESIntegTestCase { .addAggregation( histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .subAggregation(derivative("deriv", "_count")) - .subAggregation(derivative("2nd_deriv", "deriv"))).execute().actionGet(); + .subAggregation(derivative("2nd_deriv", "deriv"))).get(); assertSearchResponse(response); @@ -213,7 +213,7 @@ public class DerivativeIT extends ESIntegTestCase { .addAggregation( histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval).minDocCount(0) .subAggregation(derivative("deriv", "_count").unit("1ms")) - .subAggregation(derivative("2nd_deriv", "deriv").unit("10ms"))).execute().actionGet(); + .subAggregation(derivative("2nd_deriv", "deriv").unit("10ms"))).get(); assertSearchResponse(response); @@ -251,7 +251,7 @@ public class DerivativeIT extends ESIntegTestCase { .addAggregation( histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME)) - .subAggregation(derivative("deriv", "sum"))).execute().actionGet(); + .subAggregation(derivative("deriv", "sum"))).get(); assertSearchResponse(response); @@ -297,7 +297,7 @@ public class DerivativeIT extends ESIntegTestCase { .addAggregation( histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .subAggregation(stats("stats").field(SINGLE_VALUED_FIELD_NAME)) - .subAggregation(derivative("deriv", "stats.sum"))).execute().actionGet(); + .subAggregation(derivative("deriv", "stats.sum"))).get(); assertSearchResponse(response); @@ -342,7 +342,7 @@ public class DerivativeIT extends ESIntegTestCase { .prepareSearch("idx_unmapped") .addAggregation( histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) - .subAggregation(derivative("deriv", "_count"))).execute().actionGet(); + .subAggregation(derivative("deriv", "_count"))).get(); assertSearchResponse(response); @@ -357,7 +357,7 @@ public class DerivativeIT extends ESIntegTestCase { .prepareSearch("idx", "idx_unmapped") .addAggregation( histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) - .subAggregation(derivative("deriv", "_count"))).execute().actionGet(); + .subAggregation(derivative("deriv", "_count"))).get(); assertSearchResponse(response); @@ -386,7 +386,7 @@ public class DerivativeIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .addAggregation( histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(1) - .subAggregation(derivative("deriv", "_count"))).execute().actionGet(); + .subAggregation(derivative("deriv", "_count"))).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(numDocsEmptyIdx)); @@ -416,7 +416,7 @@ public class DerivativeIT extends ESIntegTestCase { histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(1) .extendedBounds(0L, numBuckets_empty_rnd - 1) .subAggregation(derivative("deriv", "_count").gapPolicy(randomFrom(GapPolicy.values())))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(numDocsEmptyIdx_rnd)); @@ -444,8 +444,7 @@ public class DerivativeIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .addAggregation( histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(1) - .subAggregation(derivative("deriv", "_count").gapPolicy(GapPolicy.INSERT_ZEROS))).execute() - .actionGet(); + .subAggregation(derivative("deriv", "_count").gapPolicy(GapPolicy.INSERT_ZEROS))).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(numDocsEmptyIdx)); @@ -474,7 +473,7 @@ public class DerivativeIT extends ESIntegTestCase { .addAggregation( histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(1) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME)) - .subAggregation(derivative("deriv", "sum"))).execute().actionGet(); + .subAggregation(derivative("deriv", "sum"))).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(numDocsEmptyIdx)); @@ -515,8 +514,7 @@ public class DerivativeIT extends ESIntegTestCase { .addAggregation( histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(1) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME)) - .subAggregation(derivative("deriv", "sum").gapPolicy(GapPolicy.INSERT_ZEROS))).execute() - .actionGet(); + .subAggregation(derivative("deriv", "sum").gapPolicy(GapPolicy.INSERT_ZEROS))).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(numDocsEmptyIdx)); @@ -555,7 +553,7 @@ public class DerivativeIT extends ESIntegTestCase { histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(1) .extendedBounds(0L, (long) numBuckets_empty_rnd - 1) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME)) - .subAggregation(derivative("deriv", "sum").gapPolicy(gapPolicy))).execute().actionGet(); + .subAggregation(derivative("deriv", "sum").gapPolicy(gapPolicy))).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(numDocsEmptyIdx_rnd)); @@ -599,7 +597,7 @@ public class DerivativeIT extends ESIntegTestCase { .subAggregation( filters("filters", QueryBuilders.termQuery("tag", "foo")).subAggregation( sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .subAggregation(derivative("deriv", "filters>get>sum"))).execute().actionGet(); + .subAggregation(derivative("deriv", "filters>get>sum"))).get(); fail("Expected an Exception but didn't get one"); } catch (Exception e) { Throwable cause = ExceptionsHelper.unwrapCause(e); @@ -642,7 +640,7 @@ public class DerivativeIT extends ESIntegTestCase { histogram("histo").field("tick").interval(1) .subAggregation(avg("avg").field("value")) .subAggregation(movingAvg("movavg", "avg").modelBuilder(new SimpleModel.SimpleModelBuilder()).window(3)) - .subAggregation(derivative("deriv", "movavg"))).execute().actionGet(); + .subAggregation(derivative("deriv", "movavg"))).get(); assertSearchResponse(response); } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/ExtendedStatsBucketIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/ExtendedStatsBucketIT.java index 436a583695b..a8ebf687ad6 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/ExtendedStatsBucketIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/ExtendedStatsBucketIT.java @@ -108,7 +108,7 @@ public class ExtendedStatsBucketIT extends ESIntegTestCase { double sigma = randomDoubleBetween(1.0, 6.0, true); SearchResponse response = client().prepareSearch("idx_gappy") .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(1L)) - .addAggregation(extendedStatsBucket("extended_stats_bucket", "histo>_count").sigma(sigma)).execute().actionGet(); + .addAggregation(extendedStatsBucket("extended_stats_bucket", "histo>_count").sigma(sigma)).get(); assertSearchResponse(response); Histogram histo = response.getAggregations().get("histo"); assertThat(histo, notNullValue()); @@ -156,7 +156,7 @@ public class ExtendedStatsBucketIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) - .addAggregation(extendedStatsBucket("extended_stats_bucket", "histo>_count")).execute().actionGet(); + .addAggregation(extendedStatsBucket("extended_stats_bucket", "histo>_count")).get(); assertSearchResponse(response); @@ -203,7 +203,7 @@ public class ExtendedStatsBucketIT extends ESIntegTestCase { .subAggregation( histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) - .subAggregation(extendedStatsBucket("extended_stats_bucket", "histo>_count"))).execute().actionGet(); + .subAggregation(extendedStatsBucket("extended_stats_bucket", "histo>_count"))).get(); assertSearchResponse(response); @@ -254,7 +254,7 @@ public class ExtendedStatsBucketIT extends ESIntegTestCase { SearchResponse response = client() .prepareSearch("idx") .addAggregation(terms("terms").field("tag").subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .addAggregation(extendedStatsBucket("extended_stats_bucket", "terms>sum")).execute().actionGet(); + .addAggregation(extendedStatsBucket("extended_stats_bucket", "terms>sum")).get(); assertSearchResponse(response); @@ -304,7 +304,7 @@ public class ExtendedStatsBucketIT extends ESIntegTestCase { histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .subAggregation(extendedStatsBucket("extended_stats_bucket", "histo>sum"))).execute().actionGet(); + .subAggregation(extendedStatsBucket("extended_stats_bucket", "histo>sum"))).get(); assertSearchResponse(response); @@ -368,7 +368,7 @@ public class ExtendedStatsBucketIT extends ESIntegTestCase { .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) .subAggregation(extendedStatsBucket("extended_stats_bucket", "histo>sum") .gapPolicy(GapPolicy.INSERT_ZEROS))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -422,7 +422,7 @@ public class ExtendedStatsBucketIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(terms("terms").field("tag").includeExclude(new IncludeExclude(null, "tag.*")) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .addAggregation(extendedStatsBucket("extended_stats_bucket", "terms>sum")).execute().actionGet(); + .addAggregation(extendedStatsBucket("extended_stats_bucket", "terms>sum")).get(); assertSearchResponse(response); @@ -450,7 +450,7 @@ public class ExtendedStatsBucketIT extends ESIntegTestCase { .extendedBounds(minRandomValue, maxRandomValue) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) .subAggregation(extendedStatsBucket("extended_stats_bucket", "histo>sum") - .sigma(-1.0))).execute().actionGet()); + .sigma(-1.0))).get()); Throwable cause = ExceptionsHelper.unwrapCause(ex); if (cause == null) { throw ex; @@ -476,7 +476,7 @@ public class ExtendedStatsBucketIT extends ESIntegTestCase { histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) .subAggregation(extendedStatsBucket("avg_histo_bucket", "histo>_count"))) - .addAggregation(extendedStatsBucket("avg_terms_bucket", "terms>avg_histo_bucket.avg")).execute().actionGet(); + .addAggregation(extendedStatsBucket("avg_terms_bucket", "terms>avg_histo_bucket.avg")).get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/MaxBucketIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/MaxBucketIT.java index 232941ae392..3317fa8f37c 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/MaxBucketIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/MaxBucketIT.java @@ -109,7 +109,7 @@ public class MaxBucketIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) - .addAggregation(maxBucket("max_bucket", "histo>_count")).execute().actionGet(); + .addAggregation(maxBucket("max_bucket", "histo>_count")).get(); assertSearchResponse(response); @@ -152,7 +152,7 @@ public class MaxBucketIT extends ESIntegTestCase { .subAggregation( histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) - .subAggregation(maxBucket("max_bucket", "histo>_count"))).execute().actionGet(); + .subAggregation(maxBucket("max_bucket", "histo>_count"))).get(); assertSearchResponse(response); @@ -199,7 +199,7 @@ public class MaxBucketIT extends ESIntegTestCase { SearchResponse response = client() .prepareSearch("idx") .addAggregation(terms("terms").field("tag").subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .addAggregation(maxBucket("max_bucket", "terms>sum")).execute().actionGet(); + .addAggregation(maxBucket("max_bucket", "terms>sum")).get(); assertSearchResponse(response); @@ -245,7 +245,7 @@ public class MaxBucketIT extends ESIntegTestCase { histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .subAggregation(maxBucket("max_bucket", "histo>sum"))).execute().actionGet(); + .subAggregation(maxBucket("max_bucket", "histo>sum"))).get(); assertSearchResponse(response); @@ -301,7 +301,7 @@ public class MaxBucketIT extends ESIntegTestCase { histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .subAggregation(maxBucket("max_bucket", "histo>sum"))).execute().actionGet(); + .subAggregation(maxBucket("max_bucket", "histo>sum"))).get(); assertSearchResponse(response); @@ -351,7 +351,7 @@ public class MaxBucketIT extends ESIntegTestCase { .extendedBounds(minRandomValue, maxRandomValue) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) .subAggregation(maxBucket("max_bucket", "histo>sum").gapPolicy(GapPolicy.INSERT_ZEROS))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -400,7 +400,7 @@ public class MaxBucketIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(terms("terms").field("tag").includeExclude(new IncludeExclude(null, "tag.*")) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .addAggregation(maxBucket("max_bucket", "terms>sum")).execute().actionGet(); + .addAggregation(maxBucket("max_bucket", "terms>sum")).get(); assertSearchResponse(response); @@ -428,7 +428,7 @@ public class MaxBucketIT extends ESIntegTestCase { histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) .subAggregation(maxBucket("max_histo_bucket", "histo>_count"))) - .addAggregation(maxBucket("max_terms_bucket", "terms>max_histo_bucket")).execute().actionGet(); + .addAggregation(maxBucket("max_terms_bucket", "terms>max_histo_bucket")).get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/MinBucketIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/MinBucketIT.java index 081304d0709..6f024ef5633 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/MinBucketIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/MinBucketIT.java @@ -95,7 +95,7 @@ public class MinBucketIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) - .addAggregation(minBucket("min_bucket", "histo>_count")).execute().actionGet(); + .addAggregation(minBucket("min_bucket", "histo>_count")).get(); assertSearchResponse(response); @@ -138,7 +138,7 @@ public class MinBucketIT extends ESIntegTestCase { .subAggregation( histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) - .subAggregation(minBucket("min_bucket", "histo>_count"))).execute().actionGet(); + .subAggregation(minBucket("min_bucket", "histo>_count"))).get(); assertSearchResponse(response); @@ -185,7 +185,7 @@ public class MinBucketIT extends ESIntegTestCase { SearchResponse response = client() .prepareSearch("idx") .addAggregation(terms("terms").field("tag").subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .addAggregation(minBucket("min_bucket", "terms>sum")).execute().actionGet(); + .addAggregation(minBucket("min_bucket", "terms>sum")).get(); assertSearchResponse(response); @@ -231,7 +231,7 @@ public class MinBucketIT extends ESIntegTestCase { histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .subAggregation(minBucket("min_bucket", "histo>sum"))).execute().actionGet(); + .subAggregation(minBucket("min_bucket", "histo>sum"))).get(); assertSearchResponse(response); @@ -290,7 +290,7 @@ public class MinBucketIT extends ESIntegTestCase { .extendedBounds(minRandomValue, maxRandomValue) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) .subAggregation(minBucket("min_bucket", "histo>sum").gapPolicy(GapPolicy.INSERT_ZEROS))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -339,7 +339,7 @@ public class MinBucketIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(terms("terms").field("tag").includeExclude(new IncludeExclude(null, "tag.*")) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .addAggregation(minBucket("min_bucket", "terms>sum")).execute().actionGet(); + .addAggregation(minBucket("min_bucket", "terms>sum")).get(); assertSearchResponse(response); @@ -367,7 +367,7 @@ public class MinBucketIT extends ESIntegTestCase { histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) .subAggregation(minBucket("min_histo_bucket", "histo>_count"))) - .addAggregation(minBucket("min_terms_bucket", "terms>min_histo_bucket")).execute().actionGet(); + .addAggregation(minBucket("min_terms_bucket", "terms>min_histo_bucket")).get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/MovAvgIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/MovAvgIT.java index bfc04151a5c..23a7231e269 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/MovAvgIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/MovAvgIT.java @@ -414,7 +414,7 @@ public class MovAvgIT extends ESIntegTestCase { .window(windowSize) .modelBuilder(new SimpleModel.SimpleModelBuilder()) .gapPolicy(gapPolicy)) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); @@ -462,7 +462,7 @@ public class MovAvgIT extends ESIntegTestCase { .window(windowSize) .modelBuilder(new LinearModel.LinearModelBuilder()) .gapPolicy(gapPolicy)) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); @@ -510,7 +510,7 @@ public class MovAvgIT extends ESIntegTestCase { .window(windowSize) .modelBuilder(new EwmaModel.EWMAModelBuilder().alpha(alpha)) .gapPolicy(gapPolicy)) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); @@ -558,7 +558,7 @@ public class MovAvgIT extends ESIntegTestCase { .window(windowSize) .modelBuilder(new HoltLinearModel.HoltLinearModelBuilder().alpha(alpha).beta(beta)) .gapPolicy(gapPolicy)) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); @@ -611,7 +611,7 @@ public class MovAvgIT extends ESIntegTestCase { .alpha(alpha).beta(beta).gamma(gamma).period(period).seasonalityType(seasonalityType)) .gapPolicy(gapPolicy) .minimize(false)) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); @@ -659,7 +659,7 @@ public class MovAvgIT extends ESIntegTestCase { .window(windowSize) .modelBuilder(new SimpleModel.SimpleModelBuilder()) .gapPolicy(gapPolicy).predict(5))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -710,7 +710,7 @@ public class MovAvgIT extends ESIntegTestCase { .window(0) .modelBuilder(new SimpleModel.SimpleModelBuilder()) .gapPolicy(gapPolicy)) - ).execute().actionGet(); + ).get(); fail("MovingAvg should not accept a window that is zero"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("[window] must be a positive integer: [movavg_counts]")); @@ -728,7 +728,7 @@ public class MovAvgIT extends ESIntegTestCase { .window(windowSize) .modelBuilder(new SimpleModel.SimpleModelBuilder()) .gapPolicy(gapPolicy)) - ).execute().actionGet(); + ).get(); fail("MovingAvg should not accept non-histogram as parent"); } catch (SearchPhaseExecutionException exception) { @@ -748,7 +748,7 @@ public class MovAvgIT extends ESIntegTestCase { .window(-10) .modelBuilder(new SimpleModel.SimpleModelBuilder()) .gapPolicy(gapPolicy)) - ).execute().actionGet(); + ).get(); fail("MovingAvg should not accept a window that is negative"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("[window] must be a positive integer: [movavg_counts]")); @@ -766,7 +766,7 @@ public class MovAvgIT extends ESIntegTestCase { .window(windowSize) .modelBuilder(new SimpleModel.SimpleModelBuilder()) .gapPolicy(gapPolicy)) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); @@ -789,7 +789,7 @@ public class MovAvgIT extends ESIntegTestCase { .modelBuilder(new SimpleModel.SimpleModelBuilder()) .gapPolicy(gapPolicy) .predict(numPredictions)) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); @@ -813,7 +813,7 @@ public class MovAvgIT extends ESIntegTestCase { .modelBuilder(randomModelBuilder()) .gapPolicy(gapPolicy) .predict(0)) - ).execute().actionGet(); + ).get(); fail("MovingAvg should not accept a prediction size that is zero"); } catch (IllegalArgumentException exception) { @@ -834,7 +834,7 @@ public class MovAvgIT extends ESIntegTestCase { .modelBuilder(randomModelBuilder()) .gapPolicy(gapPolicy) .predict(-10)) - ).execute().actionGet(); + ).get(); fail("MovingAvg should not accept a prediction size that is negative"); } catch (IllegalArgumentException exception) { @@ -860,7 +860,7 @@ public class MovAvgIT extends ESIntegTestCase { .modelBuilder(new HoltWintersModel.HoltWintersModelBuilder() .alpha(alpha).beta(beta).gamma(gamma).period(20).seasonalityType(seasonalityType)) .gapPolicy(gapPolicy)) - ).execute().actionGet()); + ).get()); } public void testTwoMovAvgsWithPredictions() { @@ -885,7 +885,7 @@ public class MovAvgIT extends ESIntegTestCase { .modelBuilder(new SimpleModel.SimpleModelBuilder()) .gapPolicy(gapPolicy) .predict(12)) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); @@ -992,7 +992,7 @@ public class MovAvgIT extends ESIntegTestCase { .window(10) .modelBuilder(randomModelBuilder(100)) .gapPolicy(gapPolicy)) - ).execute().actionGet()); + ).get()); } public void testHoltWintersMinimization() { @@ -1014,7 +1014,7 @@ public class MovAvgIT extends ESIntegTestCase { .period(period).seasonalityType(seasonalityType)) .gapPolicy(gapPolicy) .minimize(true)) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); @@ -1098,7 +1098,7 @@ public class MovAvgIT extends ESIntegTestCase { .modelBuilder(new HoltLinearModel.HoltLinearModelBuilder().alpha(alpha).beta(beta)) .gapPolicy(gapPolicy) .minimize(true)) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); @@ -1147,7 +1147,7 @@ public class MovAvgIT extends ESIntegTestCase { .modelBuilder(new SimpleModel.SimpleModelBuilder()) .gapPolicy(gapPolicy) .minimize(true)) - ).execute().actionGet(); + ).get(); fail("Simple Model cannot be minimized, but an exception was not thrown"); } catch (SearchPhaseExecutionException e) { // All good @@ -1165,7 +1165,7 @@ public class MovAvgIT extends ESIntegTestCase { .modelBuilder(new LinearModel.LinearModelBuilder()) .gapPolicy(gapPolicy) .minimize(true)) - ).execute().actionGet(); + ).get(); fail("Linear Model cannot be minimized, but an exception was not thrown"); } catch (SearchPhaseExecutionException e) { // all good @@ -1195,7 +1195,7 @@ public class MovAvgIT extends ESIntegTestCase { .modelBuilder(builder) .gapPolicy(gapPolicy) .minimize(true)) - ).execute().actionGet(); + ).get(); } catch (SearchPhaseExecutionException e) { fail("Model [" + builder.toString() + "] can be minimized, but an exception was thrown"); } @@ -1220,7 +1220,7 @@ public class MovAvgIT extends ESIntegTestCase { jsonBuilder().startObject().field(INTERVAL_FIELD, i).field(VALUE_FIELD2, 10).endObject())); } - bulkBuilder.execute().actionGet(); + bulkBuilder.get(); ensureSearchable(); SearchResponse response = client() @@ -1236,7 +1236,7 @@ public class MovAvgIT extends ESIntegTestCase { movingAvg("movavg_values", "max") .window(windowSize) .modelBuilder(new SimpleModel.SimpleModelBuilder()) - .gapPolicy(BucketHelpers.GapPolicy.SKIP).predict(5))).execute().actionGet(); + .gapPolicy(BucketHelpers.GapPolicy.SKIP).predict(5))).get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/PercentilesBucketIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/PercentilesBucketIT.java index 330bbc647d9..4c67fb533e4 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/PercentilesBucketIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/PercentilesBucketIT.java @@ -100,7 +100,7 @@ public class PercentilesBucketIT extends ESIntegTestCase { .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) .addAggregation(percentilesBucket("percentiles_bucket", "histo>_count") - .percents(PERCENTS)).execute().actionGet(); + .percents(PERCENTS)).get(); assertSearchResponse(response); @@ -138,7 +138,7 @@ public class PercentilesBucketIT extends ESIntegTestCase { histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) .subAggregation(percentilesBucket("percentiles_bucket", "histo>_count") - .percents(PERCENTS))).execute().actionGet(); + .percents(PERCENTS))).get(); assertSearchResponse(response); @@ -180,7 +180,7 @@ public class PercentilesBucketIT extends ESIntegTestCase { .prepareSearch("idx") .addAggregation(terms("terms").field("tag").subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) .addAggregation(percentilesBucket("percentiles_bucket", "terms>sum") - .percents(PERCENTS)).execute().actionGet(); + .percents(PERCENTS)).get(); assertSearchResponse(response); @@ -213,7 +213,7 @@ public class PercentilesBucketIT extends ESIntegTestCase { SearchResponse response = client() .prepareSearch("idx") .addAggregation(terms("terms").field("tag").subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .addAggregation(percentilesBucket("percentiles_bucket", "terms>sum")).execute().actionGet(); + .addAggregation(percentilesBucket("percentiles_bucket", "terms>sum")).get(); assertSearchResponse(response); @@ -254,7 +254,7 @@ public class PercentilesBucketIT extends ESIntegTestCase { .extendedBounds(minRandomValue, maxRandomValue) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) .subAggregation(percentilesBucket("percentiles_bucket", "histo>sum") - .percents(PERCENTS))).execute().actionGet(); + .percents(PERCENTS))).get(); assertSearchResponse(response); @@ -309,7 +309,7 @@ public class PercentilesBucketIT extends ESIntegTestCase { .subAggregation(percentilesBucket("percentiles_bucket", "histo>sum") .gapPolicy(BucketHelpers.GapPolicy.INSERT_ZEROS) .percents(PERCENTS))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -354,7 +354,7 @@ public class PercentilesBucketIT extends ESIntegTestCase { .addAggregation(terms("terms").field("tag").includeExclude(new IncludeExclude(null, "tag.*")) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) .addAggregation(percentilesBucket("percentiles_bucket", "terms>sum") - .percents(PERCENTS)).execute().actionGet(); + .percents(PERCENTS)).get(); assertSearchResponse(response); @@ -377,7 +377,7 @@ public class PercentilesBucketIT extends ESIntegTestCase { .addAggregation(terms("terms").field("tag").includeExclude(new IncludeExclude(null, "tag.*")) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) .addAggregation(percentilesBucket("percentiles_bucket", "terms>sum") - .percents(PERCENTS)).execute().actionGet(); + .percents(PERCENTS)).get(); assertSearchResponse(response); @@ -406,7 +406,7 @@ public class PercentilesBucketIT extends ESIntegTestCase { client().prepareSearch("idx") .addAggregation(terms("terms").field("tag").subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) .addAggregation(percentilesBucket("percentiles_bucket", "terms>sum") - .percents(badPercents)).execute().actionGet(); + .percents(badPercents)).get(); fail("Illegal percent's were provided but no exception was thrown."); } catch (Exception e) { @@ -440,7 +440,7 @@ public class PercentilesBucketIT extends ESIntegTestCase { histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) .subAggregation(percentilesBucket("percentiles_bucket", "histo>_count") - .percents(badPercents))).execute().actionGet(); + .percents(badPercents))).get(); fail("Illegal percent's were provided but no exception was thrown."); } catch (Exception e) { @@ -472,7 +472,7 @@ public class PercentilesBucketIT extends ESIntegTestCase { .extendedBounds(minRandomValue, maxRandomValue)) .subAggregation(percentilesBucket("percentile_histo_bucket", "histo>_count").percents(PERCENTS))) .addAggregation(percentilesBucket("percentile_terms_bucket", "terms>percentile_histo_bucket.50") - .percents(PERCENTS)).execute().actionGet(); + .percents(PERCENTS)).get(); assertSearchResponse(response); @@ -532,7 +532,7 @@ public class PercentilesBucketIT extends ESIntegTestCase { .subAggregation(percentilesBucket("percentile_histo_bucket", "histo>_count") .percents(percent))) .addAggregation(percentilesBucket("percentile_terms_bucket", "terms>percentile_histo_bucket[99.9]") - .percents(percent)).execute().actionGet(); + .percents(percent)).get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/SerialDiffIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/SerialDiffIT.java index 8522beeecde..9d5c790628f 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/SerialDiffIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/SerialDiffIT.java @@ -239,7 +239,7 @@ public class SerialDiffIT extends ESIntegTestCase { .subAggregation(diff("diff_values", "the_metric") .lag(lag) .gapPolicy(gapPolicy)) - ).execute().actionGet(); + ).get(); assertSearchResponse(response); @@ -283,7 +283,7 @@ public class SerialDiffIT extends ESIntegTestCase { .subAggregation(diff("diff_counts", "_count") .lag(-1) .gapPolicy(gapPolicy)) - ).execute().actionGet(); + ).get(); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("[lag] must be a positive integer: [diff_counts]")); } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/StatsBucketIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/StatsBucketIT.java index eddbe47cae8..ce6e2782ad5 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/StatsBucketIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/StatsBucketIT.java @@ -95,7 +95,7 @@ public class StatsBucketIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) - .addAggregation(statsBucket("stats_bucket", "histo>_count")).execute().actionGet(); + .addAggregation(statsBucket("stats_bucket", "histo>_count")).get(); assertSearchResponse(response); @@ -139,7 +139,7 @@ public class StatsBucketIT extends ESIntegTestCase { .subAggregation( histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) - .subAggregation(statsBucket("stats_bucket", "histo>_count"))).execute().actionGet(); + .subAggregation(statsBucket("stats_bucket", "histo>_count"))).get(); assertSearchResponse(response); @@ -187,7 +187,7 @@ public class StatsBucketIT extends ESIntegTestCase { SearchResponse response = client() .prepareSearch("idx") .addAggregation(terms("terms").field("tag").subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .addAggregation(statsBucket("stats_bucket", "terms>sum")).execute().actionGet(); + .addAggregation(statsBucket("stats_bucket", "terms>sum")).get(); assertSearchResponse(response); @@ -234,7 +234,7 @@ public class StatsBucketIT extends ESIntegTestCase { histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .subAggregation(statsBucket("stats_bucket", "histo>sum"))).execute().actionGet(); + .subAggregation(statsBucket("stats_bucket", "histo>sum"))).get(); assertSearchResponse(response); @@ -294,7 +294,7 @@ public class StatsBucketIT extends ESIntegTestCase { .extendedBounds(minRandomValue, maxRandomValue) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) .subAggregation(statsBucket("stats_bucket", "histo>sum").gapPolicy(GapPolicy.INSERT_ZEROS))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -345,7 +345,7 @@ public class StatsBucketIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(terms("terms").field("tag").includeExclude(new IncludeExclude(null, "tag.*")) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .addAggregation(statsBucket("stats_bucket", "terms>sum")).execute().actionGet(); + .addAggregation(statsBucket("stats_bucket", "terms>sum")).get(); assertSearchResponse(response); @@ -372,7 +372,7 @@ public class StatsBucketIT extends ESIntegTestCase { histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) .subAggregation(statsBucket("avg_histo_bucket", "histo>_count"))) - .addAggregation(statsBucket("avg_terms_bucket", "terms>avg_histo_bucket.avg")).execute().actionGet(); + .addAggregation(statsBucket("avg_terms_bucket", "terms>avg_histo_bucket.avg")).get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/SumBucketIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/SumBucketIT.java index 40499ffb561..2eaa6708085 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/SumBucketIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/SumBucketIT.java @@ -95,7 +95,7 @@ public class SumBucketIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) - .addAggregation(sumBucket("sum_bucket", "histo>_count")).execute().actionGet(); + .addAggregation(sumBucket("sum_bucket", "histo>_count")).get(); assertSearchResponse(response); @@ -130,7 +130,7 @@ public class SumBucketIT extends ESIntegTestCase { .subAggregation( histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) - .subAggregation(sumBucket("sum_bucket", "histo>_count"))).execute().actionGet(); + .subAggregation(sumBucket("sum_bucket", "histo>_count"))).get(); assertSearchResponse(response); @@ -169,7 +169,7 @@ public class SumBucketIT extends ESIntegTestCase { SearchResponse response = client() .prepareSearch("idx") .addAggregation(terms("terms").field("tag").subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .addAggregation(sumBucket("sum_bucket", "terms>sum")).execute().actionGet(); + .addAggregation(sumBucket("sum_bucket", "terms>sum")).get(); assertSearchResponse(response); @@ -207,7 +207,7 @@ public class SumBucketIT extends ESIntegTestCase { histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .subAggregation(sumBucket("sum_bucket", "histo>sum"))).execute().actionGet(); + .subAggregation(sumBucket("sum_bucket", "histo>sum"))).get(); assertSearchResponse(response); @@ -258,7 +258,7 @@ public class SumBucketIT extends ESIntegTestCase { .extendedBounds(minRandomValue, maxRandomValue) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) .subAggregation(sumBucket("sum_bucket", "histo>sum").gapPolicy(GapPolicy.INSERT_ZEROS))) - .execute().actionGet(); + .get(); assertSearchResponse(response); @@ -300,7 +300,7 @@ public class SumBucketIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("idx") .addAggregation(terms("terms").field("tag").includeExclude(new IncludeExclude(null, "tag.*")) .subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME))) - .addAggregation(sumBucket("sum_bucket", "terms>sum")).execute().actionGet(); + .addAggregation(sumBucket("sum_bucket", "terms>sum")).get(); assertSearchResponse(response); @@ -327,7 +327,7 @@ public class SumBucketIT extends ESIntegTestCase { histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval) .extendedBounds(minRandomValue, maxRandomValue)) .subAggregation(sumBucket("sum_histo_bucket", "histo>_count"))) - .addAggregation(sumBucket("sum_terms_bucket", "terms>sum_histo_bucket")).execute().actionGet(); + .addAggregation(sumBucket("sum_terms_bucket", "terms>sum_histo_bucket")).get(); assertSearchResponse(response); diff --git a/server/src/test/java/org/elasticsearch/search/basic/SearchRedStateIndexIT.java b/server/src/test/java/org/elasticsearch/search/basic/SearchRedStateIndexIT.java index 65c83ed9525..676e50dfd56 100644 --- a/server/src/test/java/org/elasticsearch/search/basic/SearchRedStateIndexIT.java +++ b/server/src/test/java/org/elasticsearch/search/basic/SearchRedStateIndexIT.java @@ -50,7 +50,7 @@ public class SearchRedStateIndexIT extends ESIntegTestCase { buildRedIndex(numShards); SearchResponse searchResponse = client().prepareSearch().setSize(0).setAllowPartialSearchResults(true) - .execute().actionGet(); + .get(); assertThat(RestStatus.OK, equalTo(searchResponse.status())); assertThat("Expect no shards failed", searchResponse.getFailedShards(), equalTo(0)); assertThat("Expect no shards skipped", searchResponse.getSkippedShards(), equalTo(0)); @@ -64,7 +64,7 @@ public class SearchRedStateIndexIT extends ESIntegTestCase { setClusterDefaultAllowPartialResults(true); - SearchResponse searchResponse = client().prepareSearch().setSize(0).execute().actionGet(); + SearchResponse searchResponse = client().prepareSearch().setSize(0).get(); assertThat(RestStatus.OK, equalTo(searchResponse.status())); assertThat("Expect no shards failed", searchResponse.getFailedShards(), equalTo(0)); assertThat("Expect no shards skipped", searchResponse.getSkippedShards(), equalTo(0)); @@ -78,7 +78,7 @@ public class SearchRedStateIndexIT extends ESIntegTestCase { SearchPhaseExecutionException ex = expectThrows(SearchPhaseExecutionException.class, () -> - client().prepareSearch().setSize(0).setAllowPartialSearchResults(false).execute().actionGet() + client().prepareSearch().setSize(0).setAllowPartialSearchResults(false).get() ); assertThat(ex.getDetailedMessage(), containsString("Search rejected due to missing shard")); } @@ -90,7 +90,7 @@ public class SearchRedStateIndexIT extends ESIntegTestCase { setClusterDefaultAllowPartialResults(false); SearchPhaseExecutionException ex = expectThrows(SearchPhaseExecutionException.class, () -> - client().prepareSearch().setSize(0).execute().actionGet() + client().prepareSearch().setSize(0).get() ); assertThat(ex.getDetailedMessage(), containsString("Search rejected due to missing shard")); } @@ -103,8 +103,7 @@ public class SearchRedStateIndexIT extends ESIntegTestCase { ClusterUpdateSettingsResponse response1 = client().admin().cluster() .prepareUpdateSettings() .setTransientSettings(transientSettings) - .execute() - .actionGet(); + .get(); assertAcked(response1); assertEquals(response1.getTransientSettings().getAsBoolean(key, null), allowPartialResults); @@ -115,16 +114,16 @@ public class SearchRedStateIndexIT extends ESIntegTestCase { numShards).put("index.number_of_replicas", 0))); ensureGreen(); for (int i = 0; i < 10; i++) { - client().prepareIndex("test", "type1", ""+i).setSource("field1", "value1").execute().actionGet(); + client().prepareIndex("test", "type1", ""+i).setSource("field1", "value1").get(); } refresh(); internalCluster().stopRandomDataNode(); - client().admin().cluster().prepareHealth().setWaitForStatus(ClusterHealthStatus.RED).execute().actionGet(); + client().admin().cluster().prepareHealth().setWaitForStatus(ClusterHealthStatus.RED).get(); assertBusy(() -> { - ClusterState clusterState = client().admin().cluster().prepareState().execute().actionGet().getState(); + ClusterState clusterState = client().admin().cluster().prepareState().get().getState(); List unassigneds = clusterState.getRoutingTable().shardsWithState(ShardRoutingState.UNASSIGNED); assertThat(unassigneds.size(), greaterThan(0)); }); diff --git a/server/src/test/java/org/elasticsearch/search/basic/SearchWhileCreatingIndexIT.java b/server/src/test/java/org/elasticsearch/search/basic/SearchWhileCreatingIndexIT.java index af384fe2e56..b304bf2d797 100644 --- a/server/src/test/java/org/elasticsearch/search/basic/SearchWhileCreatingIndexIT.java +++ b/server/src/test/java/org/elasticsearch/search/basic/SearchWhileCreatingIndexIT.java @@ -67,26 +67,33 @@ public class SearchWhileCreatingIndexIT extends ESIntegTestCase { if (createIndex) { createIndex("test"); } - client().prepareIndex("test", "type1", id).setSource("field", "test").execute().actionGet(); - RefreshResponse refreshResponse = client().admin().indices().prepareRefresh("test").execute().actionGet(); - assertThat(refreshResponse.getSuccessfulShards(), greaterThanOrEqualTo(1)); // at least one shard should be successful when refreshing + client().prepareIndex("test", "type1", id).setSource("field", "test").get(); + RefreshResponse refreshResponse = client().admin().indices().prepareRefresh("test").get(); + // at least one shard should be successful when refreshing + assertThat(refreshResponse.getSuccessfulShards(), greaterThanOrEqualTo(1)); logger.info("using preference {}", preference); // we want to make sure that while recovery happens, and a replica gets recovered, its properly refreshed ClusterHealthStatus status = client().admin().cluster().prepareHealth("test").get().getStatus(); while (status != ClusterHealthStatus.GREEN) { // first, verify that search normal search works - SearchResponse searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.termQuery("field", "test")).execute().actionGet(); + SearchResponse searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.termQuery("field", "test")) + .get(); assertHitCount(searchResponse, 1); Client client = client(); - searchResponse = client.prepareSearch("test").setPreference(preference + Integer.toString(counter++)).setQuery(QueryBuilders.termQuery("field", "test")).execute().actionGet(); + searchResponse = client.prepareSearch("test").setPreference(preference + Integer.toString(counter++)) + .setQuery(QueryBuilders.termQuery("field", "test")).get(); if (searchResponse.getHits().getTotalHits().value != 1) { refresh(); - SearchResponse searchResponseAfterRefresh = client.prepareSearch("test").setPreference(preference).setQuery(QueryBuilders.termQuery("field", "test")).execute().actionGet(); - logger.info("hits count mismatch on any shard search failed, post explicit refresh hits are {}", searchResponseAfterRefresh.getHits().getTotalHits().value); + SearchResponse searchResponseAfterRefresh = client.prepareSearch("test").setPreference(preference) + .setQuery(QueryBuilders.termQuery("field", "test")).get(); + logger.info("hits count mismatch on any shard search failed, post explicit refresh hits are {}", + searchResponseAfterRefresh.getHits().getTotalHits().value); ensureGreen(); - SearchResponse searchResponseAfterGreen = client.prepareSearch("test").setPreference(preference).setQuery(QueryBuilders.termQuery("field", "test")).execute().actionGet(); - logger.info("hits count mismatch on any shard search failed, post explicit wait for green hits are {}", searchResponseAfterGreen.getHits().getTotalHits().value); + SearchResponse searchResponseAfterGreen = client.prepareSearch("test").setPreference(preference) + .setQuery(QueryBuilders.termQuery("field", "test")).get(); + logger.info("hits count mismatch on any shard search failed, post explicit wait for green hits are {}", + searchResponseAfterGreen.getHits().getTotalHits().value); assertHitCount(searchResponse, 1); } assertHitCount(searchResponse, 1); diff --git a/server/src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingIT.java b/server/src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingIT.java index e745a505da0..045afbfdf07 100644 --- a/server/src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingIT.java +++ b/server/src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingIT.java @@ -50,7 +50,7 @@ public class SearchWhileRelocatingIT extends ESIntegTestCase { final int numShards = between(1, 20); client().admin().indices().prepareCreate("test") .setSettings(Settings.builder().put("index.number_of_shards", numShards).put("index.number_of_replicas", numberOfReplicas)) - .addMapping("type", "loc", "type=geo_point", "test", "type=text").execute().actionGet(); + .addMapping("type", "loc", "type=geo_point", "test", "type=text").get(); ensureGreen(); List indexBuilders = new ArrayList<>(); final int numDocs = between(10, 20); @@ -113,7 +113,8 @@ public class SearchWhileRelocatingIT extends ESIntegTestCase { threads[j].join(); } // this might time out on some machines if they are really busy and you hit lots of throttling - ClusterHealthResponse resp = client().admin().cluster().prepareHealth().setWaitForYellowStatus().setWaitForNoRelocatingShards(true).setWaitForEvents(Priority.LANGUID).setTimeout("5m").get(); + ClusterHealthResponse resp = client().admin().cluster().prepareHealth().setWaitForYellowStatus() + .setWaitForNoRelocatingShards(true).setWaitForEvents(Priority.LANGUID).setTimeout("5m").get(); assertNoTimeout(resp); // if we hit only non-critical exceptions we make sure that the post search works if (!nonCriticalExceptions.isEmpty()) { diff --git a/server/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsIT.java b/server/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsIT.java index bf4fa1141ec..891e64f5237 100644 --- a/server/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsIT.java +++ b/server/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsIT.java @@ -118,7 +118,8 @@ public class SearchWithRandomExceptionsIT extends ESIntegTestCase { boolean[] added = new boolean[numDocs]; for (int i = 0; i < numDocs; i++) { try { - IndexResponse indexResponse = client().prepareIndex("test", "type", "" + i).setTimeout(TimeValue.timeValueSeconds(1)).setSource("test", English.intToEnglish(i)).get(); + IndexResponse indexResponse = client().prepareIndex("test", "type", "" + i) + .setTimeout(TimeValue.timeValueSeconds(1)).setSource("test", English.intToEnglish(i)).get(); if (indexResponse.getResult() == DocWriteResponse.Result.CREATED) { numCreated++; added[i] = true; @@ -127,9 +128,12 @@ public class SearchWithRandomExceptionsIT extends ESIntegTestCase { } } logger.info("Start Refresh"); - RefreshResponse refreshResponse = client().admin().indices().prepareRefresh("test").execute().get(); // don't assert on failures here + // don't assert on failures here + RefreshResponse refreshResponse = client().admin().indices().prepareRefresh("test").execute().get(); final boolean refreshFailed = refreshResponse.getShardFailures().length != 0 || refreshResponse.getFailedShards() != 0; - logger.info("Refresh failed [{}] numShardsFailed: [{}], shardFailuresLength: [{}], successfulShards: [{}], totalShards: [{}] ", refreshFailed, refreshResponse.getFailedShards(), refreshResponse.getShardFailures().length, refreshResponse.getSuccessfulShards(), refreshResponse.getTotalShards()); + logger.info("Refresh failed [{}] numShardsFailed: [{}], shardFailuresLength: [{}], successfulShards: [{}], totalShards: [{}] ", + refreshFailed, refreshResponse.getFailedShards(), refreshResponse.getShardFailures().length, + refreshResponse.getSuccessfulShards(), refreshResponse.getTotalShards()); NumShards test = getNumShards("test"); final int numSearches = scaledRandomIntBetween(100, 200); @@ -139,14 +143,16 @@ public class SearchWithRandomExceptionsIT extends ESIntegTestCase { int docToQuery = between(0, numDocs - 1); int expectedResults = added[docToQuery] ? 1 : 0; logger.info("Searching for [test:{}]", English.intToEnglish(docToQuery)); - SearchResponse searchResponse = client().prepareSearch().setQuery(QueryBuilders.matchQuery("test", English.intToEnglish(docToQuery))) + SearchResponse searchResponse = client().prepareSearch() + .setQuery(QueryBuilders.matchQuery("test", English.intToEnglish(docToQuery))) .setSize(expectedResults).get(); logger.info("Successful shards: [{}] numShards: [{}]", searchResponse.getSuccessfulShards(), test.numPrimaries); if (searchResponse.getSuccessfulShards() == test.numPrimaries && !refreshFailed) { assertResultsAndLogOnFailure(expectedResults, searchResponse); } // check match all - searchResponse = client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()).setSize(numCreated).addSort("_id", SortOrder.ASC).get(); + searchResponse = client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()).setSize(numCreated) + .addSort("_id", SortOrder.ASC).get(); logger.info("Match all Successful shards: [{}] numShards: [{}]", searchResponse.getSuccessfulShards(), test.numPrimaries); if (searchResponse.getSuccessfulShards() == test.numPrimaries && !refreshFailed) { assertResultsAndLogOnFailure(numCreated, searchResponse); diff --git a/server/src/test/java/org/elasticsearch/search/basic/SearchWithRandomIOExceptionsIT.java b/server/src/test/java/org/elasticsearch/search/basic/SearchWithRandomIOExceptionsIT.java index 931f9406588..3d39da60254 100644 --- a/server/src/test/java/org/elasticsearch/search/basic/SearchWithRandomIOExceptionsIT.java +++ b/server/src/test/java/org/elasticsearch/search/basic/SearchWithRandomIOExceptionsIT.java @@ -94,7 +94,7 @@ public class SearchWithRandomIOExceptionsIT extends ESIntegTestCase { logger.info("creating index: [test] using settings: [{}]", settings.build()); client().admin().indices().prepareCreate("test") .setSettings(settings) - .addMapping("type", mapping, XContentType.JSON).execute().actionGet(); + .addMapping("type", mapping, XContentType.JSON).get(); numInitialDocs = between(10, 100); ensureGreen(); for (int i = 0; i < numInitialDocs; i++) { @@ -112,14 +112,16 @@ public class SearchWithRandomIOExceptionsIT extends ESIntegTestCase { .put("index.number_of_replicas", randomIntBetween(0, 1)) .put(MockFSIndexStore.INDEX_CHECK_INDEX_ON_CLOSE_SETTING.getKey(), false) .put(MockFSDirectoryService.RANDOM_IO_EXCEPTION_RATE_SETTING.getKey(), exceptionRate) - .put(MockFSDirectoryService.RANDOM_IO_EXCEPTION_RATE_ON_OPEN_SETTING.getKey(), exceptionOnOpenRate); // we cannot expect that the index will be valid + // we cannot expect that the index will be valid + .put(MockFSDirectoryService.RANDOM_IO_EXCEPTION_RATE_ON_OPEN_SETTING.getKey(), exceptionOnOpenRate); logger.info("creating index: [test] using settings: [{}]", settings.build()); client().admin().indices().prepareCreate("test") .setSettings(settings) - .addMapping("type", mapping, XContentType.JSON).execute().actionGet(); + .addMapping("type", mapping, XContentType.JSON).get(); } ClusterHealthResponse clusterHealthResponse = client().admin().cluster() - .health(Requests.clusterHealthRequest().waitForYellowStatus().timeout(TimeValue.timeValueSeconds(5))).get(); // it's OK to timeout here + // it's OK to timeout here + .health(Requests.clusterHealthRequest().waitForYellowStatus().timeout(TimeValue.timeValueSeconds(5))).get(); final int numDocs; final boolean expectAllShardsFailed; if (clusterHealthResponse.isTimedOut()) { @@ -139,7 +141,8 @@ public class SearchWithRandomIOExceptionsIT extends ESIntegTestCase { for (int i = 0; i < numDocs; i++) { added[i] = false; try { - IndexResponse indexResponse = client().prepareIndex("test", "type", Integer.toString(i)).setTimeout(TimeValue.timeValueSeconds(1)).setSource("test", English.intToEnglish(i)).get(); + IndexResponse indexResponse = client().prepareIndex("test", "type", Integer.toString(i)) + .setTimeout(TimeValue.timeValueSeconds(1)).setSource("test", English.intToEnglish(i)).get(); if (indexResponse.getResult() == DocWriteResponse.Result.CREATED) { numCreated++; added[i] = true; @@ -150,9 +153,12 @@ public class SearchWithRandomIOExceptionsIT extends ESIntegTestCase { } ESIntegTestCase.NumShards numShards = getNumShards("test"); logger.info("Start Refresh"); - final RefreshResponse refreshResponse = client().admin().indices().prepareRefresh("test").execute().get(); // don't assert on failures here + // don't assert on failures here + final RefreshResponse refreshResponse = client().admin().indices().prepareRefresh("test").execute().get(); final boolean refreshFailed = refreshResponse.getShardFailures().length != 0 || refreshResponse.getFailedShards() != 0; - logger.info("Refresh failed [{}] numShardsFailed: [{}], shardFailuresLength: [{}], successfulShards: [{}], totalShards: [{}] ", refreshFailed, refreshResponse.getFailedShards(), refreshResponse.getShardFailures().length, refreshResponse.getSuccessfulShards(), refreshResponse.getTotalShards()); + logger.info("Refresh failed [{}] numShardsFailed: [{}], shardFailuresLength: [{}], successfulShards: [{}], totalShards: [{}] ", + refreshFailed, refreshResponse.getFailedShards(), refreshResponse.getShardFailures().length, + refreshResponse.getSuccessfulShards(), refreshResponse.getTotalShards()); final int numSearches = scaledRandomIntBetween(10, 20); // we don't check anything here really just making sure we don't leave any open files or a broken index behind. for (int i = 0; i < numSearches; i++) { @@ -160,7 +166,8 @@ public class SearchWithRandomIOExceptionsIT extends ESIntegTestCase { int docToQuery = between(0, numDocs - 1); int expectedResults = added[docToQuery] ? 1 : 0; logger.info("Searching for [test:{}]", English.intToEnglish(docToQuery)); - SearchResponse searchResponse = client().prepareSearch().setTypes("type").setQuery(QueryBuilders.matchQuery("test", English.intToEnglish(docToQuery))) + SearchResponse searchResponse = client().prepareSearch().setTypes("type") + .setQuery(QueryBuilders.matchQuery("test", English.intToEnglish(docToQuery))) .setSize(expectedResults).get(); logger.info("Successful shards: [{}] numShards: [{}]", searchResponse.getSuccessfulShards(), numShards.numPrimaries); if (searchResponse.getSuccessfulShards() == numShards.numPrimaries && !refreshFailed) { @@ -169,14 +176,16 @@ public class SearchWithRandomIOExceptionsIT extends ESIntegTestCase { // check match all searchResponse = client().prepareSearch().setTypes("type").setQuery(QueryBuilders.matchAllQuery()) .setSize(numCreated + numInitialDocs).addSort("_uid", SortOrder.ASC).get(); - logger.info("Match all Successful shards: [{}] numShards: [{}]", searchResponse.getSuccessfulShards(), numShards.numPrimaries); + logger.info("Match all Successful shards: [{}] numShards: [{}]", searchResponse.getSuccessfulShards(), + numShards.numPrimaries); if (searchResponse.getSuccessfulShards() == numShards.numPrimaries && !refreshFailed) { assertResultsAndLogOnFailure(numCreated + numInitialDocs, searchResponse); } } catch (SearchPhaseExecutionException ex) { logger.info("SearchPhaseException: [{}]", ex.getMessage()); // if a scheduled refresh or flush fails all shards we see all shards failed here - if (!(expectAllShardsFailed || refreshResponse.getSuccessfulShards() == 0 || ex.getMessage().contains("all shards failed"))) { + if (!(expectAllShardsFailed || refreshResponse.getSuccessfulShards() == 0 || + ex.getMessage().contains("all shards failed"))) { throw ex; } } @@ -190,7 +199,8 @@ public class SearchWithRandomIOExceptionsIT extends ESIntegTestCase { .put(MockFSDirectoryService.RANDOM_IO_EXCEPTION_RATE_ON_OPEN_SETTING.getKey(), 0)); client().admin().indices().prepareOpen("test").execute().get(); ensureGreen(); - SearchResponse searchResponse = client().prepareSearch().setTypes("type").setQuery(QueryBuilders.matchQuery("test", "init")).get(); + SearchResponse searchResponse = client().prepareSearch().setTypes("type") + .setQuery(QueryBuilders.matchQuery("test", "init")).get(); assertNoFailures(searchResponse); assertHitCount(searchResponse, numInitialDocs); } diff --git a/server/src/test/java/org/elasticsearch/search/basic/TransportSearchFailuresIT.java b/server/src/test/java/org/elasticsearch/search/basic/TransportSearchFailuresIT.java index 9384847b2ac..152a57a6c13 100644 --- a/server/src/test/java/org/elasticsearch/search/basic/TransportSearchFailuresIT.java +++ b/server/src/test/java/org/elasticsearch/search/basic/TransportSearchFailuresIT.java @@ -79,8 +79,8 @@ public class TransportSearchFailuresIT extends ESIntegTestCase { } allowNodes("test", 2); - assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForNodes(">=2").execute() - .actionGet().isTimedOut(), equalTo(false)); + assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForNodes(">=2").get() + .isTimedOut(), equalTo(false)); logger.info("Running Cluster Health"); ClusterHealthResponse clusterHealth = client() diff --git a/server/src/test/java/org/elasticsearch/search/basic/TransportTwoNodesSearchIT.java b/server/src/test/java/org/elasticsearch/search/basic/TransportTwoNodesSearchIT.java index be3679157a2..5d3b19697d7 100644 --- a/server/src/test/java/org/elasticsearch/search/basic/TransportTwoNodesSearchIT.java +++ b/server/src/test/java/org/elasticsearch/search/basic/TransportTwoNodesSearchIT.java @@ -135,7 +135,8 @@ public class TransportTwoNodesSearchIT extends ESIntegTestCase { refresh(); int total = 0; - SearchResponse searchResponse = client().prepareSearch("test").setSearchType(DFS_QUERY_THEN_FETCH).setQuery(termQuery("multi", "test")).setSize(60).setExplain(true).setScroll(TimeValue.timeValueSeconds(30)).get(); + SearchResponse searchResponse = client().prepareSearch("test").setSearchType(DFS_QUERY_THEN_FETCH) + .setQuery(termQuery("multi", "test")).setSize(60).setExplain(true).setScroll(TimeValue.timeValueSeconds(30)).get(); while (true) { assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(100L)); @@ -157,10 +158,12 @@ public class TransportTwoNodesSearchIT extends ESIntegTestCase { startsWith("N,")); assertThat(hit.getExplanation().getDetails()[0].getDetails()[1].getDetails()[1].getValue(), equalTo(100L)); - assertThat("id[" + hit.getId() + "] -> " + hit.getExplanation().toString(), hit.getId(), equalTo(Integer.toString(100 - total - i - 1))); + assertThat("id[" + hit.getId() + "] -> " + hit.getExplanation().toString(), hit.getId(), + equalTo(Integer.toString(100 - total - i - 1))); } total += hits.length; - searchResponse = client().prepareSearchScroll(searchResponse.getScrollId()).setScroll(TimeValue.timeValueSeconds(30)).get(); + searchResponse = client().prepareSearchScroll(searchResponse.getScrollId()).setScroll(TimeValue.timeValueSeconds(30)) + .get(); } clearScroll(searchResponse.getScrollId()); assertEquals(100, total); @@ -170,7 +173,9 @@ public class TransportTwoNodesSearchIT extends ESIntegTestCase { prepareData(); int total = 0; - SearchResponse searchResponse = client().prepareSearch("test").setSearchType(DFS_QUERY_THEN_FETCH).setQuery(termQuery("multi", "test")).setSize(60).setExplain(true).addSort("age", SortOrder.ASC).setScroll(TimeValue.timeValueSeconds(30)).get(); + SearchResponse searchResponse = client().prepareSearch("test").setSearchType(DFS_QUERY_THEN_FETCH) + .setQuery(termQuery("multi", "test")).setSize(60).setExplain(true).addSort("age", SortOrder.ASC) + .setScroll(TimeValue.timeValueSeconds(30)).get(); while (true) { assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(100L)); @@ -205,7 +210,8 @@ public class TransportTwoNodesSearchIT extends ESIntegTestCase { prepareData(); int total = 0; - SearchResponse searchResponse = client().prepareSearch("test").setSearchType(QUERY_THEN_FETCH).setQuery(termQuery("multi", "test")).setSize(60).setExplain(true).addSort("nid", SortOrder.DESC).setScroll(TimeValue.timeValueSeconds(30)).get(); + SearchResponse searchResponse = client().prepareSearch("test").setSearchType(QUERY_THEN_FETCH).setQuery(termQuery("multi", "test")) + .setSize(60).setExplain(true).addSort("nid", SortOrder.DESC).setScroll(TimeValue.timeValueSeconds(30)).get(); while (true) { assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(100L)); @@ -234,7 +240,8 @@ public class TransportTwoNodesSearchIT extends ESIntegTestCase { Set collectedIds = new TreeSet<>(); - SearchResponse searchResponse = client().search(searchRequest("test").source(source.from(0).size(60)).searchType(QUERY_THEN_FETCH)).actionGet(); + SearchResponse searchResponse = client().search(searchRequest("test").source(source.from(0).size(60)).searchType(QUERY_THEN_FETCH)) + .actionGet(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(100L)); assertThat(searchResponse.getHits().getHits().length, equalTo(60)); @@ -257,7 +264,8 @@ public class TransportTwoNodesSearchIT extends ESIntegTestCase { prepareData(); int total = 0; - SearchResponse searchResponse = client().prepareSearch("test").setQuery(termQuery("multi", "test")).setSize(60).setExplain(true).addSort("age", SortOrder.ASC).setScroll(TimeValue.timeValueSeconds(30)).get(); + SearchResponse searchResponse = client().prepareSearch("test").setQuery(termQuery("multi", "test")).setSize(60).setExplain(true) + .addSort("age", SortOrder.ASC).setScroll(TimeValue.timeValueSeconds(30)).get(); while (true) { assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(100L)); @@ -357,7 +365,7 @@ public class TransportTwoNodesSearchIT extends ESIntegTestCase { .add(client().prepareSearch("test").setQuery(new MatchQueryBuilder("foo", "biz"))) .add(client().prepareSearch("test").setQuery(QueryBuilders.termQuery("nid", 2))) .add(client().prepareSearch("test").setQuery(QueryBuilders.matchAllQuery())) - .execute().actionGet(); + .get(); assertThat(response.getResponses().length, equalTo(3)); assertThat(response.getResponses()[0].getFailureMessage(), notNullValue()); @@ -377,10 +385,11 @@ public class TransportTwoNodesSearchIT extends ESIntegTestCase { MultiSearchResponse response = client().prepareMultiSearch() // Add custom score query with bogus script - .add(client().prepareSearch("test").setQuery(QueryBuilders.functionScoreQuery(QueryBuilders.termQuery("nid", 1), new ScriptScoreFunctionBuilder(new Script(ScriptType.INLINE, "bar", "foo", Collections.emptyMap()))))) + .add(client().prepareSearch("test").setQuery(QueryBuilders.functionScoreQuery(QueryBuilders.termQuery("nid", 1), + new ScriptScoreFunctionBuilder(new Script(ScriptType.INLINE, "bar", "foo", Collections.emptyMap()))))) .add(client().prepareSearch("test").setQuery(QueryBuilders.termQuery("nid", 2))) .add(client().prepareSearch("test").setQuery(QueryBuilders.matchAllQuery())) - .execute().actionGet(); + .get(); assertThat(response.getResponses().length, equalTo(3)); assertThat(response.getResponses()[0].getFailureMessage(), notNullValue()); diff --git a/server/src/test/java/org/elasticsearch/search/fetch/FetchSubPhasePluginIT.java b/server/src/test/java/org/elasticsearch/search/fetch/FetchSubPhasePluginIT.java index 20f73b5903d..e6f7ecf6b37 100644 --- a/server/src/test/java/org/elasticsearch/search/fetch/FetchSubPhasePluginIT.java +++ b/server/src/test/java/org/elasticsearch/search/fetch/FetchSubPhasePluginIT.java @@ -83,13 +83,13 @@ public class FetchSubPhasePluginIT extends ESIntegTestCase { .field("type", "text").field("term_vector", "yes") .endObject() .endObject() - .endObject().endObject()).execute().actionGet(); + .endObject().endObject()).get(); client().index( indexRequest("test").type("type1").id("1") .source(jsonBuilder().startObject().field("test", "I am sam i am").endObject())).actionGet(); - client().admin().indices().prepareRefresh().execute().actionGet(); + client().admin().indices().prepareRefresh().get(); SearchResponse response = client().prepareSearch().setSource(new SearchSourceBuilder() .ext(Collections.singletonList(new TermVectorsFetchBuilder("test")))).get(); diff --git a/server/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/CustomHighlighterSearchIT.java b/server/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/CustomHighlighterSearchIT.java index 8e354a89774..b7eac260cd8 100644 --- a/server/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/CustomHighlighterSearchIT.java +++ b/server/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/CustomHighlighterSearchIT.java @@ -60,7 +60,7 @@ public class CustomHighlighterSearchIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch("test").setTypes("test") .setQuery(QueryBuilders.matchAllQuery()) .highlighter(new HighlightBuilder().field("name").highlighterType("test-custom")) - .execute().actionGet(); + .get(); assertHighlight(searchResponse, 0, "name", 0, equalTo("standard response for name at position 1")); } @@ -74,7 +74,7 @@ public class CustomHighlighterSearchIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch("test").setTypes("test") .setQuery(QueryBuilders.matchAllQuery()) .highlighter(new HighlightBuilder().field(highlightConfig)) - .execute().actionGet(); + .get(); assertHighlight(searchResponse, 0, "name", 0, equalTo("standard response for name at position 1")); assertHighlight(searchResponse, 0, "name", 1, equalTo("field:myFieldOption:someValue")); @@ -86,7 +86,7 @@ public class CustomHighlighterSearchIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch("test").setTypes("test").setQuery(QueryBuilders.matchAllQuery()) .highlighter(new HighlightBuilder().field("name").highlighterType("test-custom").options(options)) - .execute().actionGet(); + .get(); assertHighlight(searchResponse, 0, "name", 0, equalTo("standard response for name at position 1")); assertHighlight(searchResponse, 0, "name", 1, equalTo("field:myGlobalOption:someValue")); diff --git a/server/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/HighlighterSearchIT.java b/server/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/HighlighterSearchIT.java index 87a7a5ba927..03e2a8e8248 100644 --- a/server/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/HighlighterSearchIT.java +++ b/server/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/HighlighterSearchIT.java @@ -1615,7 +1615,7 @@ public class HighlighterSearchIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("test") .setQuery(QueryBuilders.matchQuery("text", "test")) - .highlighter(new HighlightBuilder().field("text")).execute().actionGet(); + .highlighter(new HighlightBuilder().field("text")).get(); // Mock tokenizer will throw an exception if it is resetted twice assertHitCount(response, 1L); } diff --git a/server/src/test/java/org/elasticsearch/search/fieldcaps/FieldCapabilitiesIT.java b/server/src/test/java/org/elasticsearch/search/fieldcaps/FieldCapabilitiesIT.java index 8440357758e..14640b191a2 100644 --- a/server/src/test/java/org/elasticsearch/search/fieldcaps/FieldCapabilitiesIT.java +++ b/server/src/test/java/org/elasticsearch/search/fieldcaps/FieldCapabilitiesIT.java @@ -95,7 +95,7 @@ public class FieldCapabilitiesIT extends ESIntegTestCase { public void testFieldAlias() { FieldCapabilitiesResponse response = client().prepareFieldCaps().setFields("distance", "route_length_miles") - .execute().actionGet(); + .get(); // Ensure the response has entries for both requested fields. assertTrue(response.get().containsKey("distance")); @@ -127,7 +127,7 @@ public class FieldCapabilitiesIT extends ESIntegTestCase { public void testFieldAliasWithWildcard() { FieldCapabilitiesResponse response = client().prepareFieldCaps().setFields("route*") - .execute().actionGet(); + .get(); assertEquals(1, response.get().size()); assertTrue(response.get().containsKey("route_length_miles")); @@ -136,7 +136,7 @@ public class FieldCapabilitiesIT extends ESIntegTestCase { public void testFieldAliasFiltering() { FieldCapabilitiesResponse response = client().prepareFieldCaps().setFields( "secret-soundtrack", "route_length_miles") - .execute().actionGet(); + .get(); assertEquals(1, response.get().size()); assertTrue(response.get().containsKey("route_length_miles")); } @@ -144,7 +144,7 @@ public class FieldCapabilitiesIT extends ESIntegTestCase { public void testFieldAliasFilteringWithWildcard() { FieldCapabilitiesResponse response = client().prepareFieldCaps() .setFields("distance", "secret*") - .execute().actionGet(); + .get(); assertEquals(1, response.get().size()); assertTrue(response.get().containsKey("distance")); } diff --git a/server/src/test/java/org/elasticsearch/search/fields/SearchFieldsIT.java b/server/src/test/java/org/elasticsearch/search/fields/SearchFieldsIT.java index 39222ee7632..eaedbbeb545 100644 --- a/server/src/test/java/org/elasticsearch/search/fields/SearchFieldsIT.java +++ b/server/src/test/java/org/elasticsearch/search/fields/SearchFieldsIT.java @@ -170,36 +170,36 @@ public class SearchFieldsIT extends ESIntegTestCase { .startObject("field3").field("type", "text").field("store", true).endObject() .endObject().endObject().endObject()); - client().admin().indices().preparePutMapping().setType("type1").setSource(mapping, XContentType.JSON).execute().actionGet(); + client().admin().indices().preparePutMapping().setType("type1").setSource(mapping, XContentType.JSON).get(); client().prepareIndex("test", "type1", "1").setSource(jsonBuilder().startObject() .field("field1", "value1") .field("field2", "value2") .field("field3", "value3") - .endObject()).execute().actionGet(); + .endObject()).get(); - client().admin().indices().prepareRefresh().execute().actionGet(); + client().admin().indices().prepareRefresh().get(); - SearchResponse searchResponse = client().prepareSearch().setQuery(matchAllQuery()).addStoredField("field1").execute().actionGet(); + SearchResponse searchResponse = client().prepareSearch().setQuery(matchAllQuery()).addStoredField("field1").get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); assertThat(searchResponse.getHits().getHits().length, equalTo(1)); assertThat(searchResponse.getHits().getAt(0).getFields().size(), equalTo(1)); assertThat(searchResponse.getHits().getAt(0).getFields().get("field1").getValue().toString(), equalTo("value1")); // field2 is not stored, check that it is not extracted from source. - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).addStoredField("field2").execute().actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).addStoredField("field2").get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); assertThat(searchResponse.getHits().getHits().length, equalTo(1)); assertThat(searchResponse.getHits().getAt(0).getFields().size(), equalTo(0)); assertThat(searchResponse.getHits().getAt(0).getFields().get("field2"), nullValue()); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).addStoredField("field3").execute().actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).addStoredField("field3").get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); assertThat(searchResponse.getHits().getHits().length, equalTo(1)); assertThat(searchResponse.getHits().getAt(0).getFields().size(), equalTo(1)); assertThat(searchResponse.getHits().getAt(0).getFields().get("field3").getValue().toString(), equalTo("value3")); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).addStoredField("*3").execute().actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).addStoredField("*3").get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); assertThat(searchResponse.getHits().getHits().length, equalTo(1)); assertThat(searchResponse.getHits().getAt(0).getFields().size(), equalTo(1)); @@ -219,20 +219,20 @@ public class SearchFieldsIT extends ESIntegTestCase { assertThat(searchResponse.getHits().getAt(0).getFields().get("field1").getValue().toString(), equalTo("value1")); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).addStoredField("field*").execute().actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).addStoredField("field*").get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); assertThat(searchResponse.getHits().getHits().length, equalTo(1)); assertThat(searchResponse.getHits().getAt(0).getFields().size(), equalTo(2)); assertThat(searchResponse.getHits().getAt(0).getFields().get("field3").getValue().toString(), equalTo("value3")); assertThat(searchResponse.getHits().getAt(0).getFields().get("field1").getValue().toString(), equalTo("value1")); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).addStoredField("f*3").execute().actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).addStoredField("f*3").get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); assertThat(searchResponse.getHits().getHits().length, equalTo(1)); assertThat(searchResponse.getHits().getAt(0).getFields().size(), equalTo(1)); assertThat(searchResponse.getHits().getAt(0).getFields().get("field3").getValue().toString(), equalTo("value3")); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).addStoredField("*").execute().actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).addStoredField("*").get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); assertThat(searchResponse.getHits().getHits().length, equalTo(1)); assertThat(searchResponse.getHits().getAt(0).getSourceAsMap(), nullValue()); @@ -260,7 +260,7 @@ public class SearchFieldsIT extends ESIntegTestCase { .startObject("num1").field("type", "double").field("store", true).endObject() .endObject().endObject().endObject()); - client().admin().indices().preparePutMapping().setType("type1").setSource(mapping, XContentType.JSON).execute().actionGet(); + client().admin().indices().preparePutMapping().setType("type1").setSource(mapping, XContentType.JSON).get(); client().prepareIndex("test", "type1", "1") .setSource(jsonBuilder().startObject() @@ -268,8 +268,8 @@ public class SearchFieldsIT extends ESIntegTestCase { .field("num1", 1.0f) .field("date", "1970-01-01T00:00:00") .endObject()) - .execute().actionGet(); - client().admin().indices().prepareFlush().execute().actionGet(); + .get(); + client().admin().indices().prepareFlush().get(); client().prepareIndex("test", "type1", "2") .setSource(jsonBuilder().startObject() .field("test", "value beck") @@ -277,7 +277,7 @@ public class SearchFieldsIT extends ESIntegTestCase { .field("date", "1970-01-01T00:00:25") .endObject()) .get(); - client().admin().indices().prepareFlush().execute().actionGet(); + client().admin().indices().prepareFlush().get(); client().prepareIndex("test", "type1", "3") .setSource(jsonBuilder().startObject() .field("test", "value beck") @@ -297,7 +297,7 @@ public class SearchFieldsIT extends ESIntegTestCase { new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_fields['num1'].value", Collections.emptyMap())) .addScriptField("date1", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "doc['date'].date.millis", Collections.emptyMap())) - .execute().actionGet(); + .get(); assertNoFailures(response); @@ -346,7 +346,7 @@ public class SearchFieldsIT extends ESIntegTestCase { } public void testIdBasedScriptFields() throws Exception { - prepareCreate("test").addMapping("type1", "num1", "type=long").execute().actionGet(); + prepareCreate("test").addMapping("type1", "num1", "type=long").get(); int numDocs = randomIntBetween(1, 30); IndexRequestBuilder[] indexRequestBuilders = new IndexRequestBuilder[numDocs]; @@ -421,7 +421,7 @@ public class SearchFieldsIT extends ESIntegTestCase { .startObject("obj2").startArray("arr2").value("arr_value1").value("arr_value2").endArray().endObject() .startArray("arr3").startObject().field("arr3_field1", "arr3_value1").endObject().endArray() .endObject()) - .execute().actionGet(); + .get(); client().admin().indices().refresh(refreshRequest()).actionGet(); SearchResponse response = client().prepareSearch() @@ -490,9 +490,9 @@ public class SearchFieldsIT extends ESIntegTestCase { .endArray() .endObject() .endObject()) - .execute().actionGet(); + .get(); - client().admin().indices().prepareRefresh().execute().actionGet(); + client().admin().indices().prepareRefresh().get(); } public void testStoredFieldsWithoutSource() throws Exception { @@ -546,7 +546,7 @@ public class SearchFieldsIT extends ESIntegTestCase { .endObject() .endObject()); - client().admin().indices().preparePutMapping().setType("type1").setSource(mapping, XContentType.JSON).execute().actionGet(); + client().admin().indices().preparePutMapping().setType("type1").setSource(mapping, XContentType.JSON).get(); ZonedDateTime date = ZonedDateTime.of(2012, 3, 22, 0, 0, 0, 0, ZoneOffset.UTC); client().prepareIndex("test", "type1", "1").setSource(jsonBuilder().startObject() @@ -559,9 +559,9 @@ public class SearchFieldsIT extends ESIntegTestCase { .field("date_field", DateFormatters.forPattern("dateOptionalTime").format(date)) .field("boolean_field", true) .field("binary_field", Base64.getEncoder().encodeToString("testing text".getBytes("UTF-8"))) - .endObject()).execute().actionGet(); + .endObject()).get(); - client().admin().indices().prepareRefresh().execute().actionGet(); + client().admin().indices().prepareRefresh().get(); SearchResponse searchResponse = client().prepareSearch().setQuery(matchAllQuery()) .addStoredField("byte_field") @@ -573,7 +573,7 @@ public class SearchFieldsIT extends ESIntegTestCase { .addStoredField("date_field") .addStoredField("boolean_field") .addStoredField("binary_field") - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); assertThat(searchResponse.getHits().getHits().length, equalTo(1)); @@ -756,7 +756,7 @@ public class SearchFieldsIT extends ESIntegTestCase { .endObject() .endObject()); - client().admin().indices().preparePutMapping().setType("type1").setSource(mapping, XContentType.JSON).execute().actionGet(); + client().admin().indices().preparePutMapping().setType("type1").setSource(mapping, XContentType.JSON).get(); ZonedDateTime date = ZonedDateTime.of(2012, 3, 22, 0, 0, 0, 0, ZoneOffset.UTC); client().prepareIndex("test", "type1", "1").setSource(jsonBuilder().startObject() @@ -772,9 +772,9 @@ public class SearchFieldsIT extends ESIntegTestCase { .field("boolean_field", true) .field("binary_field", new byte[] {42, 100}) .field("ip_field", "::1") - .endObject()).execute().actionGet(); + .endObject()).get(); - client().admin().indices().prepareRefresh().execute().actionGet(); + client().admin().indices().prepareRefresh().get(); SearchRequestBuilder builder = client().prepareSearch().setQuery(matchAllQuery()) .addDocValueField("text_field") @@ -789,7 +789,7 @@ public class SearchFieldsIT extends ESIntegTestCase { .addDocValueField("boolean_field") .addDocValueField("binary_field") .addDocValueField("ip_field"); - SearchResponse searchResponse = builder.execute().actionGet(); + SearchResponse searchResponse = builder.get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); assertThat(searchResponse.getHits().getHits().length, equalTo(1)); @@ -815,7 +815,7 @@ public class SearchFieldsIT extends ESIntegTestCase { builder = client().prepareSearch().setQuery(matchAllQuery()) .addDocValueField("*field"); - searchResponse = builder.execute().actionGet(); + searchResponse = builder.get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); assertThat(searchResponse.getHits().getHits().length, equalTo(1)); @@ -852,7 +852,7 @@ public class SearchFieldsIT extends ESIntegTestCase { .addDocValueField("boolean_field", "use_field_mapping") .addDocValueField("binary_field", "use_field_mapping") .addDocValueField("ip_field", "use_field_mapping"); - searchResponse = builder.execute().actionGet(); + searchResponse = builder.get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); assertThat(searchResponse.getHits().getHits().length, equalTo(1)); @@ -883,7 +883,7 @@ public class SearchFieldsIT extends ESIntegTestCase { .addDocValueField("float_field", "#.0") .addDocValueField("double_field", "#.0") .addDocValueField("date_field", "epoch_millis"); - searchResponse = builder.execute().actionGet(); + searchResponse = builder.get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); assertThat(searchResponse.getHits().getHits().length, equalTo(1)); @@ -981,7 +981,7 @@ public class SearchFieldsIT extends ESIntegTestCase { .addDocValueField("text_field_alias") .addDocValueField("date_field_alias", "use_field_mapping") .addDocValueField("date_field"); - SearchResponse searchResponse = builder.execute().actionGet(); + SearchResponse searchResponse = builder.get(); assertNoFailures(searchResponse); assertHitCount(searchResponse, 1); @@ -1045,7 +1045,7 @@ public class SearchFieldsIT extends ESIntegTestCase { SearchRequestBuilder builder = client().prepareSearch().setQuery(matchAllQuery()) .addDocValueField("*alias", "use_field_mapping") .addDocValueField("date_field"); - SearchResponse searchResponse = builder.execute().actionGet(); + SearchResponse searchResponse = builder.get(); assertNoFailures(searchResponse); assertHitCount(searchResponse, 1); diff --git a/server/src/test/java/org/elasticsearch/search/functionscore/ExplainableScriptIT.java b/server/src/test/java/org/elasticsearch/search/functionscore/ExplainableScriptIT.java index dec5663ca70..8e7686a4d0d 100644 --- a/server/src/test/java/org/elasticsearch/search/functionscore/ExplainableScriptIT.java +++ b/server/src/test/java/org/elasticsearch/search/functionscore/ExplainableScriptIT.java @@ -124,7 +124,7 @@ public class ExplainableScriptIT extends ESIntegTestCase { jsonBuilder().startObject().field("number_field", i).field("text", "text").endObject())); } indexRandom(true, true, indexRequests); - client().admin().indices().prepareRefresh().execute().actionGet(); + client().admin().indices().prepareRefresh().get(); ensureYellow(); SearchResponse response = client().search(searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source( searchSource().explain(true).query( diff --git a/server/src/test/java/org/elasticsearch/search/functionscore/FunctionScorePluginIT.java b/server/src/test/java/org/elasticsearch/search/functionscore/FunctionScorePluginIT.java index f8487cad059..cb67481d8dd 100644 --- a/server/src/test/java/org/elasticsearch/search/functionscore/FunctionScorePluginIT.java +++ b/server/src/test/java/org/elasticsearch/search/functionscore/FunctionScorePluginIT.java @@ -72,8 +72,8 @@ public class FunctionScorePluginIT extends ESIntegTestCase { "type1", jsonBuilder().startObject().startObject("type1").startObject("properties").startObject("test") .field("type", "text").endObject().startObject("num1").field("type", "date").endObject().endObject() - .endObject().endObject()).execute().actionGet(); - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForYellowStatus().execute().actionGet(); + .endObject().endObject()).get(); + client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForYellowStatus().get(); client().index( indexRequest("test").type("type1").id("1") @@ -82,7 +82,7 @@ public class FunctionScorePluginIT extends ESIntegTestCase { indexRequest("test").type("type1").id("2") .source(jsonBuilder().startObject().field("test", "value").field("num1", "2013-05-27").endObject())).actionGet(); - client().admin().indices().prepareRefresh().execute().actionGet(); + client().admin().indices().prepareRefresh().get(); DecayFunctionBuilder gfb = new CustomDistanceScoreBuilder("num1", "2013-05-28", "+1d"); ActionFuture response = client().search(searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source( diff --git a/server/src/test/java/org/elasticsearch/search/functionscore/QueryRescorerIT.java b/server/src/test/java/org/elasticsearch/search/functionscore/QueryRescorerIT.java index e0f549a1c1c..92d014db0a3 100644 --- a/server/src/test/java/org/elasticsearch/search/functionscore/QueryRescorerIT.java +++ b/server/src/test/java/org/elasticsearch/search/functionscore/QueryRescorerIT.java @@ -79,7 +79,7 @@ public class QueryRescorerIT extends ESIntegTestCase { // this int iters = scaledRandomIntBetween(10, 20); for (int i = 0; i < iters; i ++) { - client().prepareIndex("test", "type", Integer.toString(i)).setSource("f", Integer.toString(i)).execute().actionGet(); + client().prepareIndex("test", "type", Integer.toString(i)).setSource("f", Integer.toString(i)).get(); } refresh(); @@ -90,8 +90,7 @@ public class QueryRescorerIT extends ESIntegTestCase { .setRescorer(new QueryRescorerBuilder( functionScoreQuery(matchAllQuery(), ScoreFunctionBuilders.weightFactorFunction(100)).boostMode(CombineFunction.REPLACE)) - .setQueryWeight(0.0f).setRescoreQueryWeight(1.0f), 1).setSize(randomIntBetween(2, 10)).execute() - .actionGet(); + .setQueryWeight(0.0f).setRescoreQueryWeight(1.0f), 1).setSize(randomIntBetween(2, 10)).get(); assertSearchResponse(searchResponse); assertFirstHit(searchResponse, hasScore(100.f)); int numDocsWith100AsAScore = 0; @@ -115,7 +114,7 @@ public class QueryRescorerIT extends ESIntegTestCase { .field("analyzer", "whitespace").field("type", "text").endObject().endObject().endObject().endObject()) .setSettings(Settings.builder().put(indexSettings()).put("index.number_of_shards", 1))); - client().prepareIndex("test", "type1", "1").setSource("field1", "the quick brown fox").execute().actionGet(); + client().prepareIndex("test", "type1", "1").setSource("field1", "the quick brown fox").get(); client().prepareIndex("test", "type1", "2").setSource("field1", "the quick lazy huge brown fox jumps over the tree ").get(); client().prepareIndex("test", "type1", "3") .setSource("field1", "quick huge brown", "field2", "the quick lazy huge brown fox jumps over the tree").get(); @@ -124,7 +123,7 @@ public class QueryRescorerIT extends ESIntegTestCase { .setQuery(QueryBuilders.matchQuery("field1", "the quick brown").operator(Operator.OR)) .setRescorer( new QueryRescorerBuilder(matchPhraseQuery("field1", "quick brown").slop(2).boost(4.0f)) - .setRescoreQueryWeight(2), 5).execute().actionGet(); + .setRescoreQueryWeight(2), 5).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getMaxScore(), equalTo(searchResponse.getHits().getHits()[0].getScore())); @@ -135,7 +134,7 @@ public class QueryRescorerIT extends ESIntegTestCase { searchResponse = client().prepareSearch() .setQuery(QueryBuilders.matchQuery("field1", "the quick brown").operator(Operator.OR)) .setRescorer(new QueryRescorerBuilder(matchPhraseQuery("field1", "the quick brown").slop(3)), 5) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 3); assertFirstHit(searchResponse, hasId("1")); @@ -144,8 +143,7 @@ public class QueryRescorerIT extends ESIntegTestCase { searchResponse = client().prepareSearch() .setQuery(QueryBuilders.matchQuery("field1", "the quick brown").operator(Operator.OR)) - .setRescorer(new QueryRescorerBuilder(matchPhraseQuery("field1", "the quick brown")), 5).execute() - .actionGet(); + .setRescorer(new QueryRescorerBuilder(matchPhraseQuery("field1", "the quick brown")), 5).get(); assertHitCount(searchResponse, 3); assertThat(searchResponse.getHits().getMaxScore(), equalTo(searchResponse.getHits().getHits()[0].getScore())); @@ -164,30 +162,29 @@ public class QueryRescorerIT extends ESIntegTestCase { assertAcked(client().admin().indices().prepareCreate("test").addMapping("type1", mapping) .setSettings(builder.put("index.number_of_shards", 1))); - client().prepareIndex("test", "type1", "1").setSource("field1", "massachusetts avenue boston massachusetts").execute().actionGet(); - client().prepareIndex("test", "type1", "2").setSource("field1", "lexington avenue boston massachusetts").execute().actionGet(); - client().prepareIndex("test", "type1", "3").setSource("field1", "boston avenue lexington massachusetts").execute().actionGet(); - client().admin().indices().prepareRefresh("test").execute().actionGet(); - client().prepareIndex("test", "type1", "4").setSource("field1", "boston road lexington massachusetts").execute().actionGet(); - client().prepareIndex("test", "type1", "5").setSource("field1", "lexington street lexington massachusetts").execute().actionGet(); - client().prepareIndex("test", "type1", "6").setSource("field1", "massachusetts avenue lexington massachusetts").execute() - .actionGet(); - client().prepareIndex("test", "type1", "7").setSource("field1", "bosten street san franciso california").execute().actionGet(); - client().admin().indices().prepareRefresh("test").execute().actionGet(); - client().prepareIndex("test", "type1", "8").setSource("field1", "hollywood boulevard los angeles california").execute().actionGet(); - client().prepareIndex("test", "type1", "9").setSource("field1", "1st street boston massachussetts").execute().actionGet(); - client().prepareIndex("test", "type1", "10").setSource("field1", "1st street boston massachusetts").execute().actionGet(); - client().admin().indices().prepareRefresh("test").execute().actionGet(); - client().prepareIndex("test", "type1", "11").setSource("field1", "2st street boston massachusetts").execute().actionGet(); - client().prepareIndex("test", "type1", "12").setSource("field1", "3st street boston massachusetts").execute().actionGet(); - client().admin().indices().prepareRefresh("test").execute().actionGet(); + client().prepareIndex("test", "type1", "1").setSource("field1", "massachusetts avenue boston massachusetts").get(); + client().prepareIndex("test", "type1", "2").setSource("field1", "lexington avenue boston massachusetts").get(); + client().prepareIndex("test", "type1", "3").setSource("field1", "boston avenue lexington massachusetts").get(); + client().admin().indices().prepareRefresh("test").get(); + client().prepareIndex("test", "type1", "4").setSource("field1", "boston road lexington massachusetts").get(); + client().prepareIndex("test", "type1", "5").setSource("field1", "lexington street lexington massachusetts").get(); + client().prepareIndex("test", "type1", "6").setSource("field1", "massachusetts avenue lexington massachusetts").get(); + client().prepareIndex("test", "type1", "7").setSource("field1", "bosten street san franciso california").get(); + client().admin().indices().prepareRefresh("test").get(); + client().prepareIndex("test", "type1", "8").setSource("field1", "hollywood boulevard los angeles california").get(); + client().prepareIndex("test", "type1", "9").setSource("field1", "1st street boston massachussetts").get(); + client().prepareIndex("test", "type1", "10").setSource("field1", "1st street boston massachusetts").get(); + client().admin().indices().prepareRefresh("test").get(); + client().prepareIndex("test", "type1", "11").setSource("field1", "2st street boston massachusetts").get(); + client().prepareIndex("test", "type1", "12").setSource("field1", "3st street boston massachusetts").get(); + client().admin().indices().prepareRefresh("test").get(); SearchResponse searchResponse = client() .prepareSearch() .setQuery(QueryBuilders.matchQuery("field1", "lexington avenue massachusetts").operator(Operator.OR)) .setFrom(0) .setSize(5) .setRescorer(new QueryRescorerBuilder(matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3)) - .setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 20).execute().actionGet(); + .setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 20).get(); assertThat(searchResponse.getHits().getHits().length, equalTo(5)); assertHitCount(searchResponse, 9); @@ -202,7 +199,7 @@ public class QueryRescorerIT extends ESIntegTestCase { .setSize(5) .setSearchType(SearchType.DFS_QUERY_THEN_FETCH) .setRescorer(new QueryRescorerBuilder(matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3)) - .setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 20).execute().actionGet(); + .setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 20).get(); assertThat(searchResponse.getHits().getHits().length, equalTo(5)); assertHitCount(searchResponse, 9); @@ -219,7 +216,7 @@ public class QueryRescorerIT extends ESIntegTestCase { .setSize(5) .setSearchType(SearchType.DFS_QUERY_THEN_FETCH) .setRescorer(new QueryRescorerBuilder(matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3)) - .setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 20).execute().actionGet(); + .setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 20).get(); assertThat(searchResponse.getHits().getHits().length, equalTo(5)); assertHitCount(searchResponse, 9); @@ -238,19 +235,18 @@ public class QueryRescorerIT extends ESIntegTestCase { assertAcked(client().admin().indices().prepareCreate("test").addMapping("type1", mapping) .setSettings(builder.put("index.number_of_shards", 1))); - client().prepareIndex("test", "type1", "3").setSource("field1", "massachusetts").execute().actionGet(); - client().prepareIndex("test", "type1", "6").setSource("field1", "massachusetts avenue lexington massachusetts").execute() - .actionGet(); - client().admin().indices().prepareRefresh("test").execute().actionGet(); - client().prepareIndex("test", "type1", "1").setSource("field1", "lexington massachusetts avenue").execute().actionGet(); - client().prepareIndex("test", "type1", "2").setSource("field1", "lexington avenue boston massachusetts road").execute().actionGet(); - client().admin().indices().prepareRefresh("test").execute().actionGet(); + client().prepareIndex("test", "type1", "3").setSource("field1", "massachusetts").get(); + client().prepareIndex("test", "type1", "6").setSource("field1", "massachusetts avenue lexington massachusetts").get(); + client().admin().indices().prepareRefresh("test").get(); + client().prepareIndex("test", "type1", "1").setSource("field1", "lexington massachusetts avenue").get(); + client().prepareIndex("test", "type1", "2").setSource("field1", "lexington avenue boston massachusetts road").get(); + client().admin().indices().prepareRefresh("test").get(); SearchResponse searchResponse = client() .prepareSearch() .setQuery(QueryBuilders.matchQuery("field1", "massachusetts")) .setFrom(0) - .setSize(5).execute().actionGet(); + .setSize(5).get(); assertThat(searchResponse.getHits().getHits().length, equalTo(4)); assertHitCount(searchResponse, 4); assertThat(searchResponse.getHits().getMaxScore(), equalTo(searchResponse.getHits().getHits()[0].getScore())); @@ -266,7 +262,7 @@ public class QueryRescorerIT extends ESIntegTestCase { .setFrom(0) .setSize(5) .setRescorer(new QueryRescorerBuilder(matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3)) - .setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 2).execute().actionGet(); + .setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 2).get(); // Only top 2 hits were re-ordered: assertThat(searchResponse.getHits().getHits().length, equalTo(4)); assertHitCount(searchResponse, 4); @@ -283,7 +279,7 @@ public class QueryRescorerIT extends ESIntegTestCase { .setFrom(0) .setSize(5) .setRescorer(new QueryRescorerBuilder(matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3)) - .setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 3).execute().actionGet(); + .setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 3).get(); // Only top 3 hits were re-ordered: assertThat(searchResponse.getHits().getHits().length, equalTo(4)); @@ -306,19 +302,18 @@ public class QueryRescorerIT extends ESIntegTestCase { assertAcked(client().admin().indices().prepareCreate("test").addMapping("type1", mapping) .setSettings(builder.put("index.number_of_shards", 1))); - client().prepareIndex("test", "type1", "3").setSource("field1", "massachusetts").execute().actionGet(); - client().prepareIndex("test", "type1", "6").setSource("field1", "massachusetts avenue lexington massachusetts").execute() - .actionGet(); - client().admin().indices().prepareRefresh("test").execute().actionGet(); - client().prepareIndex("test", "type1", "1").setSource("field1", "lexington massachusetts avenue").execute().actionGet(); - client().prepareIndex("test", "type1", "2").setSource("field1", "lexington avenue boston massachusetts road").execute().actionGet(); - client().admin().indices().prepareRefresh("test").execute().actionGet(); + client().prepareIndex("test", "type1", "3").setSource("field1", "massachusetts").get(); + client().prepareIndex("test", "type1", "6").setSource("field1", "massachusetts avenue lexington massachusetts").get(); + client().admin().indices().prepareRefresh("test").get(); + client().prepareIndex("test", "type1", "1").setSource("field1", "lexington massachusetts avenue").get(); + client().prepareIndex("test", "type1", "2").setSource("field1", "lexington avenue boston massachusetts road").get(); + client().admin().indices().prepareRefresh("test").get(); SearchResponse searchResponse = client() .prepareSearch() .setQuery(QueryBuilders.matchQuery("field1", "massachusetts").operator(Operator.OR)) .setFrom(0) - .setSize(5).execute().actionGet(); + .setSize(5).get(); assertThat(searchResponse.getHits().getHits().length, equalTo(4)); assertHitCount(searchResponse, 4); assertThat(searchResponse.getHits().getMaxScore(), equalTo(searchResponse.getHits().getHits()[0].getScore())); @@ -334,7 +329,7 @@ public class QueryRescorerIT extends ESIntegTestCase { .setFrom(0) .setSize(5) .setRescorer(new QueryRescorerBuilder(matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3)) - .setQueryWeight(1.0f).setRescoreQueryWeight(-1f), 3).execute().actionGet(); + .setQueryWeight(1.0f).setRescoreQueryWeight(-1f), 3).get(); // 6 and 1 got worse, and then the hit (2) outside the rescore window were sorted ahead: assertThat(searchResponse.getHits().getMaxScore(), equalTo(searchResponse.getHits().getHits()[0].getScore())); @@ -405,13 +400,13 @@ public class QueryRescorerIT extends ESIntegTestCase { .setQueryWeight(1.0f) // no weight - so we basically use the same score as the actual query .setRescoreQueryWeight(0.0f), rescoreWindow) - .execute().actionGet(); + .get(); SearchResponse plain = client().prepareSearch() .setSearchType(SearchType.QUERY_THEN_FETCH) .setPreference("test") // ensure we hit the same shards for tie-breaking .setQuery(QueryBuilders.matchQuery("field1", query).operator(Operator.OR)).setFrom(0).setSize(resultSize) - .execute().actionGet(); + .get(); // check equivalence assertEquivalent(query, plain, rescored); @@ -425,8 +420,7 @@ public class QueryRescorerIT extends ESIntegTestCase { .setSize(resultSize) .setRescorer(new QueryRescorerBuilder(constantScoreQuery(matchPhraseQuery("field1", "not in the index").slop(3))) .setQueryWeight(1.0f) - .setRescoreQueryWeight(1.0f), rescoreWindow).execute() - .actionGet(); + .setRescoreQueryWeight(1.0f), rescoreWindow).get(); // check equivalence assertEquivalent(query, plain, rescored); } @@ -440,12 +434,10 @@ public class QueryRescorerIT extends ESIntegTestCase { .field("analyzer", "whitespace").field("type", "text").endObject().endObject().endObject().endObject()) ); ensureGreen(); - client().prepareIndex("test", "type1", "1").setSource("field1", "the quick brown fox").execute().actionGet(); - client().prepareIndex("test", "type1", "2").setSource("field1", "the quick lazy huge brown fox jumps over the tree").execute() - .actionGet(); + client().prepareIndex("test", "type1", "1").setSource("field1", "the quick brown fox").get(); + client().prepareIndex("test", "type1", "2").setSource("field1", "the quick lazy huge brown fox jumps over the tree").get(); client().prepareIndex("test", "type1", "3") - .setSource("field1", "quick huge brown", "field2", "the quick lazy huge brown fox jumps over the tree").execute() - .actionGet(); + .setSource("field1", "quick huge brown", "field2", "the quick lazy huge brown fox jumps over the tree").get(); refresh(); { @@ -454,8 +446,7 @@ public class QueryRescorerIT extends ESIntegTestCase { .setSearchType(SearchType.DFS_QUERY_THEN_FETCH) .setQuery(QueryBuilders.matchQuery("field1", "the quick brown").operator(Operator.OR)) .setRescorer(new QueryRescorerBuilder(matchPhraseQuery("field1", "the quick brown").slop(2).boost(4.0f)) - .setQueryWeight(0.5f).setRescoreQueryWeight(0.4f), 5).setExplain(true).execute() - .actionGet(); + .setQueryWeight(0.5f).setRescoreQueryWeight(0.4f), 5).setExplain(true).get(); assertHitCount(searchResponse, 3); assertFirstHit(searchResponse, hasId("1")); assertSecondHit(searchResponse, hasId("2")); @@ -492,8 +483,7 @@ public class QueryRescorerIT extends ESIntegTestCase { .prepareSearch() .setSearchType(SearchType.DFS_QUERY_THEN_FETCH) .setQuery(QueryBuilders.matchQuery("field1", "the quick brown").operator(Operator.OR)) - .setRescorer(innerRescoreQuery, 5).setExplain(true).execute() - .actionGet(); + .setRescorer(innerRescoreQuery, 5).setExplain(true).get(); assertHitCount(searchResponse, 3); assertFirstHit(searchResponse, hasId("1")); assertSecondHit(searchResponse, hasId("2")); diff --git a/server/src/test/java/org/elasticsearch/search/functionscore/RandomScoreFunctionIT.java b/server/src/test/java/org/elasticsearch/search/functionscore/RandomScoreFunctionIT.java index 508b9e953cf..c46f9f011a4 100644 --- a/server/src/test/java/org/elasticsearch/search/functionscore/RandomScoreFunctionIT.java +++ b/server/src/test/java/org/elasticsearch/search/functionscore/RandomScoreFunctionIT.java @@ -116,7 +116,7 @@ public class RandomScoreFunctionIT extends ESIntegTestCase { .setSize(docCount) // get all docs otherwise we are prone to tie-breaking .setPreference(preference) .setQuery(functionScoreQuery(matchAllQuery(), randomFunction().seed(seed).setField("foo"))) - .execute().actionGet(); + .get(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, CoreMatchers.equalTo(0)); final int hitCount = searchResponse.getHits().getHits().length; @@ -300,7 +300,7 @@ public class RandomScoreFunctionIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch() .setQuery(functionScoreQuery(matchAllQuery(), randomFunction())) .setSize(docCount) - .execute().actionGet(); + .get(); assertNoFailures(searchResponse); for (SearchHit hit : searchResponse.getHits().getHits()) { @@ -321,18 +321,18 @@ public class RandomScoreFunctionIT extends ESIntegTestCase { assertNoFailures(client().prepareSearch() .setSize(docCount) // get all docs otherwise we are prone to tie-breaking .setQuery(functionScoreQuery(matchAllQuery(), randomFunction().seed(randomInt()).setField(SeqNoFieldMapper.NAME))) - .execute().actionGet()); + .get()); assertNoFailures(client().prepareSearch() .setSize(docCount) // get all docs otherwise we are prone to tie-breaking .setQuery(functionScoreQuery(matchAllQuery(), randomFunction().seed(randomLong()).setField(SeqNoFieldMapper.NAME))) - .execute().actionGet()); + .get()); assertNoFailures(client().prepareSearch() .setSize(docCount) // get all docs otherwise we are prone to tie-breaking .setQuery(functionScoreQuery(matchAllQuery(), randomFunction() .seed(randomRealisticUnicodeOfLengthBetween(10, 20)).setField(SeqNoFieldMapper.NAME))) - .execute().actionGet()); + .get()); } public void checkDistribution() throws Exception { @@ -354,7 +354,7 @@ public class RandomScoreFunctionIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch() .setQuery(functionScoreQuery(matchAllQuery(), new RandomScoreFunctionBuilder())) - .execute().actionGet(); + .get(); matrix[Integer.valueOf(searchResponse.getHits().getAt(0).getId())]++; } diff --git a/server/src/test/java/org/elasticsearch/search/geo/GeoBoundingBoxIT.java b/server/src/test/java/org/elasticsearch/search/geo/GeoBoundingBoxIT.java index 3290875419a..4306ae680aa 100644 --- a/server/src/test/java/org/elasticsearch/search/geo/GeoBoundingBoxIT.java +++ b/server/src/test/java/org/elasticsearch/search/geo/GeoBoundingBoxIT.java @@ -59,49 +59,49 @@ public class GeoBoundingBoxIT extends ESIntegTestCase { client().prepareIndex("test", "type1", "1").setSource(jsonBuilder().startObject() .field("name", "New York") .startObject("location").field("lat", 40.7143528).field("lon", -74.0059731).endObject() - .endObject()).execute().actionGet(); + .endObject()).get(); // to NY: 5.286 km client().prepareIndex("test", "type1", "2").setSource(jsonBuilder().startObject() .field("name", "Times Square") .startObject("location").field("lat", 40.759011).field("lon", -73.9844722).endObject() - .endObject()).execute().actionGet(); + .endObject()).get(); // to NY: 0.4621 km client().prepareIndex("test", "type1", "3").setSource(jsonBuilder().startObject() .field("name", "Tribeca") .startObject("location").field("lat", 40.718266).field("lon", -74.007819).endObject() - .endObject()).execute().actionGet(); + .endObject()).get(); // to NY: 1.055 km client().prepareIndex("test", "type1", "4").setSource(jsonBuilder().startObject() .field("name", "Wall Street") .startObject("location").field("lat", 40.7051157).field("lon", -74.0088305).endObject() - .endObject()).execute().actionGet(); + .endObject()).get(); // to NY: 1.258 km client().prepareIndex("test", "type1", "5").setSource(jsonBuilder().startObject() .field("name", "Soho") .startObject("location").field("lat", 40.7247222).field("lon", -74).endObject() - .endObject()).execute().actionGet(); + .endObject()).get(); // to NY: 2.029 km client().prepareIndex("test", "type1", "6").setSource(jsonBuilder().startObject() .field("name", "Greenwich Village") .startObject("location").field("lat", 40.731033).field("lon", -73.9962255).endObject() - .endObject()).execute().actionGet(); + .endObject()).get(); // to NY: 8.572 km client().prepareIndex("test", "type1", "7").setSource(jsonBuilder().startObject() .field("name", "Brooklyn") .startObject("location").field("lat", 40.65).field("lon", -73.95).endObject() - .endObject()).execute().actionGet(); + .endObject()).get(); - client().admin().indices().prepareRefresh().execute().actionGet(); + client().admin().indices().prepareRefresh().get(); SearchResponse searchResponse = client().prepareSearch() // from NY .setQuery(geoBoundingBoxQuery("location").setCorners(40.73, -74.1, 40.717, -73.99)) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); assertThat(searchResponse.getHits().getHits().length, equalTo(2)); for (SearchHit hit : searchResponse.getHits()) { @@ -110,7 +110,7 @@ public class GeoBoundingBoxIT extends ESIntegTestCase { searchResponse = client().prepareSearch() // from NY .setQuery(geoBoundingBoxQuery("location").setCorners(40.73, -74.1, 40.717, -73.99).type("indexed")) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); assertThat(searchResponse.getHits().getHits().length, equalTo(2)); for (SearchHit hit : searchResponse.getHits()) { @@ -148,26 +148,28 @@ public class GeoBoundingBoxIT extends ESIntegTestCase { .setQuery( boolQuery().must(termQuery("userid", 880)).filter( geoBoundingBoxQuery("location").setCorners(74.579421999999994, 143.5, -66.668903999999998, 113.96875)) - ).execute().actionGet(); + ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); searchResponse = client().prepareSearch() .setQuery( boolQuery().must(termQuery("userid", 880)).filter( - geoBoundingBoxQuery("location").setCorners(74.579421999999994, 143.5, -66.668903999999998, 113.96875).type("indexed")) - ).execute().actionGet(); + geoBoundingBoxQuery("location").setCorners(74.579421999999994, 143.5, -66.668903999999998, 113.96875) + .type("indexed")) + ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); searchResponse = client().prepareSearch() .setQuery( boolQuery().must(termQuery("userid", 534)).filter( geoBoundingBoxQuery("location").setCorners(74.579421999999994, 143.5, -66.668903999999998, 113.96875)) - ).execute().actionGet(); + ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); searchResponse = client().prepareSearch() .setQuery( boolQuery().must(termQuery("userid", 534)).filter( - geoBoundingBoxQuery("location").setCorners(74.579421999999994, 143.5, -66.668903999999998, 113.96875).type("indexed")) - ).execute().actionGet(); + geoBoundingBoxQuery("location").setCorners(74.579421999999994, 143.5, -66.668903999999998, 113.96875) + .type("indexed")) + ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); } @@ -200,43 +202,47 @@ public class GeoBoundingBoxIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch() .setQuery( geoBoundingBoxQuery("location").setValidationMethod(GeoValidationMethod.COERCE).setCorners(50, -180, -50, 180) - ).execute().actionGet(); + ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); searchResponse = client().prepareSearch() .setQuery( - geoBoundingBoxQuery("location").setValidationMethod(GeoValidationMethod.COERCE).setCorners(50, -180, -50, 180).type("indexed") - ).execute().actionGet(); + geoBoundingBoxQuery("location").setValidationMethod(GeoValidationMethod.COERCE).setCorners(50, -180, -50, 180) + .type("indexed") + ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); searchResponse = client().prepareSearch() .setQuery( geoBoundingBoxQuery("location").setValidationMethod(GeoValidationMethod.COERCE).setCorners(90, -180, -90, 180) - ).execute().actionGet(); + ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); searchResponse = client().prepareSearch() .setQuery( - geoBoundingBoxQuery("location").setValidationMethod(GeoValidationMethod.COERCE).setCorners(90, -180, -90, 180).type("indexed") - ).execute().actionGet(); + geoBoundingBoxQuery("location").setValidationMethod(GeoValidationMethod.COERCE).setCorners(90, -180, -90, 180) + .type("indexed") + ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); searchResponse = client().prepareSearch() .setQuery( geoBoundingBoxQuery("location").setValidationMethod(GeoValidationMethod.COERCE).setCorners(50, 0, -50, 360) - ).execute().actionGet(); + ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); searchResponse = client().prepareSearch() .setQuery( - geoBoundingBoxQuery("location").setValidationMethod(GeoValidationMethod.COERCE).setCorners(50, 0, -50, 360).type("indexed") - ).execute().actionGet(); + geoBoundingBoxQuery("location").setValidationMethod(GeoValidationMethod.COERCE).setCorners(50, 0, -50, 360) + .type("indexed") + ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); searchResponse = client().prepareSearch() .setQuery( geoBoundingBoxQuery("location").setValidationMethod(GeoValidationMethod.COERCE).setCorners(90, 0, -90, 360) - ).execute().actionGet(); + ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); searchResponse = client().prepareSearch() .setQuery( - geoBoundingBoxQuery("location").setValidationMethod(GeoValidationMethod.COERCE).setCorners(90, 0, -90, 360).type("indexed") - ).execute().actionGet(); + geoBoundingBoxQuery("location").setValidationMethod(GeoValidationMethod.COERCE).setCorners(90, 0, -90, 360) + .type("indexed") + ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); } } diff --git a/server/src/test/java/org/elasticsearch/search/geo/GeoFilterIT.java b/server/src/test/java/org/elasticsearch/search/geo/GeoFilterIT.java index 2f26e448273..7231dc7f9a9 100644 --- a/server/src/test/java/org/elasticsearch/search/geo/GeoFilterIT.java +++ b/server/src/test/java/org/elasticsearch/search/geo/GeoFilterIT.java @@ -131,7 +131,8 @@ public class GeoFilterIT extends ESIntegTestCase { // polygon with hole new PolygonBuilder(new CoordinatesBuilder() .coordinate(-10, -10).coordinate(-10, 10).coordinate(10, 10).coordinate(10, -10).close()) - .hole(new LineStringBuilder(new CoordinatesBuilder().coordinate(-5, -5).coordinate(-5, 5).coordinate(5, 5).coordinate(5, -5).close())) + .hole(new LineStringBuilder(new CoordinatesBuilder().coordinate(-5, -5).coordinate(-5, 5).coordinate(5, 5) + .coordinate(5, -5).close())) .buildS4J(); try { // polygon with overlapping hole @@ -149,8 +150,10 @@ public class GeoFilterIT extends ESIntegTestCase { // polygon with intersection holes new PolygonBuilder(new CoordinatesBuilder() .coordinate(-10, -10).coordinate(-10, 10).coordinate(10, 10).coordinate(10, -10).close()) - .hole(new LineStringBuilder(new CoordinatesBuilder().coordinate(-5, -5).coordinate(-5, 5).coordinate(5, 5).coordinate(5, -5).close())) - .hole(new LineStringBuilder(new CoordinatesBuilder().coordinate(-5, -6).coordinate(5, -6).coordinate(5, -4).coordinate(-5, -4).close())) + .hole(new LineStringBuilder(new CoordinatesBuilder().coordinate(-5, -5).coordinate(-5, 5).coordinate(5, 5) + .coordinate(5, -5).close())) + .hole(new LineStringBuilder(new CoordinatesBuilder().coordinate(-5, -6).coordinate(5, -6).coordinate(5, -4) + .coordinate(-5, -4).close())) .buildS4J(); fail("Intersection of holes not detected"); } catch (InvalidShapeException e) { @@ -212,29 +215,30 @@ public class GeoFilterIT extends ESIntegTestCase { CreateIndexRequestBuilder mappingRequest = client().admin().indices().prepareCreate("shapes") .addMapping("polygon", mapping, XContentType.JSON); - mappingRequest.execute().actionGet(); - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); + mappingRequest.get(); + client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().get(); // Create a multipolygon with two polygons. The first is an rectangle of size 10x10 // with a hole of size 5x5 equidistant from all sides. This hole in turn contains // the second polygon of size 4x4 equidistant from all sites MultiPolygonBuilder polygon = new MultiPolygonBuilder() .polygon(new PolygonBuilder( - new CoordinatesBuilder().coordinate(-10, -10).coordinate(-10, 10).coordinate(10, 10).coordinate(10, -10).close()) + new CoordinatesBuilder().coordinate(-10, -10).coordinate(-10, 10).coordinate(10, 10).coordinate(10, -10) + .close()) .hole(new LineStringBuilder(new CoordinatesBuilder() .coordinate(-5, -5).coordinate(-5, 5).coordinate(5, 5).coordinate(5, -5).close()))) .polygon(new PolygonBuilder( new CoordinatesBuilder().coordinate(-4, -4).coordinate(-4, 4).coordinate(4, 4).coordinate(4, -4).close())); BytesReference data = BytesReference.bytes(jsonBuilder().startObject().field("area", polygon).endObject()); - client().prepareIndex("shapes", "polygon", "1").setSource(data, XContentType.JSON).execute().actionGet(); - client().admin().indices().prepareRefresh().execute().actionGet(); + client().prepareIndex("shapes", "polygon", "1").setSource(data, XContentType.JSON).get(); + client().admin().indices().prepareRefresh().get(); // Point in polygon SearchResponse result = client().prepareSearch() .setQuery(matchAllQuery()) .setPostFilter(QueryBuilders.geoIntersectionQuery("area", new PointBuilder(3, 3))) - .execute().actionGet(); + .get(); assertHitCount(result, 1); assertFirstHit(result, hasId("1")); @@ -242,7 +246,7 @@ public class GeoFilterIT extends ESIntegTestCase { result = client().prepareSearch() .setQuery(matchAllQuery()) .setPostFilter(QueryBuilders.geoIntersectionQuery("area", new PointBuilder(4.5, 4.5))) - .execute().actionGet(); + .get(); assertHitCount(result, 0); // by definition the border of a polygon belongs to the inner @@ -253,7 +257,7 @@ public class GeoFilterIT extends ESIntegTestCase { result = client().prepareSearch() .setQuery(matchAllQuery()) .setPostFilter(QueryBuilders.geoIntersectionQuery("area", new PointBuilder(10.0, 5.0))) - .execute().actionGet(); + .get(); assertHitCount(result, 1); assertFirstHit(result, hasId("1")); @@ -261,7 +265,7 @@ public class GeoFilterIT extends ESIntegTestCase { result = client().prepareSearch() .setQuery(matchAllQuery()) .setPostFilter(QueryBuilders.geoIntersectionQuery("area", new PointBuilder(5.0, 2.0))) - .execute().actionGet(); + .get(); assertHitCount(result, 1); assertFirstHit(result, hasId("1")); @@ -270,14 +274,14 @@ public class GeoFilterIT extends ESIntegTestCase { result = client().prepareSearch() .setQuery(matchAllQuery()) .setPostFilter(QueryBuilders.geoDisjointQuery("area", new PointBuilder(3, 3))) - .execute().actionGet(); + .get(); assertHitCount(result, 0); // Point in polygon hole result = client().prepareSearch() .setQuery(matchAllQuery()) .setPostFilter(QueryBuilders.geoDisjointQuery("area", new PointBuilder(4.5, 4.5))) - .execute().actionGet(); + .get(); assertHitCount(result, 1); assertFirstHit(result, hasId("1")); } @@ -289,14 +293,14 @@ public class GeoFilterIT extends ESIntegTestCase { new CoordinatesBuilder().coordinate(-4, -4).coordinate(-4, 4).coordinate(4, 4).coordinate(4, -4).close())); data = BytesReference.bytes(jsonBuilder().startObject().field("area", inverse).endObject()); - client().prepareIndex("shapes", "polygon", "2").setSource(data, XContentType.JSON).execute().actionGet(); - client().admin().indices().prepareRefresh().execute().actionGet(); + client().prepareIndex("shapes", "polygon", "2").setSource(data, XContentType.JSON).get(); + client().admin().indices().prepareRefresh().get(); // re-check point on polygon hole result = client().prepareSearch() .setQuery(matchAllQuery()) .setPostFilter(QueryBuilders.geoIntersectionQuery("area", new PointBuilder(4.5, 4.5))) - .execute().actionGet(); + .get(); assertHitCount(result, 1); assertFirstHit(result, hasId("2")); @@ -314,7 +318,7 @@ public class GeoFilterIT extends ESIntegTestCase { result = client().prepareSearch() .setQuery(matchAllQuery()) .setPostFilter(QueryBuilders.geoWithinQuery("area", builder)) - .execute().actionGet(); + .get(); assertHitCount(result, 2); } @@ -323,40 +327,41 @@ public class GeoFilterIT extends ESIntegTestCase { .coordinate(170, -10).coordinate(190, -10).coordinate(190, 10).coordinate(170, 10).close()); data = BytesReference.bytes(jsonBuilder().startObject().field("area", builder).endObject()); - client().prepareIndex("shapes", "polygon", "1").setSource(data, XContentType.JSON).execute().actionGet(); - client().admin().indices().prepareRefresh().execute().actionGet(); + client().prepareIndex("shapes", "polygon", "1").setSource(data, XContentType.JSON).get(); + client().admin().indices().prepareRefresh().get(); // Create a polygon crossing longitude 180 with hole. builder = new PolygonBuilder(new CoordinatesBuilder() .coordinate(170, -10).coordinate(190, -10).coordinate(190, 10).coordinate(170, 10).close()) - .hole(new LineStringBuilder(new CoordinatesBuilder().coordinate(175, -5).coordinate(185, -5).coordinate(185, 5).coordinate(175, 5).close())); + .hole(new LineStringBuilder(new CoordinatesBuilder().coordinate(175, -5).coordinate(185, -5).coordinate(185, 5) + .coordinate(175, 5).close())); data = BytesReference.bytes(jsonBuilder().startObject().field("area", builder).endObject()); - client().prepareIndex("shapes", "polygon", "1").setSource(data, XContentType.JSON).execute().actionGet(); - client().admin().indices().prepareRefresh().execute().actionGet(); + client().prepareIndex("shapes", "polygon", "1").setSource(data, XContentType.JSON).get(); + client().admin().indices().prepareRefresh().get(); result = client().prepareSearch() .setQuery(matchAllQuery()) .setPostFilter(QueryBuilders.geoIntersectionQuery("area", new PointBuilder(174, -4))) - .execute().actionGet(); + .get(); assertHitCount(result, 1); result = client().prepareSearch() .setQuery(matchAllQuery()) .setPostFilter(QueryBuilders.geoIntersectionQuery("area", new PointBuilder(-174, -4))) - .execute().actionGet(); + .get(); assertHitCount(result, 1); result = client().prepareSearch() .setQuery(matchAllQuery()) .setPostFilter(QueryBuilders.geoIntersectionQuery("area", new PointBuilder(180, -4))) - .execute().actionGet(); + .get(); assertHitCount(result, 0); result = client().prepareSearch() .setQuery(matchAllQuery()) .setPostFilter(QueryBuilders.geoIntersectionQuery("area", new PointBuilder(180, -6))) - .execute().actionGet(); + .get(); assertHitCount(result, 1); } @@ -381,19 +386,19 @@ public class GeoFilterIT extends ESIntegTestCase { .endObject(); client().admin().indices().prepareCreate("countries").setSettings(settings) - .addMapping("country", xContentBuilder).execute().actionGet(); + .addMapping("country", xContentBuilder).get(); BulkResponse bulk = client().prepareBulk().add(bulkAction, 0, bulkAction.length, null, null, xContentBuilder.contentType()).get(); for (BulkItemResponse item : bulk.getItems()) { assertFalse("unable to index data", item.isFailed()); } - client().admin().indices().prepareRefresh().execute().actionGet(); + client().admin().indices().prepareRefresh().get(); String key = "DE"; SearchResponse searchResponse = client().prepareSearch() .setQuery(matchQuery("_id", key)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 1); @@ -403,13 +408,13 @@ public class GeoFilterIT extends ESIntegTestCase { SearchResponse world = client().prepareSearch().addStoredField("pin").setQuery( geoBoundingBoxQuery("pin").setCorners(90, -179.99999, -90, 179.99999) - ).execute().actionGet(); + ).get(); assertHitCount(world, 53); SearchResponse distance = client().prepareSearch().addStoredField("pin").setQuery( geoDistanceQuery("pin").distance("425km").point(51.11, 9.851) - ).execute().actionGet(); + ).get(); assertHitCount(distance, 5); GeoPoint point = new GeoPoint(); @@ -441,11 +446,14 @@ public class GeoFilterIT extends ESIntegTestCase { assertThat(GeoHashUtils.addNeighbors("r", new ArrayList()), containsInAnyOrder("0", "2", "8", "n", "p", "q", "w", "x")); // level1: simple case - assertThat(GeoHashUtils.addNeighbors("dk", new ArrayList()), containsInAnyOrder("d5", "d7", "de", "dh", "dj", "dm", "ds", "dt")); + assertThat(GeoHashUtils.addNeighbors("dk", new ArrayList()), + containsInAnyOrder("d5", "d7", "de", "dh", "dj", "dm", "ds", "dt")); // Level1: crossing cells - assertThat(GeoHashUtils.addNeighbors("d5", new ArrayList()), containsInAnyOrder("d4", "d6", "d7", "dh", "dk", "9f", "9g", "9u")); - assertThat(GeoHashUtils.addNeighbors("d0", new ArrayList()), containsInAnyOrder("d1", "d2", "d3", "9b", "9c", "6p", "6r", "3z")); + assertThat(GeoHashUtils.addNeighbors("d5", new ArrayList()), + containsInAnyOrder("d4", "d6", "d7", "dh", "dk", "9f", "9g", "9u")); + assertThat(GeoHashUtils.addNeighbors("d0", new ArrayList()), + containsInAnyOrder("d1", "d2", "d3", "9b", "9c", "6p", "6r", "3z")); } public static double distance(double lat1, double lon1, double lat2, double lon2) { diff --git a/server/src/test/java/org/elasticsearch/search/geo/GeoPolygonIT.java b/server/src/test/java/org/elasticsearch/search/geo/GeoPolygonIT.java index 741efa6c595..80f7fa32f01 100644 --- a/server/src/test/java/org/elasticsearch/search/geo/GeoPolygonIT.java +++ b/server/src/test/java/org/elasticsearch/search/geo/GeoPolygonIT.java @@ -104,7 +104,7 @@ public class GeoPolygonIT extends ESIntegTestCase { points.add(new GeoPoint(40.7, -74.0)); SearchResponse searchResponse = client().prepareSearch("test") // from NY .setQuery(boolQuery().must(geoPolygonQuery("location", points))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 4); assertThat(searchResponse.getHits().getHits().length, equalTo(4)); for (SearchHit hit : searchResponse.getHits()) { @@ -119,7 +119,7 @@ public class GeoPolygonIT extends ESIntegTestCase { points.add(new GeoPoint(40.8, -74.1)); points.add(new GeoPoint(40.8, -74.0)); SearchResponse searchResponse = client().prepareSearch("test") // from NY - .setQuery(boolQuery().must(geoPolygonQuery("location", points))).execute().actionGet(); + .setQuery(boolQuery().must(geoPolygonQuery("location", points))).get(); assertHitCount(searchResponse, 4); assertThat(searchResponse.getHits().getHits().length, equalTo(4)); for (SearchHit hit : searchResponse.getHits()) { @@ -136,7 +136,7 @@ public class GeoPolygonIT extends ESIntegTestCase { points.add(new GeoPoint(40.7, -74.0)); SearchResponse searchResponse = client().prepareSearch("test") // from NY .setQuery(boolQuery().must(geoPolygonQuery("alias", points))) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 4); } } diff --git a/server/src/test/java/org/elasticsearch/search/geo/GeoShapeQueryTests.java b/server/src/test/java/org/elasticsearch/search/geo/GeoShapeQueryTests.java index 9f2d1ea8a57..6c90dcf59e9 100644 --- a/server/src/test/java/org/elasticsearch/search/geo/GeoShapeQueryTests.java +++ b/server/src/test/java/org/elasticsearch/search/geo/GeoShapeQueryTests.java @@ -69,12 +69,12 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { .field("type", "geo_shape") .endObject().endObject() .endObject().endObject()); - client().admin().indices().prepareCreate("test").addMapping("type1", mapping, XContentType.JSON).execute().actionGet(); + client().admin().indices().prepareCreate("test").addMapping("type1", mapping, XContentType.JSON).get(); ensureGreen(); client().prepareIndex("test", "type1", "aNullshape").setSource("{\"location\": null}", XContentType.JSON) .setRefreshPolicy(IMMEDIATE).get(); - GetResponse result = client().prepareGet("test", "type1", "aNullshape").execute().actionGet(); + GetResponse result = client().prepareGet("test", "type1", "aNullshape").get(); assertThat(result.getField("location"), nullValue()); } @@ -85,7 +85,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { .field("tree", "quadtree") .endObject().endObject() .endObject().endObject()); - client().admin().indices().prepareCreate("test").addMapping("type1", mapping, XContentType.JSON).execute().actionGet(); + client().admin().indices().prepareCreate("test").addMapping("type1", mapping, XContentType.JSON).get(); ensureGreen(); client().prepareIndex("test", "type1", "1").setSource(jsonBuilder().startObject() @@ -108,7 +108,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { SearchResponse searchResponse = client().prepareSearch("test").setTypes("type1") .setQuery(geoIntersectionQuery("location", shape)) - .execute().actionGet(); + .get(); assertSearchResponse(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); @@ -117,7 +117,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { searchResponse = client().prepareSearch("test").setTypes("type1") .setQuery(geoShapeQuery("location", shape)) - .execute().actionGet(); + .get(); assertSearchResponse(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); @@ -132,7 +132,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { .field("tree", "quadtree") .endObject().endObject() .endObject().endObject()); - client().admin().indices().prepareCreate("test").addMapping("type1", mapping, XContentType.JSON).execute().actionGet(); + client().admin().indices().prepareCreate("test").addMapping("type1", mapping, XContentType.JSON).get(); ensureGreen(); client().prepareIndex("test", "type1", "blakely").setSource(jsonBuilder().startObject() @@ -154,7 +154,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { // used the bottom-level optimization in SpatialPrefixTree#recursiveGetNodes. SearchResponse searchResponse = client().prepareSearch("test").setTypes("type1") .setQuery(geoIntersectionQuery("location", query)) - .execute().actionGet(); + .get(); assertSearchResponse(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); @@ -169,7 +169,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { .field("tree", "quadtree") .endObject().endObject() .endObject().endObject()); - client().admin().indices().prepareCreate("test").addMapping("type1", mapping, XContentType.JSON).execute().actionGet(); + client().admin().indices().prepareCreate("test").addMapping("type1", mapping, XContentType.JSON).get(); createIndex("shapes"); ensureGreen(); @@ -187,7 +187,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { SearchResponse searchResponse = client().prepareSearch("test").setTypes("type1") .setQuery(geoIntersectionQuery("location", "Big_Rectangle", "shape_type")) - .execute().actionGet(); + .get(); assertSearchResponse(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); @@ -196,7 +196,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { searchResponse = client().prepareSearch("test") .setQuery(geoShapeQuery("location", "Big_Rectangle", "shape_type")) - .execute().actionGet(); + .get(); assertSearchResponse(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); @@ -230,7 +230,8 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { public void testReusableBuilder() throws IOException { PolygonBuilder polygon = new PolygonBuilder(new CoordinatesBuilder() .coordinate(170, -10).coordinate(190, -10).coordinate(190, 10).coordinate(170, 10).close()) - .hole(new LineStringBuilder(new CoordinatesBuilder().coordinate(175, -5).coordinate(185, -5).coordinate(185, 5).coordinate(175, 5).close())); + .hole(new LineStringBuilder(new CoordinatesBuilder().coordinate(175, -5).coordinate(185, -5).coordinate(185, 5) + .coordinate(175, 5).close())); assertUnmodified(polygon); LineStringBuilder linestring = new LineStringBuilder(new CoordinatesBuilder() @@ -247,7 +248,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { public void testShapeFetchingPath() throws Exception { createIndex("shapes"); - client().admin().indices().prepareCreate("test").addMapping("type", "location", "type=geo_shape").execute().actionGet(); + client().admin().indices().prepareCreate("test").addMapping("type", "location", "type=geo_shape").get(); String location = "\"location\" : {\"type\":\"polygon\", \"coordinates\":[[[-10,-10],[10,-10],[10,10],[-10,10],[-10,-10]]]}"; @@ -332,7 +333,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { logger.info("Created Random GeometryCollection containing {} shapes", gcb.numShapes()); client().admin().indices().prepareCreate("test").addMapping("type", "location", "type=geo_shape,tree=quadtree") - .execute().actionGet(); + .get(); XContentBuilder docSource = gcb.toXContent(jsonBuilder().startObject().field("location"), null).endObject(); client().prepareIndex("test", "type", "1").setSource(docSource).setRefreshPolicy(IMMEDIATE).get(); @@ -353,13 +354,14 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { GeometryCollectionBuilder gcb = createGeometryCollectionWithin(random(), mbr); client().admin().indices().prepareCreate("test").addMapping("type", "location", "type=geo_shape,tree=quadtree" ) - .execute().actionGet(); + .get(); XContentBuilder docSource = gcb.toXContent(jsonBuilder().startObject().field("location"), null).endObject(); client().prepareIndex("test", "type", "1").setSource(docSource).setRefreshPolicy(IMMEDIATE).get(); // index the mbr of the collection - EnvelopeBuilder env = new EnvelopeBuilder(new Coordinate(mbr.getMinX(), mbr.getMaxY()), new Coordinate(mbr.getMaxX(), mbr.getMinY())); + EnvelopeBuilder env = new EnvelopeBuilder(new Coordinate(mbr.getMinX(), mbr.getMaxY()), + new Coordinate(mbr.getMaxX(), mbr.getMinY())); docSource = env.toXContent(jsonBuilder().startObject().field("location"), null).endObject(); client().prepareIndex("test", "type", "2").setSource(docSource).setRefreshPolicy(IMMEDIATE).get(); @@ -376,7 +378,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { public void testShapeFilterWithDefinedGeoCollection() throws Exception { createIndex("shapes"); client().admin().indices().prepareCreate("test").addMapping("type", "location", "type=geo_shape,tree=quadtree") - .execute().actionGet(); + .get(); XContentBuilder docSource = jsonBuilder().startObject().startObject("location") .field("type", "geometrycollection") @@ -407,7 +409,8 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { "location", new GeometryCollectionBuilder() .polygon( - new PolygonBuilder(new CoordinatesBuilder().coordinate(99.0, -1.0).coordinate(99.0, 3.0).coordinate(103.0, 3.0).coordinate(103.0, -1.0) + new PolygonBuilder(new CoordinatesBuilder().coordinate(99.0, -1.0).coordinate(99.0, 3.0) + .coordinate(103.0, 3.0).coordinate(103.0, -1.0) .coordinate(99.0, -1.0)))).relation(ShapeRelation.INTERSECTS); SearchResponse result = client().prepareSearch("test").setTypes("type").setQuery(QueryBuilders.matchAllQuery()) .setPostFilter(filter).get(); @@ -416,16 +419,19 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { filter = QueryBuilders.geoShapeQuery( "location", new GeometryCollectionBuilder().polygon( - new PolygonBuilder(new CoordinatesBuilder().coordinate(199.0, -11.0).coordinate(199.0, 13.0).coordinate(193.0, 13.0).coordinate(193.0, -11.0) + new PolygonBuilder(new CoordinatesBuilder().coordinate(199.0, -11.0).coordinate(199.0, 13.0) + .coordinate(193.0, 13.0).coordinate(193.0, -11.0) .coordinate(199.0, -11.0)))).relation(ShapeRelation.INTERSECTS); result = client().prepareSearch("test").setTypes("type").setQuery(QueryBuilders.matchAllQuery()) .setPostFilter(filter).get(); assertSearchResponse(result); assertHitCount(result, 0); filter = QueryBuilders.geoShapeQuery("location", new GeometryCollectionBuilder() - .polygon(new PolygonBuilder(new CoordinatesBuilder().coordinate(99.0, -1.0).coordinate(99.0, 3.0).coordinate(103.0, 3.0).coordinate(103.0, -1.0).coordinate(99.0, -1.0))) + .polygon(new PolygonBuilder(new CoordinatesBuilder().coordinate(99.0, -1.0).coordinate(99.0, 3.0).coordinate(103.0, 3.0) + .coordinate(103.0, -1.0).coordinate(99.0, -1.0))) .polygon( - new PolygonBuilder(new CoordinatesBuilder().coordinate(199.0, -11.0).coordinate(199.0, 13.0).coordinate(193.0, 13.0).coordinate(193.0, -11.0) + new PolygonBuilder(new CoordinatesBuilder().coordinate(199.0, -11.0).coordinate(199.0, 13.0) + .coordinate(193.0, 13.0).coordinate(193.0, -11.0) .coordinate(199.0, -11.0)))).relation(ShapeRelation.INTERSECTS); result = client().prepareSearch("test").setTypes("type").setQuery(QueryBuilders.matchAllQuery()) .setPostFilter(filter).get(); @@ -450,7 +456,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { .endObject().endObject() .endObject().endObject()); - client().admin().indices().prepareCreate("geo_points_only").addMapping("type1", mapping, XContentType.JSON).execute().actionGet(); + client().admin().indices().prepareCreate("geo_points_only").addMapping("type1", mapping, XContentType.JSON).get(); ensureGreen(); ShapeBuilder shape = RandomShapeGenerator.createShape(random()); @@ -467,7 +473,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { // test that point was inserted SearchResponse response = client().prepareSearch("geo_points_only").setTypes("type1") .setQuery(geoIntersectionQuery("location", shape)) - .execute().actionGet(); + .get(); assertEquals(1, response.getHits().getTotalHits().value); } @@ -483,7 +489,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { .endObject().endObject() .endObject().endObject()); - client().admin().indices().prepareCreate("geo_points_only").addMapping("type1", mapping, XContentType.JSON).execute().actionGet(); + client().admin().indices().prepareCreate("geo_points_only").addMapping("type1", mapping, XContentType.JSON).get(); ensureGreen(); // MULTIPOINT @@ -501,7 +507,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { // test that point was inserted SearchResponse response = client().prepareSearch("geo_points_only").setTypes("type1") .setQuery(matchAllQuery()) - .execute().actionGet(); + .get(); assertEquals(2, response.getHits().getTotalHits().value); } @@ -531,7 +537,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { SearchResponse response = client().prepareSearch("test") .setQuery(geoShapeQuery("alias", shape)) - .execute().actionGet(); + .get(); assertEquals(1, response.getHits().getTotalHits().value); } @@ -598,7 +604,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase { SearchResponse response = client().prepareSearch("test") .setQuery(querySupplier.get()) - .execute().actionGet(); + .get(); assertEquals(2, response.getHits().getTotalHits().value); assertNotEquals("1", response.getHits().getAt(0).getId()); assertNotEquals("1", response.getHits().getAt(1).getId()); diff --git a/server/src/test/java/org/elasticsearch/search/morelikethis/MoreLikeThisIT.java b/server/src/test/java/org/elasticsearch/search/morelikethis/MoreLikeThisIT.java index 280b1304218..b8430db346e 100644 --- a/server/src/test/java/org/elasticsearch/search/morelikethis/MoreLikeThisIT.java +++ b/server/src/test/java/org/elasticsearch/search/morelikethis/MoreLikeThisIT.java @@ -82,8 +82,10 @@ public class MoreLikeThisIT extends ESIntegTestCase { assertThat(ensureGreen(), equalTo(ClusterHealthStatus.GREEN)); logger.info("Indexing..."); - client().index(indexRequest("test").type("type1").id("1").source(jsonBuilder().startObject().field("text", "lucene").endObject())).actionGet(); - client().index(indexRequest("test").type("type1").id("2").source(jsonBuilder().startObject().field("text", "lucene release").endObject())).actionGet(); + client().index(indexRequest("test").type("type1").id("1").source(jsonBuilder().startObject().field("text", "lucene").endObject())) + .actionGet(); + client().index(indexRequest("test").type("type1").id("2") + .source(jsonBuilder().startObject().field("text", "lucene release").endObject())).actionGet(); client().admin().indices().refresh(refreshRequest()).actionGet(); logger.info("Running moreLikeThis"); @@ -130,9 +132,12 @@ public class MoreLikeThisIT extends ESIntegTestCase { assertThat(ensureGreen(), equalTo(ClusterHealthStatus.GREEN)); logger.info("Indexing..."); - client().index(indexRequest("test").type("type1").id("1").source(jsonBuilder().startObject().field("some_long", 1367484649580L).endObject())).actionGet(); - client().index(indexRequest("test").type("type1").id("2").source(jsonBuilder().startObject().field("some_long", 0).endObject())).actionGet(); - client().index(indexRequest("test").type("type1").id("3").source(jsonBuilder().startObject().field("some_long", -666).endObject())).actionGet(); + client().index(indexRequest("test").type("type1").id("1") + .source(jsonBuilder().startObject().field("some_long", 1367484649580L).endObject())).actionGet(); + client().index(indexRequest("test").type("type1").id("2") + .source(jsonBuilder().startObject().field("some_long", 0).endObject())).actionGet(); + client().index(indexRequest("test").type("type1").id("3") + .source(jsonBuilder().startObject().field("some_long", -666).endObject())).actionGet(); client().admin().indices().refresh(refreshRequest()).actionGet(); @@ -157,10 +162,14 @@ public class MoreLikeThisIT extends ESIntegTestCase { assertThat(ensureGreen(), equalTo(ClusterHealthStatus.GREEN)); logger.info("Indexing..."); - client().index(indexRequest("test").type("type1").id("1").source(jsonBuilder().startObject().field("text", "lucene beta").endObject())).actionGet(); - client().index(indexRequest("test").type("type1").id("2").source(jsonBuilder().startObject().field("text", "lucene release").endObject())).actionGet(); - client().index(indexRequest("test").type("type1").id("3").source(jsonBuilder().startObject().field("text", "elasticsearch beta").endObject())).actionGet(); - client().index(indexRequest("test").type("type1").id("4").source(jsonBuilder().startObject().field("text", "elasticsearch release").endObject())).actionGet(); + client().index(indexRequest("test").type("type1").id("1") + .source(jsonBuilder().startObject().field("text", "lucene beta").endObject())).actionGet(); + client().index(indexRequest("test").type("type1").id("2") + .source(jsonBuilder().startObject().field("text", "lucene release").endObject())).actionGet(); + client().index(indexRequest("test").type("type1").id("3") + .source(jsonBuilder().startObject().field("text", "elasticsearch beta").endObject())).actionGet(); + client().index(indexRequest("test").type("type1").id("4") + .source(jsonBuilder().startObject().field("text", "elasticsearch release").endObject())).actionGet(); client().admin().indices().refresh(refreshRequest()).actionGet(); logger.info("Running moreLikeThis on index"); @@ -202,9 +211,12 @@ public class MoreLikeThisIT extends ESIntegTestCase { assertThat(ensureGreen(), equalTo(ClusterHealthStatus.GREEN)); - client().index(indexRequest(indexName).type(typeName).id("1").source(jsonBuilder().startObject().field("text", "elasticsearch index").endObject())).actionGet(); - client().index(indexRequest(indexName).type(typeName).id("2").source(jsonBuilder().startObject().field("text", "lucene index").endObject())).actionGet(); - client().index(indexRequest(indexName).type(typeName).id("3").source(jsonBuilder().startObject().field("text", "elasticsearch index").endObject())).actionGet(); + client().index(indexRequest(indexName).type(typeName).id("1") + .source(jsonBuilder().startObject().field("text", "elasticsearch index").endObject())).actionGet(); + client().index(indexRequest(indexName).type(typeName).id("2") + .source(jsonBuilder().startObject().field("text", "lucene index").endObject())).actionGet(); + client().index(indexRequest(indexName).type(typeName).id("3") + .source(jsonBuilder().startObject().field("text", "elasticsearch index").endObject())).actionGet(); refresh(indexName); SearchResponse response = client().prepareSearch().setQuery( @@ -218,11 +230,11 @@ public class MoreLikeThisIT extends ESIntegTestCase { .startObject("properties") .endObject() .endObject().endObject()); - client().admin().indices().prepareCreate("foo").addMapping("bar", mapping, XContentType.JSON).execute().actionGet(); + client().admin().indices().prepareCreate("foo").addMapping("bar", mapping, XContentType.JSON).get(); client().prepareIndex("foo", "bar", "1") .setSource(jsonBuilder().startObject().startObject("foo").field("bar", "boz").endObject().endObject()) - .execute().actionGet(); - client().admin().indices().prepareRefresh("foo").execute().actionGet(); + .get(); + client().admin().indices().prepareRefresh("foo").get(); assertThat(ensureGreen(), equalTo(ClusterHealthStatus.GREEN)); SearchResponse response = client().prepareSearch().setQuery( @@ -241,14 +253,14 @@ public class MoreLikeThisIT extends ESIntegTestCase { .startObject("properties") .endObject() .endObject().endObject()); - client().admin().indices().prepareCreate("foo").addMapping("bar", mapping, XContentType.JSON).execute().actionGet(); + client().admin().indices().prepareCreate("foo").addMapping("bar", mapping, XContentType.JSON).get(); ensureGreen(); client().prepareIndex("foo", "bar", "1") .setSource(jsonBuilder().startObject().startObject("foo").field("bar", "boz").endObject().endObject()) .setRouting("2") - .execute().actionGet(); - client().admin().indices().prepareRefresh("foo").execute().actionGet(); + .get(); + client().admin().indices().prepareRefresh("foo").get(); SearchResponse response = client().prepareSearch().setQuery( new MoreLikeThisQueryBuilder(null, new Item[] {new Item("foo", "bar", "1").routing("2")})).get(); @@ -270,8 +282,8 @@ public class MoreLikeThisIT extends ESIntegTestCase { client().prepareIndex("foo", "bar", "1") .setSource(jsonBuilder().startObject().startObject("foo").field("bar", "boz").endObject().endObject()) .setRouting("4000") - .execute().actionGet(); - client().admin().indices().prepareRefresh("foo").execute().actionGet(); + .get(); + client().admin().indices().prepareRefresh("foo").get(); SearchResponse response = client().prepareSearch().setQuery( new MoreLikeThisQueryBuilder(null, new Item[] {new Item("foo", "bar", "1").routing("4000")})).get(); assertNoFailures(response); @@ -287,14 +299,14 @@ public class MoreLikeThisIT extends ESIntegTestCase { .startObject("int_value").field("type", randomFrom(numericTypes)).endObject() .startObject("string_value").field("type", "text").endObject() .endObject() - .endObject().endObject()).execute().actionGet(); + .endObject().endObject()).get(); ensureGreen(); client().prepareIndex("test", "type", "1") .setSource(jsonBuilder().startObject().field("string_value", "lucene index").field("int_value", 1).endObject()) - .execute().actionGet(); + .get(); client().prepareIndex("test", "type", "2") .setSource(jsonBuilder().startObject().field("string_value", "elasticsearch index").field("int_value", 42).endObject()) - .execute().actionGet(); + .get(); refresh(); @@ -305,36 +317,51 @@ public class MoreLikeThisIT extends ESIntegTestCase { // Explicit list of fields including numeric fields -> fail assertThrows(client().prepareSearch().setQuery( - new MoreLikeThisQueryBuilder(new String[] {"string_value", "int_value"}, null, new Item[] {new Item("test", "type", "1")}).minTermFreq(1).minDocFreq(1)), SearchPhaseExecutionException.class); + new MoreLikeThisQueryBuilder(new String[] {"string_value", "int_value"}, null, + new Item[] {new Item("test", "type", "1")}).minTermFreq(1).minDocFreq(1)), SearchPhaseExecutionException.class); // mlt query with no field -> No results (because _all is not enabled) - searchResponse = client().prepareSearch().setQuery(moreLikeThisQuery(new String[] {"index"}).minTermFreq(1).minDocFreq(1)).execute().actionGet(); + searchResponse = client().prepareSearch().setQuery(moreLikeThisQuery(new String[] {"index"}).minTermFreq(1).minDocFreq(1)) + .get(); assertHitCount(searchResponse, 0L); // mlt query with string fields - searchResponse = client().prepareSearch().setQuery(moreLikeThisQuery(new String[]{"string_value"}, new String[] {"index"}, null).minTermFreq(1).minDocFreq(1)).execute().actionGet(); + searchResponse = client().prepareSearch().setQuery(moreLikeThisQuery(new String[]{"string_value"}, new String[] {"index"}, null) + .minTermFreq(1).minDocFreq(1)).get(); assertHitCount(searchResponse, 2L); // mlt query with at least a numeric field -> fail by default - assertThrows(client().prepareSearch().setQuery(moreLikeThisQuery(new String[] {"string_value", "int_value"}, new String[] {"index"}, null)), SearchPhaseExecutionException.class); + assertThrows(client().prepareSearch().setQuery( + moreLikeThisQuery(new String[] {"string_value", "int_value"}, new String[] {"index"}, null)), + SearchPhaseExecutionException.class); // mlt query with at least a numeric field -> fail by command - assertThrows(client().prepareSearch().setQuery(moreLikeThisQuery(new String[] {"string_value", "int_value"}, new String[] {"index"}, null).failOnUnsupportedField(true)), SearchPhaseExecutionException.class); + assertThrows(client().prepareSearch().setQuery( + moreLikeThisQuery(new String[] {"string_value", "int_value"}, new String[] {"index"}, null).failOnUnsupportedField(true)), + SearchPhaseExecutionException.class); // mlt query with at least a numeric field but fail_on_unsupported_field set to false - searchResponse = client().prepareSearch().setQuery(moreLikeThisQuery(new String[] {"string_value", "int_value"}, new String[] {"index"}, null).minTermFreq(1).minDocFreq(1).failOnUnsupportedField(false)).get(); + searchResponse = client().prepareSearch().setQuery( + moreLikeThisQuery(new String[] {"string_value", "int_value"}, new String[] {"index"}, null).minTermFreq(1).minDocFreq(1) + .failOnUnsupportedField(false)).get(); assertHitCount(searchResponse, 2L); // mlt field query on a numeric field -> failure by default - assertThrows(client().prepareSearch().setQuery(moreLikeThisQuery(new String[] {"int_value"}, new String[] {"42"}, null).minTermFreq(1).minDocFreq(1)), SearchPhaseExecutionException.class); + assertThrows(client().prepareSearch().setQuery( + moreLikeThisQuery(new String[] {"int_value"}, new String[] {"42"}, null).minTermFreq(1).minDocFreq(1)), + SearchPhaseExecutionException.class); // mlt field query on a numeric field -> failure by command - assertThrows(client().prepareSearch().setQuery(moreLikeThisQuery(new String[] {"int_value"}, new String[] {"42"}, null).minTermFreq(1).minDocFreq(1).failOnUnsupportedField(true)), + assertThrows(client().prepareSearch().setQuery( + moreLikeThisQuery(new String[] {"int_value"}, new String[] {"42"}, null).minTermFreq(1).minDocFreq(1) + .failOnUnsupportedField(true)), SearchPhaseExecutionException.class); // mlt field query on a numeric field but fail_on_unsupported_field set to false - searchResponse = client().prepareSearch().setQuery(moreLikeThisQuery(new String[] {"int_value"}, new String[] {"42"}, null).minTermFreq(1).minDocFreq(1).failOnUnsupportedField(false)).execute().actionGet(); + searchResponse = client().prepareSearch().setQuery( + moreLikeThisQuery(new String[] {"int_value"}, new String[] {"42"}, null).minTermFreq(1).minDocFreq(1) + .failOnUnsupportedField(false)).get(); assertHitCount(searchResponse, 0L); } @@ -391,16 +418,19 @@ public class MoreLikeThisIT extends ESIntegTestCase { logger.info("Running More Like This with include true"); SearchResponse response = client().prepareSearch().setQuery( - new MoreLikeThisQueryBuilder(null, new Item[] {new Item("test", "type1", "1")}).minTermFreq(1).minDocFreq(1).include(true).minimumShouldMatch("0%")).get(); + new MoreLikeThisQueryBuilder(null, new Item[] {new Item("test", "type1", "1")}).minTermFreq(1).minDocFreq(1).include(true) + .minimumShouldMatch("0%")).get(); assertOrderedSearchHits(response, "1", "2"); response = client().prepareSearch().setQuery( - new MoreLikeThisQueryBuilder(null, new Item[] {new Item("test", "type1", "2")}).minTermFreq(1).minDocFreq(1).include(true).minimumShouldMatch("0%")).get(); + new MoreLikeThisQueryBuilder(null, new Item[] {new Item("test", "type1", "2")}).minTermFreq(1).minDocFreq(1).include(true) + .minimumShouldMatch("0%")).get(); assertOrderedSearchHits(response, "2", "1"); logger.info("Running More Like This with include false"); response = client().prepareSearch().setQuery( - new MoreLikeThisQueryBuilder(null, new Item[] {new Item("test", "type1", "1")}).minTermFreq(1).minDocFreq(1).minimumShouldMatch("0%")).get(); + new MoreLikeThisQueryBuilder(null, new Item[] {new Item("test", "type1", "1")}).minTermFreq(1).minDocFreq(1) + .minimumShouldMatch("0%")).get(); assertSearchHits(response, "2"); } @@ -422,8 +452,9 @@ public class MoreLikeThisIT extends ESIntegTestCase { indexRandom(true, builders); logger.info("Running MoreLikeThis"); - MoreLikeThisQueryBuilder queryBuilder = QueryBuilders.moreLikeThisQuery(new String[] {"text"}, null, ids("1")).include(true).minTermFreq(1).minDocFreq(1); - SearchResponse mltResponse = client().prepareSearch().setTypes("type1").setQuery(queryBuilder).execute().actionGet(); + MoreLikeThisQueryBuilder queryBuilder = QueryBuilders.moreLikeThisQuery(new String[] {"text"}, null, ids("1")).include(true) + .minTermFreq(1).minDocFreq(1); + SearchResponse mltResponse = client().prepareSearch().setTypes("type1").setQuery(queryBuilder).get(); assertHitCount(mltResponse, 3L); } @@ -453,7 +484,7 @@ public class MoreLikeThisIT extends ESIntegTestCase { .minTermFreq(1).minDocFreq(1) .maxQueryTerms(max_query_terms).minimumShouldMatch("0%"); SearchResponse response = client().prepareSearch("test").setTypes("type1") - .setQuery(mltQuery).execute().actionGet(); + .setQuery(mltQuery).get(); assertSearchResponse(response); assertHitCount(response, max_query_terms); } @@ -511,7 +542,8 @@ public class MoreLikeThisIT extends ESIntegTestCase { indexRandom(true, client().prepareIndex("test", "type1", "0").setSource(doc)); logger.info("Checking the document matches ..."); - MoreLikeThisQueryBuilder mltQuery = moreLikeThisQuery(new Item[] {new Item("test", "type1", doc).routing("0")}) // routing to ensure we hit the shard with the doc + // routing to ensure we hit the shard with the doc + MoreLikeThisQueryBuilder mltQuery = moreLikeThisQuery(new Item[] {new Item("test", "type1", doc).routing("0")}) .minTermFreq(0) .minDocFreq(0) .maxQueryTerms(100) diff --git a/server/src/test/java/org/elasticsearch/search/msearch/MultiSearchIT.java b/server/src/test/java/org/elasticsearch/search/msearch/MultiSearchIT.java index c7e78f2cc28..7a1a1ca48d8 100644 --- a/server/src/test/java/org/elasticsearch/search/msearch/MultiSearchIT.java +++ b/server/src/test/java/org/elasticsearch/search/msearch/MultiSearchIT.java @@ -36,14 +36,14 @@ public class MultiSearchIT extends ESIntegTestCase { public void testSimpleMultiSearch() { createIndex("test"); ensureGreen(); - client().prepareIndex("test", "type", "1").setSource("field", "xxx").execute().actionGet(); - client().prepareIndex("test", "type", "2").setSource("field", "yyy").execute().actionGet(); + client().prepareIndex("test", "type", "1").setSource("field", "xxx").get(); + client().prepareIndex("test", "type", "2").setSource("field", "yyy").get(); refresh(); MultiSearchResponse response = client().prepareMultiSearch() .add(client().prepareSearch("test").setQuery(QueryBuilders.termQuery("field", "xxx"))) .add(client().prepareSearch("test").setQuery(QueryBuilders.termQuery("field", "yyy"))) .add(client().prepareSearch("test").setQuery(QueryBuilders.matchAllQuery())) - .execute().actionGet(); + .get(); for (MultiSearchResponse.Item item : response) { assertNoFailures(item.getResponse()); diff --git a/server/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java b/server/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java index 7829bcf0c80..5feb341fd69 100644 --- a/server/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java +++ b/server/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java @@ -63,9 +63,9 @@ public class SimpleNestedIT extends ESIntegTestCase { ensureGreen(); // check on no data, see it works - SearchResponse searchResponse = client().prepareSearch("test").execute().actionGet(); + SearchResponse searchResponse = client().prepareSearch("test").get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); - searchResponse = client().prepareSearch("test").setQuery(termQuery("n_field1", "n_value1_1")).execute().actionGet(); + searchResponse = client().prepareSearch("test").setQuery(termQuery("n_field1", "n_value1_1")).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); client().prepareIndex("test", "type1", "1").setSource(jsonBuilder().startObject() @@ -80,7 +80,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .field("n_field2", "n_value2_2") .endObject() .endArray() - .endObject()).execute().actionGet(); + .endObject()).get(); waitForRelocation(ClusterHealthStatus.GREEN); GetResponse getResponse = client().prepareGet("test", "type1", "1").get(); @@ -90,7 +90,7 @@ public class SimpleNestedIT extends ESIntegTestCase { // check the numDocs assertDocumentCount("test", 3); - searchResponse = client().prepareSearch("test").setQuery(termQuery("n_field1", "n_value1_1")).execute().actionGet(); + searchResponse = client().prepareSearch("test").setQuery(termQuery("n_field1", "n_value1_1")).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); // search for something that matches the nested doc, and see that we don't find the nested doc @@ -100,11 +100,14 @@ public class SimpleNestedIT extends ESIntegTestCase { assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); // now, do a nested query - searchResponse = client().prepareSearch("test").setQuery(nestedQuery("nested1", termQuery("nested1.n_field1", "n_value1_1"), ScoreMode.Avg)).get(); + searchResponse = client().prepareSearch("test").setQuery( + nestedQuery("nested1", termQuery("nested1.n_field1", "n_value1_1"), ScoreMode.Avg)).get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); - searchResponse = client().prepareSearch("test").setQuery(nestedQuery("nested1", termQuery("nested1.n_field1", "n_value1_1"), ScoreMode.Avg)).setSearchType(SearchType.DFS_QUERY_THEN_FETCH).get(); + searchResponse = client().prepareSearch("test").setQuery( + nestedQuery("nested1", termQuery("nested1.n_field1", "n_value1_1"), ScoreMode.Avg)) + .setSearchType(SearchType.DFS_QUERY_THEN_FETCH).get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); @@ -122,36 +125,40 @@ public class SimpleNestedIT extends ESIntegTestCase { .field("n_field2", "n_value2_1") .endObject() .endArray() - .endObject()).execute().actionGet(); + .endObject()).get(); waitForRelocation(ClusterHealthStatus.GREEN); refresh(); assertDocumentCount("test", 6); searchResponse = client().prepareSearch("test").setQuery(nestedQuery("nested1", - boolQuery().must(termQuery("nested1.n_field1", "n_value1_1")).must(termQuery("nested1.n_field2", "n_value2_1")), ScoreMode.Avg)).execute().actionGet(); + boolQuery().must(termQuery("nested1.n_field1", "n_value1_1")) + .must(termQuery("nested1.n_field2", "n_value2_1")), ScoreMode.Avg)).get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); // filter searchResponse = client().prepareSearch("test").setQuery(boolQuery().must(matchAllQuery()).mustNot(nestedQuery("nested1", - boolQuery().must(termQuery("nested1.n_field1", "n_value1_1")).must(termQuery("nested1.n_field2", "n_value2_1")), ScoreMode.Avg))).execute().actionGet(); + boolQuery().must(termQuery("nested1.n_field1", "n_value1_1")).must(termQuery("nested1.n_field2", "n_value2_1")), + ScoreMode.Avg))).get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); // check with type prefix searchResponse = client().prepareSearch("test").setQuery(nestedQuery("nested1", - boolQuery().must(termQuery("nested1.n_field1", "n_value1_1")).must(termQuery("nested1.n_field2", "n_value2_1")), ScoreMode.Avg)).execute().actionGet(); + boolQuery().must(termQuery("nested1.n_field1", "n_value1_1")).must(termQuery("nested1.n_field2", "n_value2_1")), + ScoreMode.Avg)).get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); // check delete, so all is gone... - DeleteResponse deleteResponse = client().prepareDelete("test", "type1", "2").execute().actionGet(); + DeleteResponse deleteResponse = client().prepareDelete("test", "type1", "2").get(); assertEquals(DocWriteResponse.Result.DELETED, deleteResponse.getResult()); refresh(); assertDocumentCount("test", 3); - searchResponse = client().prepareSearch("test").setQuery(nestedQuery("nested1", termQuery("nested1.n_field1", "n_value1_1"), ScoreMode.Avg)).execute().actionGet(); + searchResponse = client().prepareSearch("test").setQuery(nestedQuery("nested1", termQuery("nested1.n_field1", "n_value1_1"), + ScoreMode.Avg)).get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); } @@ -170,12 +177,14 @@ public class SimpleNestedIT extends ESIntegTestCase { .startObject() .field("field", "value") .startArray("nested1") - .startObject().field("field1", "1").startArray("nested2").startObject().field("field2", "2").endObject().startObject().field("field2", "3").endObject().endArray().endObject() - .startObject().field("field1", "4").startArray("nested2").startObject().field("field2", "5").endObject().startObject().field("field2", "6").endObject().endArray().endObject() + .startObject().field("field1", "1").startArray("nested2").startObject().field("field2", "2").endObject() + .startObject().field("field2", "3").endObject().endArray().endObject() + .startObject().field("field1", "4").startArray("nested2").startObject().field("field2", "5").endObject() + .startObject().field("field2", "6").endObject().endArray().endObject() .endArray() - .endObject()).execute().actionGet(); + .endObject()).get(); - GetResponse getResponse = client().prepareGet("test", "type1", "1").execute().actionGet(); + GetResponse getResponse = client().prepareGet("test", "type1", "1").get(); assertThat(getResponse.isExists(), equalTo(true)); waitForRelocation(ClusterHealthStatus.GREEN); refresh(); @@ -184,47 +193,54 @@ public class SimpleNestedIT extends ESIntegTestCase { // do some multi nested queries SearchResponse searchResponse = client().prepareSearch("test").setQuery(nestedQuery("nested1", - termQuery("nested1.field1", "1"), ScoreMode.Avg)).execute().actionGet(); + termQuery("nested1.field1", "1"), ScoreMode.Avg)).get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); searchResponse = client().prepareSearch("test").setQuery(nestedQuery("nested1.nested2", - termQuery("nested1.nested2.field2", "2"), ScoreMode.Avg)).execute().actionGet(); + termQuery("nested1.nested2.field2", "2"), ScoreMode.Avg)).get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); searchResponse = client().prepareSearch("test").setQuery(nestedQuery("nested1", - boolQuery().must(termQuery("nested1.field1", "1")).must(nestedQuery("nested1.nested2", termQuery("nested1.nested2.field2", "2"), ScoreMode.Avg)), ScoreMode.Avg)).execute().actionGet(); + boolQuery().must(termQuery("nested1.field1", "1")).must(nestedQuery("nested1.nested2", + termQuery("nested1.nested2.field2", "2"), ScoreMode.Avg)), ScoreMode.Avg)).get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); searchResponse = client().prepareSearch("test").setQuery(nestedQuery("nested1", - boolQuery().must(termQuery("nested1.field1", "1")).must(nestedQuery("nested1.nested2", termQuery("nested1.nested2.field2", "3"), ScoreMode.Avg)), ScoreMode.Avg)).execute().actionGet(); + boolQuery().must(termQuery("nested1.field1", "1")).must(nestedQuery("nested1.nested2", + termQuery("nested1.nested2.field2", "3"), ScoreMode.Avg)), ScoreMode.Avg)).get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); searchResponse = client().prepareSearch("test").setQuery(nestedQuery("nested1", - boolQuery().must(termQuery("nested1.field1", "1")).must(nestedQuery("nested1.nested2", termQuery("nested1.nested2.field2", "4"), ScoreMode.Avg)), ScoreMode.Avg)).execute().actionGet(); + boolQuery().must(termQuery("nested1.field1", "1")).must(nestedQuery("nested1.nested2", + termQuery("nested1.nested2.field2", "4"), ScoreMode.Avg)), ScoreMode.Avg)).get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); searchResponse = client().prepareSearch("test").setQuery(nestedQuery("nested1", - boolQuery().must(termQuery("nested1.field1", "1")).must(nestedQuery("nested1.nested2", termQuery("nested1.nested2.field2", "5"), ScoreMode.Avg)), ScoreMode.Avg)).execute().actionGet(); + boolQuery().must(termQuery("nested1.field1", "1")).must(nestedQuery("nested1.nested2", + termQuery("nested1.nested2.field2", "5"), ScoreMode.Avg)), ScoreMode.Avg)).get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); searchResponse = client().prepareSearch("test").setQuery(nestedQuery("nested1", - boolQuery().must(termQuery("nested1.field1", "4")).must(nestedQuery("nested1.nested2", termQuery("nested1.nested2.field2", "5"), ScoreMode.Avg)), ScoreMode.Avg)).execute().actionGet(); + boolQuery().must(termQuery("nested1.field1", "4")).must(nestedQuery("nested1.nested2", + termQuery("nested1.nested2.field2", "5"), ScoreMode.Avg)), ScoreMode.Avg)).get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); searchResponse = client().prepareSearch("test").setQuery(nestedQuery("nested1", - boolQuery().must(termQuery("nested1.field1", "4")).must(nestedQuery("nested1.nested2", termQuery("nested1.nested2.field2", "2"), ScoreMode.Avg)), ScoreMode.Avg)).execute().actionGet(); + boolQuery().must(termQuery("nested1.field1", "4")).must(nestedQuery("nested1.nested2", + termQuery("nested1.nested2.field2", "2"), ScoreMode.Avg)), ScoreMode.Avg)).get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L)); } - // When IncludeNestedDocsQuery is wrapped in a FilteredQuery then a in-finite loop occurs b/c of a bug in IncludeNestedDocsQuery#advance() + // When IncludeNestedDocsQuery is wrapped in a FilteredQuery then a in-finite loop occurs b/c of a bug in + // IncludeNestedDocsQuery#advance() // This IncludeNestedDocsQuery also needs to be aware of the filter from alias public void testDeleteNestedDocsWithAlias() throws Exception { assertAcked(prepareCreate("test") @@ -239,7 +255,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .endObject().endObject().endObject())); client().admin().indices().prepareAliases() - .addAlias("test", "alias1", QueryBuilders.termQuery("field1", "value1")).execute().actionGet(); + .addAlias("test", "alias1", QueryBuilders.termQuery("field1", "value1")).get(); ensureGreen(); @@ -256,7 +272,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .field("n_field2", "n_value2_2") .endObject() .endArray() - .endObject()).execute().actionGet(); + .endObject()).get(); client().prepareIndex("test", "type1", "2").setSource(jsonBuilder().startObject() @@ -271,7 +287,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .field("n_field2", "n_value2_2") .endObject() .endArray() - .endObject()).execute().actionGet(); + .endObject()).get(); flush(); refresh(); @@ -300,12 +316,12 @@ public class SimpleNestedIT extends ESIntegTestCase { .endArray() .endObject()) .setRefreshPolicy(IMMEDIATE) - .execute().actionGet(); + .get(); SearchResponse searchResponse = client().prepareSearch("test") .setQuery(nestedQuery("nested1", termQuery("nested1.n_field1", "n_value1"), ScoreMode.Total)) .setExplain(true) - .execute().actionGet(); + .get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); Explanation explanation = searchResponse.getHits().getHits()[0].getExplanation(); @@ -341,7 +357,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .field("field1", 4) .endObject() .endArray() - .endObject()).execute().actionGet(); + .endObject()).get(); client().prepareIndex("test", "type1", "2").setSource(jsonBuilder().startObject() .field("field1", 2) .startArray("nested1") @@ -352,7 +368,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .field("field1", 2) .endObject() .endArray() - .endObject()).execute().actionGet(); + .endObject()).get(); client().prepareIndex("test", "type1", "3").setSource(jsonBuilder().startObject() .field("field1", 3) .startArray("nested1") @@ -363,14 +379,14 @@ public class SimpleNestedIT extends ESIntegTestCase { .field("field1", 4) .endObject() .endArray() - .endObject()).execute().actionGet(); + .endObject()).get(); refresh(); SearchResponse searchResponse = client().prepareSearch("test") .setTypes("type1") .setQuery(QueryBuilders.matchAllQuery()) .addSort(SortBuilders.fieldSort("nested1.field1").order(SortOrder.ASC).setNestedPath("nested1")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 3); assertThat(searchResponse.getHits().getHits()[0].getId(), equalTo("2")); @@ -384,7 +400,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .setTypes("type1") .setQuery(QueryBuilders.matchAllQuery()) .addSort(SortBuilders.fieldSort("nested1.field1").order(SortOrder.DESC).setNestedPath("nested1")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 3); assertThat(searchResponse.getHits().getHits()[0].getId(), equalTo("1")); @@ -427,7 +443,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .field("field2", true) .endObject() .endArray() - .endObject()).execute().actionGet(); + .endObject()).get(); client().prepareIndex("test", "type1", "2").setSource(jsonBuilder().startObject() .field("field1", 2) .startArray("nested1") @@ -440,7 +456,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .field("field2", true) .endObject() .endArray() - .endObject()).execute().actionGet(); + .endObject()).get(); // Doc with missing nested docs if nested filter is used refresh(); client().prepareIndex("test", "type1", "3").setSource(jsonBuilder().startObject() @@ -455,12 +471,13 @@ public class SimpleNestedIT extends ESIntegTestCase { .field("field2", false) .endObject() .endArray() - .endObject()).execute().actionGet(); + .endObject()).get(); refresh(); SearchRequestBuilder searchRequestBuilder = client().prepareSearch("test").setTypes("type1") .setQuery(QueryBuilders.matchAllQuery()) - .addSort(SortBuilders.fieldSort("nested1.field1").setNestedPath("nested1").setNestedFilter(termQuery("nested1.field2", true)).missing(10).order(SortOrder.ASC)); + .addSort(SortBuilders.fieldSort("nested1.field1").setNestedPath("nested1") + .setNestedFilter(termQuery("nested1.field2", true)).missing(10).order(SortOrder.ASC)); if (randomBoolean()) { searchRequestBuilder.setScroll("10m"); @@ -477,7 +494,8 @@ public class SimpleNestedIT extends ESIntegTestCase { assertThat(searchResponse.getHits().getHits()[2].getSortValues()[0].toString(), equalTo("10")); searchRequestBuilder = client().prepareSearch("test").setTypes("type1").setQuery(QueryBuilders.matchAllQuery()) - .addSort(SortBuilders.fieldSort("nested1.field1").setNestedPath("nested1").setNestedFilter(termQuery("nested1.field2", true)).missing(10).order(SortOrder.DESC)); + .addSort(SortBuilders.fieldSort("nested1.field1").setNestedPath("nested1") + .setNestedFilter(termQuery("nested1.field2", true)).missing(10).order(SortOrder.DESC)); if (randomBoolean()) { searchRequestBuilder.setScroll("10m"); @@ -571,7 +589,7 @@ public class SimpleNestedIT extends ESIntegTestCase { + " ]\n" + " }\n" + " ]\n" - + "}", XContentType.JSON).execute().actionGet(); + + "}", XContentType.JSON).get(); client().prepareIndex("test", "type1", "2").setSource("{\n" + " \"acl\": [\n" @@ -617,7 +635,7 @@ public class SimpleNestedIT extends ESIntegTestCase { + " ]\n" + " }\n" + " ]\n" - + "}", XContentType.JSON).execute().actionGet(); + + "}", XContentType.JSON).get(); refresh(); // access id = 1, read, max value, asc, should use matt and shay @@ -633,7 +651,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .sortMode(SortMode.MAX) .order(SortOrder.ASC) ) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 2); assertThat(searchResponse.getHits().getHits().length, equalTo(2)); @@ -656,7 +674,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .sortMode(SortMode.MIN) .order(SortOrder.ASC) ) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 2); assertThat(searchResponse.getHits().getHits().length, equalTo(2)); @@ -679,7 +697,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .sortMode(SortMode.MIN) .order(SortOrder.DESC) ) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 2); assertThat(searchResponse.getHits().getHits().length, equalTo(2)); @@ -700,7 +718,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .sortMode(SortMode.MIN) .order(SortOrder.DESC) ) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 2); assertThat(searchResponse.getHits().getHits().length, equalTo(2)); @@ -747,7 +765,7 @@ public class SimpleNestedIT extends ESIntegTestCase { + " ]\n" + " }\n" + " ]\n" - + "}", XContentType.JSON).execute().actionGet(); + + "}", XContentType.JSON).get(); client().prepareIndex("test", "test-type", "2").setSource("{\n" + " \"nested1\": [\n" @@ -760,7 +778,7 @@ public class SimpleNestedIT extends ESIntegTestCase { + " ]\n" + " } \n" + " ]\n" - + "}", XContentType.JSON).execute().actionGet(); + + "}", XContentType.JSON).get(); refresh(); @@ -773,7 +791,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .setNestedSort(new NestedSortBuilder("nested1.nested2") .setFilter(termQuery("nested1.nested2.nested2_keyword", "nested2_bar")))) ) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 1); assertThat(searchResponse.getHits().getHits().length, equalTo(1)); @@ -849,7 +867,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .endArray() .endObject() .endArray() - .endObject()).execute().actionGet(); + .endObject()).get(); // sum: 7 client().prepareIndex("test", "type1", "2").setSource(jsonBuilder() @@ -888,7 +906,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .endArray() .endObject() .endArray() - .endObject()).execute().actionGet(); + .endObject()).get(); // sum: 2 client().prepareIndex("test", "type1", "3").setSource(jsonBuilder() @@ -927,7 +945,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .endArray() .endObject() .endArray() - .endObject()).execute().actionGet(); + .endObject()).get(); refresh(); // Without nested filter @@ -938,7 +956,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .setNestedPath("parent.child") .order(SortOrder.ASC) ) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 3); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); assertThat(searchResponse.getHits().getHits()[0].getId(), equalTo("3")); @@ -957,7 +975,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .setNestedFilter(QueryBuilders.termQuery("parent.child.filter", true)) .order(SortOrder.ASC) ) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 3); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); assertThat(searchResponse.getHits().getHits()[0].getId(), equalTo("1")); @@ -976,7 +994,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .setNestedFilter(QueryBuilders.termQuery("parent.child.filter", true)) .order(SortOrder.ASC) ) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 3); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -995,7 +1013,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .setNestedFilter(QueryBuilders.termQuery("parent.filter", false)) .order(SortOrder.ASC) ) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 3); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1017,7 +1035,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .sortMode(SortMode.MAX) .order(SortOrder.ASC) ) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 3); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1037,7 +1055,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .setNestedFilter(QueryBuilders.termQuery("parent.child.filter", true)) .order(SortOrder.ASC) ) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 3); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1057,7 +1075,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .sortMode(SortMode.SUM) .order(SortOrder.ASC) ) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 3); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1077,7 +1095,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .sortMode(SortMode.SUM) .order(SortOrder.DESC) ) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 3); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1098,7 +1116,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .sortMode(SortMode.SUM) .order(SortOrder.ASC) ) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 3); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1118,7 +1136,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .sortMode(SortMode.AVG) .order(SortOrder.ASC) ) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 3); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1137,7 +1155,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .sortMode(SortMode.AVG) .order(SortOrder.DESC) ) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 3); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1158,7 +1176,7 @@ public class SimpleNestedIT extends ESIntegTestCase { .sortMode(SortMode.AVG) .order(SortOrder.ASC) ) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 3); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1294,7 +1312,8 @@ public class SimpleNestedIT extends ESIntegTestCase { .addSort(SortBuilders.fieldSort("users.first") .order(SortOrder.ASC) .setNestedPath("users") - .setNestedFilter(nestedQuery("users.workstations", termQuery("users.workstations.stationid", "s5"), ScoreMode.Avg))) + .setNestedFilter(nestedQuery("users.workstations", termQuery("users.workstations.stationid", "s5"), + ScoreMode.Avg))) .get(); assertNoFailures(searchResponse); assertHitCount(searchResponse, 2); diff --git a/server/src/test/java/org/elasticsearch/search/preference/SearchPreferenceIT.java b/server/src/test/java/org/elasticsearch/search/preference/SearchPreferenceIT.java index a531eaed1e9..366975071ce 100644 --- a/server/src/test/java/org/elasticsearch/search/preference/SearchPreferenceIT.java +++ b/server/src/test/java/org/elasticsearch/search/preference/SearchPreferenceIT.java @@ -58,30 +58,31 @@ public class SearchPreferenceIT extends ESIntegTestCase { // see #2896 public void testStopOneNodePreferenceWithRedState() throws InterruptedException, IOException { - assertAcked(prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", cluster().numDataNodes()+2).put("index.number_of_replicas", 0))); + assertAcked(prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", cluster().numDataNodes()+2) + .put("index.number_of_replicas", 0))); ensureGreen(); for (int i = 0; i < 10; i++) { - client().prepareIndex("test", "type1", ""+i).setSource("field1", "value1").execute().actionGet(); + client().prepareIndex("test", "type1", ""+i).setSource("field1", "value1").get(); } refresh(); internalCluster().stopRandomDataNode(); - client().admin().cluster().prepareHealth().setWaitForStatus(ClusterHealthStatus.RED).execute().actionGet(); + client().admin().cluster().prepareHealth().setWaitForStatus(ClusterHealthStatus.RED).get(); String[] preferences = new String[]{"_local", "_prefer_nodes:somenode", "_prefer_nodes:server2", "_prefer_nodes:somenode,server2"}; for (String pref : preferences) { logger.info("--> Testing out preference={}", pref); - SearchResponse searchResponse = client().prepareSearch().setSize(0).setPreference(pref).execute().actionGet(); + SearchResponse searchResponse = client().prepareSearch().setSize(0).setPreference(pref).get(); assertThat(RestStatus.OK, equalTo(searchResponse.status())); assertThat(pref, searchResponse.getFailedShards(), greaterThanOrEqualTo(0)); - searchResponse = client().prepareSearch().setPreference(pref).execute().actionGet(); + searchResponse = client().prepareSearch().setPreference(pref).get(); assertThat(RestStatus.OK, equalTo(searchResponse.status())); assertThat(pref, searchResponse.getFailedShards(), greaterThanOrEqualTo(0)); } //_only_local is a stricter preference, we need to send the request to a data node - SearchResponse searchResponse = dataNodeClient().prepareSearch().setSize(0).setPreference("_only_local").execute().actionGet(); + SearchResponse searchResponse = dataNodeClient().prepareSearch().setSize(0).setPreference("_only_local").get(); assertThat(RestStatus.OK, equalTo(searchResponse.status())); assertThat("_only_local", searchResponse.getFailedShards(), greaterThanOrEqualTo(0)); - searchResponse = dataNodeClient().prepareSearch().setPreference("_only_local").execute().actionGet(); + searchResponse = dataNodeClient().prepareSearch().setPreference("_only_local").get(); assertThat(RestStatus.OK, equalTo(searchResponse.status())); assertThat("_only_local", searchResponse.getFailedShards(), greaterThanOrEqualTo(0)); } @@ -93,13 +94,13 @@ public class SearchPreferenceIT extends ESIntegTestCase { )); ensureGreen(); - client().prepareIndex("test", "type1").setSource("field1", "value1").execute().actionGet(); + client().prepareIndex("test", "type1").setSource("field1", "value1").get(); refresh(); final Client client = internalCluster().smartClient(); - SearchResponse searchResponse = client.prepareSearch("test").setQuery(matchAllQuery()).execute().actionGet(); + SearchResponse searchResponse = client.prepareSearch("test").setQuery(matchAllQuery()).get(); String firstNodeId = searchResponse.getHits().getAt(0).getShard().getNodeId(); - searchResponse = client.prepareSearch("test").setQuery(matchAllQuery()).execute().actionGet(); + searchResponse = client.prepareSearch("test").setQuery(matchAllQuery()).get(); String secondNodeId = searchResponse.getHits().getAt(0).getShard().getNodeId(); assertThat(firstNodeId, not(equalTo(secondNodeId))); @@ -109,16 +110,16 @@ public class SearchPreferenceIT extends ESIntegTestCase { client().admin().indices().prepareCreate("test").setSettings("{\"number_of_replicas\": 1}", XContentType.JSON).get(); ensureGreen(); - client().prepareIndex("test", "type1").setSource("field1", "value1").execute().actionGet(); + client().prepareIndex("test", "type1").setSource("field1", "value1").get(); refresh(); - SearchResponse searchResponse = client().prepareSearch().setQuery(matchAllQuery()).execute().actionGet(); + SearchResponse searchResponse = client().prepareSearch().setQuery(matchAllQuery()).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setPreference("_local").execute().actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setPreference("_local").get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setPreference("1234").execute().actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setPreference("1234").get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); } @@ -127,7 +128,7 @@ public class SearchPreferenceIT extends ESIntegTestCase { ensureGreen(); try { - client().prepareSearch().setQuery(matchAllQuery()).setPreference("_only_nodes:DOES-NOT-EXIST").execute().actionGet(); + client().prepareSearch().setQuery(matchAllQuery()).setPreference("_only_nodes:DOES-NOT-EXIST").get(); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { assertThat(e, hasToString(containsString("no data nodes with criteria [DOES-NOT-EXIST] found for shard: [test]["))); @@ -139,7 +140,7 @@ public class SearchPreferenceIT extends ESIntegTestCase { //this test needs at least a replica to make sure two consecutive searches go to two different copies of the same data Settings.builder().put(indexSettings()).put(SETTING_NUMBER_OF_REPLICAS, between(1, maximumNumberOfReplicas())))); ensureGreen(); - client().prepareIndex("test", "type1").setSource("field1", "value1").execute().actionGet(); + client().prepareIndex("test", "type1").setSource("field1", "value1").get(); refresh(); final Client client = internalCluster().smartClient(); @@ -154,7 +155,7 @@ public class SearchPreferenceIT extends ESIntegTestCase { ArrayList allNodeIds = new ArrayList<>(); ArrayList allNodeNames = new ArrayList<>(); ArrayList allNodeHosts = new ArrayList<>(); - NodesStatsResponse nodeStats = client().admin().cluster().prepareNodesStats().execute().actionGet(); + NodesStatsResponse nodeStats = client().admin().cluster().prepareNodesStats().get(); for (NodeStats node : nodeStats.getNodes()) { allNodeIds.add(node.getNode().getId()); allNodeNames.add(node.getNode().getName()); @@ -186,7 +187,7 @@ public class SearchPreferenceIT extends ESIntegTestCase { private void assertSearchOnRandomNodes(SearchRequestBuilder request) { Set hitNodes = new HashSet<>(); for (int i = 0; i < 2; i++) { - SearchResponse searchResponse = request.execute().actionGet(); + SearchResponse searchResponse = request.get(); assertThat(searchResponse.getHits().getHits().length, greaterThan(0)); hitNodes.add(searchResponse.getHits().getAt(0).getShard().getNodeId()); } diff --git a/server/src/test/java/org/elasticsearch/search/profile/query/QueryProfilerIT.java b/server/src/test/java/org/elasticsearch/search/profile/query/QueryProfilerIT.java index e3fc1c8e143..14686aff209 100644 --- a/server/src/test/java/org/elasticsearch/search/profile/query/QueryProfilerIT.java +++ b/server/src/test/java/org/elasticsearch/search/profile/query/QueryProfilerIT.java @@ -81,7 +81,7 @@ public class QueryProfilerIT extends ESIntegTestCase { .setQuery(q) .setProfile(true) .setSearchType(SearchType.QUERY_THEN_FETCH) - .execute().actionGet(); + .get(); assertNotNull("Profile response element should not be null", resp.getProfileResults()); assertThat("Profile response should not be an empty array", resp.getProfileResults().size(), not(0)); @@ -147,7 +147,7 @@ public class QueryProfilerIT extends ESIntegTestCase { MultiSearchResponse.Item[] responses = client().prepareMultiSearch() .add(vanilla) .add(profile) - .execute().actionGet().getResponses(); + .get().getResponses(); SearchResponse vanillaResponse = responses[0].getResponse(); SearchResponse profileResponse = responses[1].getResponse(); @@ -214,7 +214,7 @@ public class QueryProfilerIT extends ESIntegTestCase { .setQuery(q) .setProfile(true) .setSearchType(SearchType.QUERY_THEN_FETCH) - .execute().actionGet(); + .get(); Map p = resp.getProfileResults(); assertNotNull(p); @@ -261,7 +261,7 @@ public class QueryProfilerIT extends ESIntegTestCase { .setQuery(q) .setProfile(true) .setSearchType(SearchType.QUERY_THEN_FETCH) - .execute().actionGet(); + .get(); Map p = resp.getProfileResults(); assertNotNull(p); @@ -330,7 +330,7 @@ public class QueryProfilerIT extends ESIntegTestCase { .setQuery(q) .setProfile(true) .setSearchType(SearchType.QUERY_THEN_FETCH) - .execute().actionGet(); + .get(); assertNotNull("Profile response element should not be null", resp.getProfileResults()); assertThat("Profile response should not be an empty array", resp.getProfileResults().size(), not(0)); @@ -382,7 +382,7 @@ public class QueryProfilerIT extends ESIntegTestCase { .setQuery(q) .setProfile(true) .setSearchType(SearchType.QUERY_THEN_FETCH) - .execute().actionGet(); + .get(); assertNotNull("Profile response element should not be null", resp.getProfileResults()); assertThat("Profile response should not be an empty array", resp.getProfileResults().size(), not(0)); @@ -429,7 +429,7 @@ public class QueryProfilerIT extends ESIntegTestCase { .setQuery(q) .setProfile(true) .setSearchType(SearchType.QUERY_THEN_FETCH) - .execute().actionGet(); + .get(); assertNotNull("Profile response element should not be null", resp.getProfileResults()); assertThat("Profile response should not be an empty array", resp.getProfileResults().size(), not(0)); @@ -476,7 +476,7 @@ public class QueryProfilerIT extends ESIntegTestCase { .setQuery(q) .setProfile(true) .setSearchType(SearchType.QUERY_THEN_FETCH) - .execute().actionGet(); + .get(); assertNotNull("Profile response element should not be null", resp.getProfileResults()); assertThat("Profile response should not be an empty array", resp.getProfileResults().size(), not(0)); @@ -522,7 +522,7 @@ public class QueryProfilerIT extends ESIntegTestCase { .setQuery(q) .setProfile(true) .setSearchType(SearchType.QUERY_THEN_FETCH) - .execute().actionGet(); + .get(); assertNotNull("Profile response element should not be null", resp.getProfileResults()); assertThat("Profile response should not be an empty array", resp.getProfileResults().size(), not(0)); @@ -570,7 +570,7 @@ public class QueryProfilerIT extends ESIntegTestCase { .setTypes("type1") .setProfile(true) .setSearchType(SearchType.QUERY_THEN_FETCH) - .execute().actionGet(); + .get(); if (resp.getShardFailures().length > 0) { for (ShardSearchFailure f : resp.getShardFailures()) { @@ -620,7 +620,7 @@ public class QueryProfilerIT extends ESIntegTestCase { logger.info("Query: {}", q); - SearchResponse resp = client().prepareSearch().setQuery(q).setProfile(false).execute().actionGet(); + SearchResponse resp = client().prepareSearch().setQuery(q).setProfile(false).get(); assertThat("Profile response element should be an empty map", resp.getProfileResults().size(), equalTo(0)); } diff --git a/server/src/test/java/org/elasticsearch/search/query/ExistsIT.java b/server/src/test/java/org/elasticsearch/search/query/ExistsIT.java index 6ec9e66ba2a..11406068321 100644 --- a/server/src/test/java/org/elasticsearch/search/query/ExistsIT.java +++ b/server/src/test/java/org/elasticsearch/search/query/ExistsIT.java @@ -48,9 +48,10 @@ public class ExistsIT extends ESIntegTestCase { // TODO: move this to a unit test somewhere... public void testEmptyIndex() throws Exception { createIndex("test"); - SearchResponse resp = client().prepareSearch("test").setQuery(QueryBuilders.existsQuery("foo")).execute().actionGet(); + SearchResponse resp = client().prepareSearch("test").setQuery(QueryBuilders.existsQuery("foo")).get(); assertSearchResponse(resp); - resp = client().prepareSearch("test").setQuery(QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery("foo"))).execute().actionGet(); + resp = client().prepareSearch("test").setQuery(QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery("foo"))) + .get(); assertSearchResponse(resp); } @@ -126,17 +127,20 @@ public class ExistsIT extends ESIntegTestCase { final String fieldName = entry.getKey(); final int count = entry.getValue(); // exists - SearchResponse resp = client().prepareSearch("idx").setQuery(QueryBuilders.existsQuery(fieldName)).execute().actionGet(); + SearchResponse resp = client().prepareSearch("idx").setQuery(QueryBuilders.existsQuery(fieldName)).get(); assertSearchResponse(resp); try { - assertEquals(String.format(Locale.ROOT, "exists(%s, %d) mapping: %s response: %s", fieldName, count, Strings.toString(mapping), resp), count, resp.getHits().getTotalHits().value); + assertEquals(String.format(Locale.ROOT, "exists(%s, %d) mapping: %s response: %s", fieldName, count, + Strings.toString(mapping), resp), count, resp.getHits().getTotalHits().value); } catch (AssertionError e) { for (SearchHit searchHit : allDocs.getHits()) { final String index = searchHit.getIndex(); final String type = searchHit.getType(); final String id = searchHit.getId(); - final ExplainResponse explanation = client().prepareExplain(index, type, id).setQuery(QueryBuilders.existsQuery(fieldName)).get(); - logger.info("Explanation for [{}] / [{}] / [{}]: [{}]", fieldName, id, searchHit.getSourceAsString(), explanation.getExplanation()); + final ExplainResponse explanation = client().prepareExplain(index, type, id) + .setQuery(QueryBuilders.existsQuery(fieldName)).get(); + logger.info("Explanation for [{}] / [{}] / [{}]: [{}]", fieldName, id, searchHit.getSourceAsString(), + explanation.getExplanation()); } throw e; } diff --git a/server/src/test/java/org/elasticsearch/search/query/MultiMatchQueryIT.java b/server/src/test/java/org/elasticsearch/search/query/MultiMatchQueryIT.java index 806307d0929..f5688e0a421 100644 --- a/server/src/test/java/org/elasticsearch/search/query/MultiMatchQueryIT.java +++ b/server/src/test/java/org/elasticsearch/search/query/MultiMatchQueryIT.java @@ -228,18 +228,21 @@ public class MultiMatchQueryIT extends ESIntegTestCase { public void testPhraseType() { SearchResponse searchResponse = client().prepareSearch("test") - .setQuery(randomizeType(multiMatchQuery("Man the Ultimate", "full_name_phrase", "first_name_phrase", "last_name_phrase", "category_phrase") + .setQuery(randomizeType(multiMatchQuery("Man the Ultimate", "full_name_phrase", "first_name_phrase", "last_name_phrase", + "category_phrase") .operator(Operator.OR).type(MatchQuery.Type.PHRASE))).get(); assertFirstHit(searchResponse, hasId("ultimate2")); assertHitCount(searchResponse, 1L); searchResponse = client().prepareSearch("test") - .setQuery(randomizeType(multiMatchQuery("Captain", "full_name_phrase", "first_name_phrase", "last_name_phrase", "category_phrase") + .setQuery(randomizeType(multiMatchQuery("Captain", "full_name_phrase", "first_name_phrase", "last_name_phrase", + "category_phrase") .operator(Operator.OR).type(MatchQuery.Type.PHRASE))).get(); assertThat(searchResponse.getHits().getTotalHits().value, greaterThan(1L)); searchResponse = client().prepareSearch("test") - .setQuery(randomizeType(multiMatchQuery("the Ul", "full_name_phrase", "first_name_phrase", "last_name_phrase", "category_phrase") + .setQuery(randomizeType(multiMatchQuery("the Ul", "full_name_phrase", "first_name_phrase", "last_name_phrase", + "category_phrase") .operator(Operator.OR).type(MatchQuery.Type.PHRASE_PREFIX))).get(); assertSearchHits(searchResponse, "ultimate2", "ultimate1"); assertHitCount(searchResponse, 2L); @@ -285,7 +288,8 @@ public class MultiMatchQueryIT extends ESIntegTestCase { .addSort("_score", SortOrder.DESC) .addSort("_id", SortOrder.ASC) .setQuery(matchQueryBuilder).get(); - assertThat("field: " + field + " query: " + builder.toString(), multiMatchResp.getHits().getTotalHits().value, equalTo(matchResp.getHits().getTotalHits().value)); + assertThat("field: " + field + " query: " + builder.toString(), multiMatchResp.getHits().getTotalHits().value, + equalTo(matchResp.getHits().getTotalHits().value)); SearchHits hits = multiMatchResp.getHits(); if (field.startsWith("missing")) { assertEquals(0, hits.getHits().length); @@ -313,7 +317,8 @@ public class MultiMatchQueryIT extends ESIntegTestCase { // the doc id is the tie-breaker } assertThat(topNIds, empty()); - assertThat(searchResponse.getHits().getHits()[0].getScore(), greaterThanOrEqualTo(searchResponse.getHits().getHits()[1].getScore())); + assertThat(searchResponse.getHits().getHits()[0].getScore(), + greaterThanOrEqualTo(searchResponse.getHits().getHits()[1].getScore())); cutoffFrequency = randomBoolean() ? Math.min(1, numDocs * 1.f / between(10, 20)) : 1.f / between(10, 20); searchResponse = client().prepareSearch("test") @@ -365,7 +370,8 @@ public class MultiMatchQueryIT extends ESIntegTestCase { for (int i = 0; i < numIters; i++) { { MatchQuery.Type type = MatchQuery.Type.BOOLEAN; - MultiMatchQueryBuilder multiMatchQueryBuilder = randomBoolean() ? multiMatchQuery("marvel hero captain america", "full_name", "first_name", "last_name", "category") : + MultiMatchQueryBuilder multiMatchQueryBuilder = randomBoolean() ? + multiMatchQuery("marvel hero captain america", "full_name", "first_name", "last_name", "category") : multiMatchQuery("marvel hero captain america", "*_name", randomBoolean() ? "category" : "categ*"); SearchResponse left = client().prepareSearch("test").setSize(numDocs) .addSort(SortBuilders.scoreSort()).addSort(SortBuilders.fieldSort("_id")) @@ -387,7 +393,8 @@ public class MultiMatchQueryIT extends ESIntegTestCase { MatchQuery.Type type = MatchQuery.Type.BOOLEAN; String minShouldMatch = randomBoolean() ? null : "" + between(0, 1); Operator op = randomBoolean() ? Operator.AND : Operator.OR; - MultiMatchQueryBuilder multiMatchQueryBuilder = randomBoolean() ? multiMatchQuery("captain america", "full_name", "first_name", "last_name", "category") : + MultiMatchQueryBuilder multiMatchQueryBuilder = randomBoolean() ? + multiMatchQuery("captain america", "full_name", "first_name", "last_name", "category") : multiMatchQuery("captain america", "*_name", randomBoolean() ? "category" : "categ*"); SearchResponse left = client().prepareSearch("test").setSize(numDocs) .addSort(SortBuilders.scoreSort()).addSort(SortBuilders.fieldSort("_id")) @@ -397,7 +404,8 @@ public class MultiMatchQueryIT extends ESIntegTestCase { SearchResponse right = client().prepareSearch("test").setSize(numDocs) .addSort(SortBuilders.scoreSort()).addSort(SortBuilders.fieldSort("_id")) .setQuery(boolQuery().minimumShouldMatch(minShouldMatch) - .should(randomBoolean() ? termQuery("full_name", "captain america") : matchQuery("full_name", "captain america").operator(op)) + .should(randomBoolean() ? termQuery("full_name", "captain america") : + matchQuery("full_name", "captain america").operator(op)) .should(matchQuery("first_name", "captain america").operator(op)) .should(matchQuery("last_name", "captain america").operator(op)) .should(matchQuery("category", "captain america").operator(op)) @@ -487,7 +495,8 @@ public class MultiMatchQueryIT extends ESIntegTestCase { assertFirstHit(searchResponse, hasId("theone")); searchResponse = client().prepareSearch("test") - .setQuery(randomizeType(multiMatchQuery("captain america 15", "full_name", "first_name", "last_name", "category", "skill", "int-field") + .setQuery(randomizeType(multiMatchQuery("captain america 15", "full_name", "first_name", "last_name", "category", "skill", + "int-field") .type(MultiMatchQueryBuilder.Type.CROSS_FIELDS) .analyzer("category") .lenient(true) @@ -496,7 +505,8 @@ public class MultiMatchQueryIT extends ESIntegTestCase { assertFirstHit(searchResponse, hasId("theone")); searchResponse = client().prepareSearch("test") - .setQuery(randomizeType(multiMatchQuery("captain america 15", "skill", "full_name", "first_name", "last_name", "category", "int-field") + .setQuery(randomizeType(multiMatchQuery("captain america 15", "skill", "full_name", "first_name", "last_name", "category", + "int-field") .type(MultiMatchQueryBuilder.Type.CROSS_FIELDS) .analyzer("category") .lenient(true) diff --git a/server/src/test/java/org/elasticsearch/search/query/QueryStringIT.java b/server/src/test/java/org/elasticsearch/search/query/QueryStringIT.java index 969e9004e8f..8d5933e6cfc 100644 --- a/server/src/test/java/org/elasticsearch/search/query/QueryStringIT.java +++ b/server/src/test/java/org/elasticsearch/search/query/QueryStringIT.java @@ -304,7 +304,7 @@ public class QueryStringIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("test") .setQuery(queryStringQuery("value").field("f3_alias")) - .execute().actionGet(); + .get(); assertNoFailures(response); assertHitCount(response, 2); @@ -320,7 +320,7 @@ public class QueryStringIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("test") .setQuery(queryStringQuery("f3_alias:value AND f2:three")) - .execute().actionGet(); + .get(); assertNoFailures(response); assertHitCount(response, 1); @@ -336,7 +336,7 @@ public class QueryStringIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("test") .setQuery(queryStringQuery("value").field("f3_*")) - .execute().actionGet(); + .get(); assertNoFailures(response); assertHitCount(response, 2); @@ -352,7 +352,7 @@ public class QueryStringIT extends ESIntegTestCase { // By default, the geo_point field should be ignored when building the query. SearchResponse response = client().prepareSearch("test") .setQuery(queryStringQuery("text").field("f*_alias")) - .execute().actionGet(); + .get(); assertNoFailures(response); assertHitCount(response, 1); diff --git a/server/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java b/server/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java index da9c01103b3..ebfd4dbbebf 100644 --- a/server/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java +++ b/server/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java @@ -175,7 +175,8 @@ public class SearchQueryIT extends ESIntegTestCase { .addMapping("type1", "field1", "type=text,index_options=docs")); indexRandom(true, client().prepareIndex("test", "type1", "1").setSource("field1", "quick brown fox", "field2", "quick brown fox"), - client().prepareIndex("test", "type1", "2").setSource("field1", "quick lazy huge brown fox", "field2", "quick lazy huge brown fox")); + client().prepareIndex("test", "type1", "2").setSource("field1", "quick lazy huge brown fox", + "field2", "quick lazy huge brown fox")); SearchResponse searchResponse = client().prepareSearch().setQuery(matchPhraseQuery("field2", "quick brown").slop(0)).get(); assertHitCount(searchResponse, 1L); @@ -189,7 +190,9 @@ public class SearchQueryIT extends ESIntegTestCase { public void testConstantScoreQuery() throws Exception { Random random = random(); createIndex("test"); - indexRandom(true, client().prepareIndex("test", "type1", "1").setSource("field1", "quick brown fox", "field2", "quick brown fox"), client().prepareIndex("test", "type1", "2").setSource("field1", "quick lazy huge brown fox", "field2", "quick lazy huge brown fox")); + indexRandom(true, client().prepareIndex("test", "type1", "1").setSource("field1", "quick brown fox", "field2", "quick brown fox"), + client().prepareIndex("test", "type1", "2").setSource("field1", "quick lazy huge brown fox", "field2", + "quick lazy huge brown fox")); SearchResponse searchResponse = client().prepareSearch().setQuery(constantScoreQuery(matchQuery("field1", "quick"))).get(); assertHitCount(searchResponse, 2L); @@ -272,18 +275,21 @@ public class SearchQueryIT extends ESIntegTestCase { client().admin().indices().prepareCreate("test") .addMapping("type1", "field1", "type=text,analyzer=whitespace") .setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1)).get(); - indexRandom(true, client().prepareIndex("test", "type1", "3").setSource("field1", "quick lazy huge brown pidgin", "field2", "the quick lazy huge brown fox jumps over the tree"), + indexRandom(true, client().prepareIndex("test", "type1", "3").setSource("field1", "quick lazy huge brown pidgin", "field2", + "the quick lazy huge brown fox jumps over the tree"), client().prepareIndex("test", "type1", "1").setSource("field1", "the quick brown fox"), client().prepareIndex("test", "type1", "2").setSource("field1", "the quick lazy huge brown fox jumps over the tree") ); - SearchResponse searchResponse = client().prepareSearch().setQuery(commonTermsQuery("field1", "the quick brown").cutoffFrequency(3).lowFreqOperator(Operator.OR)).get(); + SearchResponse searchResponse = client().prepareSearch().setQuery(commonTermsQuery("field1", "the quick brown").cutoffFrequency(3) + .lowFreqOperator(Operator.OR)).get(); assertHitCount(searchResponse, 3L); assertFirstHit(searchResponse, hasId("1")); assertSecondHit(searchResponse, hasId("2")); assertThirdHit(searchResponse, hasId("3")); - searchResponse = client().prepareSearch().setQuery(commonTermsQuery("field1", "the quick brown").cutoffFrequency(3).lowFreqOperator(Operator.AND)).get(); + searchResponse = client().prepareSearch().setQuery(commonTermsQuery("field1", "the quick brown").cutoffFrequency(3) + .lowFreqOperator(Operator.AND)).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); assertFirstHit(searchResponse, hasId("1")); assertSecondHit(searchResponse, hasId("2")); @@ -300,12 +306,14 @@ public class SearchQueryIT extends ESIntegTestCase { assertHitCount(searchResponse, 1L); assertFirstHit(searchResponse, hasId("2")); - searchResponse = client().prepareSearch().setQuery(commonTermsQuery("field1", "the lazy fox brown").cutoffFrequency(1).highFreqMinimumShouldMatch("3")).get(); + searchResponse = client().prepareSearch().setQuery(commonTermsQuery("field1", "the lazy fox brown").cutoffFrequency(1) + .highFreqMinimumShouldMatch("3")).get(); assertHitCount(searchResponse, 2L); assertFirstHit(searchResponse, hasId("2")); assertSecondHit(searchResponse, hasId("1")); - searchResponse = client().prepareSearch().setQuery(commonTermsQuery("field1", "the lazy fox brown").cutoffFrequency(1).highFreqMinimumShouldMatch("4")).get(); + searchResponse = client().prepareSearch().setQuery(commonTermsQuery("field1", "the lazy fox brown").cutoffFrequency(1) + .highFreqMinimumShouldMatch("4")).get(); assertHitCount(searchResponse, 1L); assertFirstHit(searchResponse, hasId("2")); @@ -314,7 +322,8 @@ public class SearchQueryIT extends ESIntegTestCase { assertHitCount(searchResponse, 1L); assertFirstHit(searchResponse, hasId("2")); - searchResponse = client().prepareSearch().setQuery(commonTermsQuery("field1", "the quick brown").cutoffFrequency(3).analyzer("stop")).get(); + searchResponse = client().prepareSearch().setQuery(commonTermsQuery("field1", "the quick brown").cutoffFrequency(3) + .analyzer("stop")).get(); assertHitCount(searchResponse, 3L); // stop drops "the" since its a stopword assertFirstHit(searchResponse, hasId("1")); @@ -322,18 +331,21 @@ public class SearchQueryIT extends ESIntegTestCase { assertThirdHit(searchResponse, hasId("2")); // try the same with match query - searchResponse = client().prepareSearch().setQuery(matchQuery("field1", "the quick brown").cutoffFrequency(3).operator(Operator.AND)).get(); + searchResponse = client().prepareSearch().setQuery(matchQuery("field1", "the quick brown").cutoffFrequency(3) + .operator(Operator.AND)).get(); assertHitCount(searchResponse, 2L); assertFirstHit(searchResponse, hasId("1")); assertSecondHit(searchResponse, hasId("2")); - searchResponse = client().prepareSearch().setQuery(matchQuery("field1", "the quick brown").cutoffFrequency(3).operator(Operator.OR)).get(); + searchResponse = client().prepareSearch().setQuery(matchQuery("field1", "the quick brown").cutoffFrequency(3) + .operator(Operator.OR)).get(); assertHitCount(searchResponse, 3L); assertFirstHit(searchResponse, hasId("1")); assertSecondHit(searchResponse, hasId("2")); assertThirdHit(searchResponse, hasId("3")); - searchResponse = client().prepareSearch().setQuery(matchQuery("field1", "the quick brown").cutoffFrequency(3).operator(Operator.AND).analyzer("stop")).get(); + searchResponse = client().prepareSearch().setQuery(matchQuery("field1", "the quick brown").cutoffFrequency(3) + .operator(Operator.AND).analyzer("stop")).get(); assertHitCount(searchResponse, 3L); // stop drops "the" since its a stopword assertFirstHit(searchResponse, hasId("1")); @@ -341,7 +353,8 @@ public class SearchQueryIT extends ESIntegTestCase { assertThirdHit(searchResponse, hasId("2")); // try the same with multi match query - searchResponse = client().prepareSearch().setQuery(multiMatchQuery("the quick brown", "field1", "field2").cutoffFrequency(3).operator(Operator.AND)).get(); + searchResponse = client().prepareSearch().setQuery(multiMatchQuery("the quick brown", "field1", "field2").cutoffFrequency(3) + .operator(Operator.AND)).get(); assertHitCount(searchResponse, 3L); assertFirstHit(searchResponse, hasId("3")); assertSecondHit(searchResponse, hasId("1")); @@ -557,10 +570,18 @@ public class SearchQueryIT extends ESIntegTestCase { createIndex("test"); indexRandom(true, - client().prepareIndex("test", "type1", "1").setSource(jsonBuilder().startObject().startObject("obj1").field("obj1_val", "1").endObject().field("x1", "x_1").field("field1", "value1_1").field("field2", "value2_1").endObject()), - client().prepareIndex("test", "type1", "2").setSource(jsonBuilder().startObject().startObject("obj1").field("obj1_val", "1").endObject().field("x2", "x_2").field("field1", "value1_2").endObject()), - client().prepareIndex("test", "type1", "3").setSource(jsonBuilder().startObject().startObject("obj2").field("obj2_val", "1").endObject().field("y1", "y_1").field("field2", "value2_3").endObject()), - client().prepareIndex("test", "type1", "4").setSource(jsonBuilder().startObject().startObject("obj2").field("obj2_val", "1").endObject().field("y2", "y_2").field("field3", "value3_4").endObject()) ); + client().prepareIndex("test", "type1", "1") + .setSource(jsonBuilder().startObject().startObject("obj1").field("obj1_val", "1").endObject().field("x1", "x_1") + .field("field1", "value1_1").field("field2", "value2_1").endObject()), + client().prepareIndex("test", "type1", "2") + .setSource(jsonBuilder().startObject().startObject("obj1").field("obj1_val", "1").endObject().field("x2", "x_2") + .field("field1", "value1_2").endObject()), + client().prepareIndex("test", "type1", "3") + .setSource(jsonBuilder().startObject().startObject("obj2").field("obj2_val", "1").endObject().field("y1", "y_1") + .field("field2", "value2_3").endObject()), + client().prepareIndex("test", "type1", "4") + .setSource(jsonBuilder().startObject().startObject("obj2").field("obj2_val", "1").endObject().field("y2", "y_2") + .field("field3", "value3_4").endObject()) ); SearchResponse searchResponse = client().prepareSearch().setQuery(existsQuery("field1")).get(); @@ -741,7 +762,8 @@ public class SearchQueryIT extends ESIntegTestCase { BoolQueryBuilder boolQuery = boolQuery() .must(multiMatchQuery("a", "field1", "field2").zeroTermsQuery(MatchQuery.ZeroTermsQuery.NONE)) - .must(multiMatchQuery("value1", "field1", "field2").zeroTermsQuery(MatchQuery.ZeroTermsQuery.NONE)); // Fields are ORed together + // Fields are ORed together + .must(multiMatchQuery("value1", "field1", "field2").zeroTermsQuery(MatchQuery.ZeroTermsQuery.NONE)); SearchResponse searchResponse = client().prepareSearch().setQuery(boolQuery).get(); assertHitCount(searchResponse, 0L); @@ -869,7 +891,8 @@ public class SearchQueryIT extends ESIntegTestCase { public void testQuotedQueryStringWithBoost() throws InterruptedException, ExecutionException { float boost = 10.0f; assertAcked(prepareCreate("test").setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1))); - indexRandom(true, client().prepareIndex("test", "type1", "1").setSource("important", "phrase match", "less_important", "nothing important"), + indexRandom(true, + client().prepareIndex("test", "type1", "1").setSource("important", "phrase match", "less_important", "nothing important"), client().prepareIndex("test", "type1", "2").setSource("important", "nothing important", "less_important", "phrase match") ); @@ -1334,7 +1357,7 @@ public class SearchQueryIT extends ESIntegTestCase { response = client().prepareSearch("test") .setQuery(spanOrQuery(spanMultiTermQueryBuilder(QueryBuilders.rangeQuery("description").from("ffa").to("foo")))) - .execute().actionGet(); + .get(); assertHitCount(response, 3); response = client().prepareSearch("test") @@ -1356,12 +1379,14 @@ public class SearchQueryIT extends ESIntegTestCase { searchResponse = client().prepareSearch("test") .setQuery(spanNotQuery(spanNearQuery(QueryBuilders.spanTermQuery("description", "quick"), 1) - .addClause(QueryBuilders.spanTermQuery("description", "fox")), spanTermQuery("description", "sleeping")).dist(5)).get(); + .addClause(QueryBuilders.spanTermQuery("description", "fox")), spanTermQuery("description", "sleeping")).dist(5)) + .get(); assertHitCount(searchResponse, 1L); searchResponse = client().prepareSearch("test") .setQuery(spanNotQuery(spanNearQuery(QueryBuilders.spanTermQuery("description", "quick"), 1) - .addClause(QueryBuilders.spanTermQuery("description", "fox")), spanTermQuery("description", "jumped")).pre(1).post(1)).get(); + .addClause(QueryBuilders.spanTermQuery("description", "fox")), spanTermQuery("description", "jumped")).pre(1) + .post(1)).get(); assertHitCount(searchResponse, 1L); } @@ -1485,7 +1510,8 @@ public class SearchQueryIT extends ESIntegTestCase { client().prepareIndex("test", "_doc", "2").setSource("desc", "one two three", "type", "product").get(); refresh(); { - SearchResponse searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.queryStringQuery("\"one two\"").defaultField("desc")).get(); + SearchResponse searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.queryStringQuery("\"one two\"") + .defaultField("desc")).get(); assertHitCount(searchResponse, 2); } { @@ -1512,7 +1538,8 @@ public class SearchQueryIT extends ESIntegTestCase { public void testDateProvidedAsNumber() throws ExecutionException, InterruptedException { createIndex("test"); - assertAcked(client().admin().indices().preparePutMapping("test").setType("type").setSource("field", "type=date,format=epoch_millis").get()); + assertAcked(client().admin().indices().preparePutMapping("test").setType("type") + .setSource("field", "type=date,format=epoch_millis").get()); indexRandom(true, client().prepareIndex("test", "type", "1").setSource("field", -1000000000001L), client().prepareIndex("test", "type", "2").setSource("field", -1000000000000L), client().prepareIndex("test", "type", "3").setSource("field", -999999999999L), @@ -1535,7 +1562,8 @@ public class SearchQueryIT extends ESIntegTestCase { client().prepareIndex("test", "type1", "2").setSource("date", "2013-12-31T23:00:00", "num", 2), client().prepareIndex("test", "type1", "3").setSource("date", "2014-01-01T01:00:00", "num", 3), // Now in UTC+1 - client().prepareIndex("test", "type1", "4").setSource("date", DateTime.now(DateTimeZone.forOffsetHours(1)).getMillis(), "num", 4)); + client().prepareIndex("test", "type1", "4") + .setSource("date", DateTime.now(DateTimeZone.forOffsetHours(1)).getMillis(), "num", 4)); SearchResponse searchResponse = client().prepareSearch("test") .setQuery(QueryBuilders.rangeQuery("date").from("2014-01-01T00:00:00").to("2014-01-01T00:59:00")) diff --git a/server/src/test/java/org/elasticsearch/search/query/SimpleQueryStringIT.java b/server/src/test/java/org/elasticsearch/search/query/SimpleQueryStringIT.java index 5451095acf3..f0cb0f30b2d 100644 --- a/server/src/test/java/org/elasticsearch/search/query/SimpleQueryStringIT.java +++ b/server/src/test/java/org/elasticsearch/search/query/SimpleQueryStringIT.java @@ -348,7 +348,7 @@ public class SimpleQueryStringIT extends ESIntegTestCase { CreateIndexRequestBuilder mappingRequest = client().admin().indices().prepareCreate("test1") .addMapping("type1", mapping, XContentType.JSON); - mappingRequest.execute().actionGet(); + mappingRequest.get(); indexRandom(true, client().prepareIndex("test1", "type1", "1").setSource("location", "Köln")); refresh(); @@ -399,7 +399,7 @@ public class SimpleQueryStringIT extends ESIntegTestCase { CreateIndexRequestBuilder mappingRequest = client().admin().indices() .prepareCreate("test1") .addMapping("type1", mapping, XContentType.JSON); - mappingRequest.execute().actionGet(); + mappingRequest.get(); indexRandom(true, client().prepareIndex("test1", "type1", "1").setSource("body", "Some Text")); refresh(); @@ -616,7 +616,7 @@ public class SimpleQueryStringIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("test") .setQuery(simpleQueryStringQuery("value").field("f3_alias")) - .execute().actionGet(); + .get(); assertNoFailures(response); assertHitCount(response, 2); @@ -636,7 +636,7 @@ public class SimpleQueryStringIT extends ESIntegTestCase { SearchResponse response = client().prepareSearch("test") .setQuery(simpleQueryStringQuery("value").field("f3_*")) - .execute().actionGet(); + .get(); assertNoFailures(response); assertHitCount(response, 2); @@ -657,7 +657,7 @@ public class SimpleQueryStringIT extends ESIntegTestCase { // By default, the boolean field should be ignored when building the query. SearchResponse response = client().prepareSearch("test") .setQuery(queryStringQuery("text").field("f*_alias")) - .execute().actionGet(); + .get(); assertNoFailures(response); assertHitCount(response, 1); diff --git a/server/src/test/java/org/elasticsearch/search/scroll/SearchScrollIT.java b/server/src/test/java/org/elasticsearch/search/scroll/SearchScrollIT.java index c6a6246a07e..9fb05af2040 100644 --- a/server/src/test/java/org/elasticsearch/search/scroll/SearchScrollIT.java +++ b/server/src/test/java/org/elasticsearch/search/scroll/SearchScrollIT.java @@ -75,23 +75,24 @@ public class SearchScrollIT extends ESIntegTestCase { } public void testSimpleScrollQueryThenFetch() throws Exception { - client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 3)).execute().actionGet(); - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); + client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 3)).get(); + client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().get(); - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); + client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().get(); for (int i = 0; i < 100; i++) { - client().prepareIndex("test", "type1", Integer.toString(i)).setSource(jsonBuilder().startObject().field("field", i).endObject()).execute().actionGet(); + client().prepareIndex("test", "type1", Integer.toString(i)) + .setSource(jsonBuilder().startObject().field("field", i).endObject()).get(); } - client().admin().indices().prepareRefresh().execute().actionGet(); + client().admin().indices().prepareRefresh().get(); SearchResponse searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .setSize(35) .setScroll(TimeValue.timeValueMinutes(2)) .addSort("field", SortOrder.ASC) - .execute().actionGet(); + .get(); try { long counter = 0; @@ -103,7 +104,7 @@ public class SearchScrollIT extends ESIntegTestCase { searchResponse = client().prepareSearchScroll(searchResponse.getScrollId()) .setScroll(TimeValue.timeValueMinutes(2)) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(100L)); assertThat(searchResponse.getHits().getHits().length, equalTo(35)); @@ -113,7 +114,7 @@ public class SearchScrollIT extends ESIntegTestCase { searchResponse = client().prepareSearchScroll(searchResponse.getScrollId()) .setScroll(TimeValue.timeValueMinutes(2)) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(100L)); assertThat(searchResponse.getHits().getHits().length, equalTo(30)); @@ -126,10 +127,10 @@ public class SearchScrollIT extends ESIntegTestCase { } public void testSimpleScrollQueryThenFetchSmallSizeUnevenDistribution() throws Exception { - client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 3)).execute().actionGet(); - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); + client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 3)).get(); + client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().get(); - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); + client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().get(); for (int i = 0; i < 100; i++) { String routing = "0"; @@ -138,10 +139,10 @@ public class SearchScrollIT extends ESIntegTestCase { } else if (i > 60) { routing = "2"; } - client().prepareIndex("test", "type1", Integer.toString(i)).setSource("field", i).setRouting(routing).execute().actionGet(); + client().prepareIndex("test", "type1", Integer.toString(i)).setSource("field", i).setRouting(routing).get(); } - client().admin().indices().prepareRefresh().execute().actionGet(); + client().admin().indices().prepareRefresh().get(); SearchResponse searchResponse = client().prepareSearch() .setSearchType(SearchType.QUERY_THEN_FETCH) @@ -149,7 +150,7 @@ public class SearchScrollIT extends ESIntegTestCase { .setSize(3) .setScroll(TimeValue.timeValueMinutes(2)) .addSort("field", SortOrder.ASC) - .execute().actionGet(); + .get(); try { long counter = 0; @@ -162,7 +163,7 @@ public class SearchScrollIT extends ESIntegTestCase { for (int i = 0; i < 32; i++) { searchResponse = client().prepareSearchScroll(searchResponse.getScrollId()) .setScroll(TimeValue.timeValueMinutes(2)) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(100L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -174,7 +175,7 @@ public class SearchScrollIT extends ESIntegTestCase { // and now, the last one is one searchResponse = client().prepareSearchScroll(searchResponse.getScrollId()) .setScroll(TimeValue.timeValueMinutes(2)) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(100L)); assertThat(searchResponse.getHits().getHits().length, equalTo(1)); @@ -185,7 +186,7 @@ public class SearchScrollIT extends ESIntegTestCase { // a the last is zero searchResponse = client().prepareSearchScroll(searchResponse.getScrollId()) .setScroll(TimeValue.timeValueMinutes(2)) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(100L)); assertThat(searchResponse.getHits().getHits().length, equalTo(0)); @@ -199,60 +200,71 @@ public class SearchScrollIT extends ESIntegTestCase { } public void testScrollAndUpdateIndex() throws Exception { - client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 5)).execute().actionGet(); - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); + client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 5)).get(); + client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().get(); for (int i = 0; i < 500; i++) { client().prepareIndex("test", "tweet", Integer.toString(i)).setSource( - jsonBuilder().startObject().field("user", "kimchy").field("postDate", System.currentTimeMillis()).field("message", "test").endObject()).execute().actionGet(); + jsonBuilder().startObject().field("user", "kimchy").field("postDate", System.currentTimeMillis()) + .field("message", "test").endObject()).get(); } - client().admin().indices().prepareRefresh().execute().actionGet(); + client().admin().indices().prepareRefresh().get(); - assertThat(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).execute().actionGet().getHits().getTotalHits().value, equalTo(500L)); - assertThat(client().prepareSearch().setSize(0).setQuery(termQuery("message", "test")).execute().actionGet().getHits().getTotalHits().value, equalTo(500L)); - assertThat(client().prepareSearch().setSize(0).setQuery(termQuery("message", "test")).execute().actionGet().getHits().getTotalHits().value, equalTo(500L)); - assertThat(client().prepareSearch().setSize(0).setQuery(termQuery("message", "update")).execute().actionGet().getHits().getTotalHits().value, equalTo(0L)); - assertThat(client().prepareSearch().setSize(0).setQuery(termQuery("message", "update")).execute().actionGet().getHits().getTotalHits().value, equalTo(0L)); + assertThat(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get().getHits().getTotalHits().value, equalTo(500L)); + assertThat(client().prepareSearch().setSize(0).setQuery(termQuery("message", "test")).get().getHits().getTotalHits().value, + equalTo(500L)); + assertThat(client().prepareSearch().setSize(0).setQuery(termQuery("message", "test")).get().getHits().getTotalHits().value, + equalTo(500L)); + assertThat(client().prepareSearch().setSize(0).setQuery(termQuery("message", "update")).get().getHits().getTotalHits().value, + equalTo(0L)); + assertThat(client().prepareSearch().setSize(0).setQuery(termQuery("message", "update")).get().getHits().getTotalHits().value, + equalTo(0L)); SearchResponse searchResponse = client().prepareSearch() .setQuery(queryStringQuery("user:kimchy")) .setSize(35) .setScroll(TimeValue.timeValueMinutes(2)) .addSort("postDate", SortOrder.ASC) - .execute().actionGet(); + .get(); try { do { for (SearchHit searchHit : searchResponse.getHits().getHits()) { Map map = searchHit.getSourceAsMap(); map.put("message", "update"); - client().prepareIndex("test", "tweet", searchHit.getId()).setSource(map).execute().actionGet(); + client().prepareIndex("test", "tweet", searchHit.getId()).setSource(map).get(); } - searchResponse = client().prepareSearchScroll(searchResponse.getScrollId()).setScroll(TimeValue.timeValueMinutes(2)).execute().actionGet(); + searchResponse = client().prepareSearchScroll(searchResponse.getScrollId()).setScroll(TimeValue.timeValueMinutes(2)) + .get(); } while (searchResponse.getHits().getHits().length > 0); - client().admin().indices().prepareRefresh().execute().actionGet(); - assertThat(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).execute().actionGet().getHits().getTotalHits().value, equalTo(500L)); - assertThat(client().prepareSearch().setSize(0).setQuery(termQuery("message", "test")).execute().actionGet().getHits().getTotalHits().value, equalTo(0L)); - assertThat(client().prepareSearch().setSize(0).setQuery(termQuery("message", "test")).execute().actionGet().getHits().getTotalHits().value, equalTo(0L)); - assertThat(client().prepareSearch().setSize(0).setQuery(termQuery("message", "update")).execute().actionGet().getHits().getTotalHits().value, equalTo(500L)); - assertThat(client().prepareSearch().setSize(0).setQuery(termQuery("message", "update")).execute().actionGet().getHits().getTotalHits().value, equalTo(500L)); + client().admin().indices().prepareRefresh().get(); + assertThat(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get().getHits().getTotalHits().value, equalTo(500L)); + assertThat(client().prepareSearch().setSize(0).setQuery(termQuery("message", "test")).get().getHits().getTotalHits().value, + equalTo(0L)); + assertThat(client().prepareSearch().setSize(0).setQuery(termQuery("message", "test")).get().getHits().getTotalHits().value, + equalTo(0L)); + assertThat(client().prepareSearch().setSize(0).setQuery(termQuery("message", "update")).get().getHits().getTotalHits().value, + equalTo(500L)); + assertThat(client().prepareSearch().setSize(0).setQuery(termQuery("message", "update")).get().getHits().getTotalHits().value, + equalTo(500L)); } finally { clearScroll(searchResponse.getScrollId()); } } public void testSimpleScrollQueryThenFetch_clearScrollIds() throws Exception { - client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 3)).execute().actionGet(); - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); + client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 3)).get(); + client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().get(); - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); + client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().get(); for (int i = 0; i < 100; i++) { - client().prepareIndex("test", "type1", Integer.toString(i)).setSource(jsonBuilder().startObject().field("field", i).endObject()).execute().actionGet(); + client().prepareIndex("test", "type1", Integer.toString(i)).setSource(jsonBuilder().startObject().field("field", i).endObject()) + .get(); } - client().admin().indices().prepareRefresh().execute().actionGet(); + client().admin().indices().prepareRefresh().get(); SearchResponse searchResponse1 = client().prepareSearch() .setQuery(matchAllQuery()) @@ -260,7 +272,7 @@ public class SearchScrollIT extends ESIntegTestCase { .setScroll(TimeValue.timeValueMinutes(2)) .setSearchType(SearchType.QUERY_THEN_FETCH) .addSort("field", SortOrder.ASC) - .execute().actionGet(); + .get(); SearchResponse searchResponse2 = client().prepareSearch() .setQuery(matchAllQuery()) @@ -268,7 +280,7 @@ public class SearchScrollIT extends ESIntegTestCase { .setScroll(TimeValue.timeValueMinutes(2)) .setSearchType(SearchType.QUERY_THEN_FETCH) .addSort("field", SortOrder.ASC) - .execute().actionGet(); + .get(); long counter1 = 0; long counter2 = 0; @@ -287,11 +299,11 @@ public class SearchScrollIT extends ESIntegTestCase { searchResponse1 = client().prepareSearchScroll(searchResponse1.getScrollId()) .setScroll(TimeValue.timeValueMinutes(2)) - .execute().actionGet(); + .get(); searchResponse2 = client().prepareSearchScroll(searchResponse2.getScrollId()) .setScroll(TimeValue.timeValueMinutes(2)) - .execute().actionGet(); + .get(); assertThat(searchResponse1.getHits().getTotalHits().value, equalTo(100L)); assertThat(searchResponse1.getHits().getHits().length, equalTo(35)); @@ -308,20 +320,23 @@ public class SearchScrollIT extends ESIntegTestCase { ClearScrollResponse clearResponse = client().prepareClearScroll() .addScrollId(searchResponse1.getScrollId()) .addScrollId(searchResponse2.getScrollId()) - .execute().actionGet(); + .get(); assertThat(clearResponse.isSucceeded(), is(true)); assertThat(clearResponse.getNumFreed(), greaterThan(0)); assertThat(clearResponse.status(), equalTo(RestStatus.OK)); assertToXContentResponse(clearResponse, true, clearResponse.getNumFreed()); - assertThrows(client().prepareSearchScroll(searchResponse1.getScrollId()).setScroll(TimeValue.timeValueMinutes(2)), RestStatus.NOT_FOUND); - assertThrows(client().prepareSearchScroll(searchResponse2.getScrollId()).setScroll(TimeValue.timeValueMinutes(2)), RestStatus.NOT_FOUND); + assertThrows(client().prepareSearchScroll(searchResponse1.getScrollId()).setScroll(TimeValue.timeValueMinutes(2)), + RestStatus.NOT_FOUND); + assertThrows(client().prepareSearchScroll(searchResponse2.getScrollId()).setScroll(TimeValue.timeValueMinutes(2)), + RestStatus.NOT_FOUND); } public void testClearNonExistentScrollId() throws Exception { createIndex("idx"); ClearScrollResponse response = client().prepareClearScroll() - .addScrollId("DnF1ZXJ5VGhlbkZldGNoAwAAAAAAAAABFnRtLWMyRzBqUUQyNk1uM0xDTjJ4S0EAAAAAAAAAARYzNkhxbWFTYVFVNmgxTGQyYUZVYV9nAAAAAAAAAAEWdVcxNWZmRGZSVFN2V0xMUGF2NGx1Zw==") + .addScrollId("DnF1ZXJ5VGhlbkZldGNoAwAAAAAAAAABFnRtLWMyRzBqUUQyNk1uM0xDTjJ4S0EAAAAAAAAAARYzNkhxbWFTYVFVNmgxTGQyYUZVYV9nAA" + + "AAAAAAAAEWdVcxNWZmRGZSVFN2V0xMUGF2NGx1Zw==") .get(); // Whether we actually clear a scroll, we can't know, since that information isn't serialized in the // free search context response, which is returned from each node we want to clear a particular scroll. @@ -349,16 +364,17 @@ public class SearchScrollIT extends ESIntegTestCase { } public void testSimpleScrollQueryThenFetchClearAllScrollIds() throws Exception { - client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 3)).execute().actionGet(); - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); + client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 3)).get(); + client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().get(); - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); + client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().get(); for (int i = 0; i < 100; i++) { - client().prepareIndex("test", "type1", Integer.toString(i)).setSource(jsonBuilder().startObject().field("field", i).endObject()).execute().actionGet(); + client().prepareIndex("test", "type1", Integer.toString(i)).setSource(jsonBuilder().startObject().field("field", i).endObject()) + .get(); } - client().admin().indices().prepareRefresh().execute().actionGet(); + client().admin().indices().prepareRefresh().get(); SearchResponse searchResponse1 = client().prepareSearch() .setQuery(matchAllQuery()) @@ -366,7 +382,7 @@ public class SearchScrollIT extends ESIntegTestCase { .setScroll(TimeValue.timeValueMinutes(2)) .setSearchType(SearchType.QUERY_THEN_FETCH) .addSort("field", SortOrder.ASC) - .execute().actionGet(); + .get(); SearchResponse searchResponse2 = client().prepareSearch() .setQuery(matchAllQuery()) @@ -374,7 +390,7 @@ public class SearchScrollIT extends ESIntegTestCase { .setScroll(TimeValue.timeValueMinutes(2)) .setSearchType(SearchType.QUERY_THEN_FETCH) .addSort("field", SortOrder.ASC) - .execute().actionGet(); + .get(); long counter1 = 0; long counter2 = 0; @@ -393,11 +409,11 @@ public class SearchScrollIT extends ESIntegTestCase { searchResponse1 = client().prepareSearchScroll(searchResponse1.getScrollId()) .setScroll(TimeValue.timeValueMinutes(2)) - .execute().actionGet(); + .get(); searchResponse2 = client().prepareSearchScroll(searchResponse2.getScrollId()) .setScroll(TimeValue.timeValueMinutes(2)) - .execute().actionGet(); + .get(); assertThat(searchResponse1.getHits().getTotalHits().value, equalTo(100L)); assertThat(searchResponse1.getHits().getHits().length, equalTo(35)); @@ -412,14 +428,16 @@ public class SearchScrollIT extends ESIntegTestCase { } ClearScrollResponse clearResponse = client().prepareClearScroll().addScrollId("_all") - .execute().actionGet(); + .get(); assertThat(clearResponse.isSucceeded(), is(true)); assertThat(clearResponse.getNumFreed(), greaterThan(0)); assertThat(clearResponse.status(), equalTo(RestStatus.OK)); assertToXContentResponse(clearResponse, true, clearResponse.getNumFreed()); - assertThrows(internalCluster().transportClient().prepareSearchScroll(searchResponse1.getScrollId()).setScroll(TimeValue.timeValueMinutes(2)), RestStatus.NOT_FOUND); - assertThrows(internalCluster().transportClient().prepareSearchScroll(searchResponse2.getScrollId()).setScroll(TimeValue.timeValueMinutes(2)), RestStatus.NOT_FOUND); + assertThrows(internalCluster().transportClient().prepareSearchScroll(searchResponse1.getScrollId()) + .setScroll(TimeValue.timeValueMinutes(2)), RestStatus.NOT_FOUND); + assertThrows(internalCluster().transportClient().prepareSearchScroll(searchResponse2.getScrollId()) + .setScroll(TimeValue.timeValueMinutes(2)), RestStatus.NOT_FOUND); } /** @@ -444,7 +462,7 @@ public class SearchScrollIT extends ESIntegTestCase { .setSize(Integer.MAX_VALUE) .setScroll("1m"); - SearchResponse response = builder.execute().actionGet(); + SearchResponse response = builder.get(); try { ElasticsearchAssertions.assertHitCount(response, 1L); } finally { @@ -471,7 +489,8 @@ public class SearchScrollIT extends ESIntegTestCase { public void testStringSortMissingAscTerminates() throws Exception { assertAcked(prepareCreate("test") - .setSettings(Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)) + .setSettings(Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) + .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)) .addMapping("test", "no_field", "type=keyword", "some_field", "type=keyword")); client().prepareIndex("test", "test", "1").setSource("some_field", "test").get(); refresh(); @@ -505,7 +524,8 @@ public class SearchScrollIT extends ESIntegTestCase { public void testCloseAndReopenOrDeleteWithActiveScroll() throws IOException { createIndex("test"); for (int i = 0; i < 100; i++) { - client().prepareIndex("test", "type1", Integer.toString(i)).setSource(jsonBuilder().startObject().field("field", i).endObject()).execute().actionGet(); + client().prepareIndex("test", "type1", Integer.toString(i)).setSource(jsonBuilder().startObject().field("field", i).endObject()) + .get(); } refresh(); SearchResponse searchResponse = client().prepareSearch() @@ -513,7 +533,7 @@ public class SearchScrollIT extends ESIntegTestCase { .setSize(35) .setScroll(TimeValue.timeValueMinutes(2)) .addSort("field", SortOrder.ASC) - .execute().actionGet(); + .get(); long counter = 0; assertThat(searchResponse.getHits().getTotalHits().value, equalTo(100L)); assertThat(searchResponse.getHits().getHits().length, equalTo(35)); @@ -562,7 +582,7 @@ public class SearchScrollIT extends ESIntegTestCase { createIndex("test"); for (int i = 0; i < 2; i++) { client().prepareIndex("test", "type1", - Integer.toString(i)).setSource(jsonBuilder().startObject().field("field", i).endObject()).execute().actionGet(); + Integer.toString(i)).setSource(jsonBuilder().startObject().field("field", i).endObject()).get(); } refresh(); assertAcked(client().admin().cluster().prepareUpdateSettings() @@ -573,7 +593,7 @@ public class SearchScrollIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(1) .setScroll(TimeValue.timeValueHours(2)) - .execute().actionGet()); + .get()); IllegalArgumentException illegalArgumentException = (IllegalArgumentException) ExceptionsHelper.unwrap(exc, IllegalArgumentException.class); assertNotNull(illegalArgumentException); @@ -583,7 +603,7 @@ public class SearchScrollIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(1) .setScroll(TimeValue.timeValueMinutes(5)) - .execute().actionGet(); + .get(); assertNotNull(searchResponse.getScrollId()); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); assertThat(searchResponse.getHits().getHits().length, equalTo(1)); diff --git a/server/src/test/java/org/elasticsearch/search/scroll/SearchScrollWithFailingNodesIT.java b/server/src/test/java/org/elasticsearch/search/scroll/SearchScrollWithFailingNodesIT.java index 0b30048826a..23cb1301c5f 100644 --- a/server/src/test/java/org/elasticsearch/search/scroll/SearchScrollWithFailingNodesIT.java +++ b/server/src/test/java/org/elasticsearch/search/scroll/SearchScrollWithFailingNodesIT.java @@ -55,7 +55,8 @@ public class SearchScrollWithFailingNodesIT extends ESIntegTestCase { assertAcked( prepareCreate("test") // Enforces that only one shard can only be allocated to a single node - .setSettings(Settings.builder().put(indexSettings()).put(ShardsLimitAllocationDecider.INDEX_TOTAL_SHARDS_PER_NODE_SETTING.getKey(), 1)) + .setSettings(Settings.builder().put(indexSettings()) + .put(ShardsLimitAllocationDecider.INDEX_TOTAL_SHARDS_PER_NODE_SETTING.getKey(), 1)) ); List writes = new ArrayList<>(); diff --git a/server/src/test/java/org/elasticsearch/search/searchafter/SearchAfterIT.java b/server/src/test/java/org/elasticsearch/search/searchafter/SearchAfterIT.java index 84fae003244..806c3dfca67 100644 --- a/server/src/test/java/org/elasticsearch/search/searchafter/SearchAfterIT.java +++ b/server/src/test/java/org/elasticsearch/search/searchafter/SearchAfterIT.java @@ -84,7 +84,8 @@ public class SearchAfterIT extends ESIntegTestCase { assertTrue(e.shardFailures().length > 0); for (ShardSearchFailure failure : e.shardFailures()) { assertThat(failure.getCause().getClass(), Matchers.equalTo(SearchContextException.class)); - assertThat(failure.getCause().getMessage(), Matchers.equalTo("`from` parameter must be set to 0 when `search_after` is used.")); + assertThat(failure.getCause().getMessage(), + Matchers.equalTo("`from` parameter must be set to 0 when `search_after` is used.")); } } diff --git a/server/src/test/java/org/elasticsearch/search/simple/SimpleSearchIT.java b/server/src/test/java/org/elasticsearch/search/simple/SimpleSearchIT.java index 20c71dd7a0b..3e546d17202 100644 --- a/server/src/test/java/org/elasticsearch/search/simple/SimpleSearchIT.java +++ b/server/src/test/java/org/elasticsearch/search/simple/SimpleSearchIT.java @@ -79,7 +79,8 @@ public class SimpleSearchIT extends ESIntegTestCase { randomPreference = randomUnicodeOfLengthBetween(0, 4); } // id is not indexed, but lets see that we automatically convert to - SearchResponse searchResponse = client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()).setPreference(randomPreference).get(); + SearchResponse searchResponse = client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()) + .setPreference(randomPreference).get(); assertHitCount(searchResponse, 6L); } @@ -93,14 +94,14 @@ public class SimpleSearchIT extends ESIntegTestCase { .startObject("from").field("type", "ip").endObject() .startObject("to").field("type", "ip").endObject() .endObject().endObject().endObject()) - .execute().actionGet(); + .get(); client().prepareIndex("test", "type1", "1").setSource("from", "192.168.0.5", "to", "192.168.0.10").setRefreshPolicy(IMMEDIATE) .get(); SearchResponse search = client().prepareSearch() .setQuery(boolQuery().must(rangeQuery("from").lte("192.168.0.7")).must(rangeQuery("to").gte("192.168.0.7"))) - .execute().actionGet(); + .get(); assertHitCount(search, 1L); } @@ -112,64 +113,64 @@ public class SimpleSearchIT extends ESIntegTestCase { .setSource(XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties") .startObject("ip").field("type", "ip").endObject() .endObject().endObject().endObject()) - .execute().actionGet(); + .get(); ensureGreen(); - client().prepareIndex("test", "type1", "1").setSource("ip", "192.168.0.1").execute().actionGet(); - client().prepareIndex("test", "type1", "2").setSource("ip", "192.168.0.2").execute().actionGet(); - client().prepareIndex("test", "type1", "3").setSource("ip", "192.168.0.3").execute().actionGet(); - client().prepareIndex("test", "type1", "4").setSource("ip", "192.168.1.4").execute().actionGet(); - client().prepareIndex("test", "type1", "5").setSource("ip", "2001:db8::ff00:42:8329").execute().actionGet(); + client().prepareIndex("test", "type1", "1").setSource("ip", "192.168.0.1").get(); + client().prepareIndex("test", "type1", "2").setSource("ip", "192.168.0.2").get(); + client().prepareIndex("test", "type1", "3").setSource("ip", "192.168.0.3").get(); + client().prepareIndex("test", "type1", "4").setSource("ip", "192.168.1.4").get(); + client().prepareIndex("test", "type1", "5").setSource("ip", "2001:db8::ff00:42:8329").get(); refresh(); SearchResponse search = client().prepareSearch() .setQuery(boolQuery().must(QueryBuilders.termQuery("ip", "192.168.0.1"))) - .execute().actionGet(); + .get(); assertHitCount(search, 1L); search = client().prepareSearch() .setQuery(queryStringQuery("ip: 192.168.0.1")) - .execute().actionGet(); + .get(); assertHitCount(search, 1L); search = client().prepareSearch() .setQuery(boolQuery().must(QueryBuilders.termQuery("ip", "192.168.0.1/32"))) - .execute().actionGet(); + .get(); assertHitCount(search, 1L); search = client().prepareSearch() .setQuery(boolQuery().must(QueryBuilders.termQuery("ip", "192.168.0.0/24"))) - .execute().actionGet(); + .get(); assertHitCount(search, 3L); search = client().prepareSearch() .setQuery(boolQuery().must(QueryBuilders.termQuery("ip", "192.0.0.0/8"))) - .execute().actionGet(); + .get(); assertHitCount(search, 4L); search = client().prepareSearch() .setQuery(boolQuery().must(QueryBuilders.termQuery("ip", "0.0.0.0/0"))) - .execute().actionGet(); + .get(); assertHitCount(search, 4L); search = client().prepareSearch() .setQuery(boolQuery().must(QueryBuilders.termQuery("ip", "2001:db8::ff00:42:8329/128"))) - .execute().actionGet(); + .get(); assertHitCount(search, 1L); search = client().prepareSearch() .setQuery(boolQuery().must(QueryBuilders.termQuery("ip", "2001:db8::/64"))) - .execute().actionGet(); + .get(); assertHitCount(search, 1L); search = client().prepareSearch() .setQuery(boolQuery().must(QueryBuilders.termQuery("ip", "::/0"))) - .execute().actionGet(); + .get(); assertHitCount(search, 5L); search = client().prepareSearch() .setQuery(boolQuery().must(QueryBuilders.termQuery("ip", "192.168.1.5/32"))) - .execute().actionGet(); + .get(); assertHitCount(search, 0L); assertFailures(client().prepareSearch().setQuery(boolQuery().must(QueryBuilders.termQuery("ip", "0/0/0/0/0"))), @@ -182,36 +183,41 @@ public class SimpleSearchIT extends ESIntegTestCase { client().prepareIndex("test", "type", "XXX1").setSource("field", "value").setRefreshPolicy(IMMEDIATE).get(); // id is not indexed, but lets see that we automatically convert to - SearchResponse searchResponse = client().prepareSearch().setQuery(QueryBuilders.termQuery("_id", "XXX1")).execute().actionGet(); + SearchResponse searchResponse = client().prepareSearch().setQuery(QueryBuilders.termQuery("_id", "XXX1")).get(); assertHitCount(searchResponse, 1L); - searchResponse = client().prepareSearch().setQuery(QueryBuilders.queryStringQuery("_id:XXX1")).execute().actionGet(); + searchResponse = client().prepareSearch().setQuery(QueryBuilders.queryStringQuery("_id:XXX1")).get(); assertHitCount(searchResponse, 1L); } public void testSimpleDateRange() throws Exception { createIndex("test"); - client().prepareIndex("test", "type1", "1").setSource("field", "2010-01-05T02:00").execute().actionGet(); - client().prepareIndex("test", "type1", "2").setSource("field", "2010-01-06T02:00").execute().actionGet(); + client().prepareIndex("test", "type1", "1").setSource("field", "2010-01-05T02:00").get(); + client().prepareIndex("test", "type1", "2").setSource("field", "2010-01-06T02:00").get(); ensureGreen(); refresh(); - SearchResponse searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte("2010-01-03||+2d").lte("2010-01-04||+2d/d")).execute().actionGet(); + SearchResponse searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte("2010-01-03||+2d") + .lte("2010-01-04||+2d/d")).get(); assertNoFailures(searchResponse); assertHitCount(searchResponse, 2L); - searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte("2010-01-05T02:00").lte("2010-01-06T02:00")).execute().actionGet(); + searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte("2010-01-05T02:00") + .lte("2010-01-06T02:00")).get(); assertNoFailures(searchResponse); assertHitCount(searchResponse, 2L); - searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte("2010-01-05T02:00").lt("2010-01-06T02:00")).execute().actionGet(); + searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte("2010-01-05T02:00") + .lt("2010-01-06T02:00")).get(); assertNoFailures(searchResponse); assertHitCount(searchResponse, 1L); - searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gt("2010-01-05T02:00").lt("2010-01-06T02:00")).execute().actionGet(); + searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gt("2010-01-05T02:00") + .lt("2010-01-06T02:00")).get(); assertNoFailures(searchResponse); assertHitCount(searchResponse, 0L); - searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.queryStringQuery("field:[2010-01-03||+2d TO 2010-01-04||+2d/d]")).execute().actionGet(); + searchResponse = client().prepareSearch("test").setQuery( + QueryBuilders.queryStringQuery("field:[2010-01-03||+2d TO 2010-01-04||+2d/d]")).get(); assertHitCount(searchResponse, 2L); } @@ -234,14 +240,14 @@ public class SimpleSearchIT extends ESIntegTestCase { for (int i = 1; i < max; i++) { searchResponse = client().prepareSearch("test") .setQuery(QueryBuilders.rangeQuery("field").gte(1).lte(max)) - .setTerminateAfter(i).execute().actionGet(); + .setTerminateAfter(i).get(); assertHitCount(searchResponse, i); assertTrue(searchResponse.isTerminatedEarly()); } searchResponse = client().prepareSearch("test") .setQuery(QueryBuilders.rangeQuery("field").gte(1).lte(max)) - .setTerminateAfter(2 * max).execute().actionGet(); + .setTerminateAfter(2 * max).get(); assertHitCount(searchResponse, max); assertNull(searchResponse.isTerminatedEarly()); diff --git a/server/src/test/java/org/elasticsearch/search/sort/FieldSortIT.java b/server/src/test/java/org/elasticsearch/search/sort/FieldSortIT.java index ae3100e1231..36e22626383 100644 --- a/server/src/test/java/org/elasticsearch/search/sort/FieldSortIT.java +++ b/server/src/test/java/org/elasticsearch/search/sort/FieldSortIT.java @@ -224,7 +224,7 @@ public class FieldSortIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort("svalue", SortOrder.ASC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getMaxScore(), equalTo(Float.NaN)); for (SearchHit hit : searchResponse.getHits()) { @@ -236,7 +236,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .addSort("svalue", SortOrder.ASC) .setTrackScores(true) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getMaxScore(), not(equalTo(Float.NaN))); for (SearchHit hit : searchResponse.getHits()) { @@ -286,7 +286,7 @@ public class FieldSortIT extends ESIntegTestCase { { int size = between(1, denseBytes.size()); SearchResponse searchResponse = client().prepareSearch("test").setQuery(matchAllQuery()).setSize(size) - .addSort("dense_bytes", SortOrder.ASC).execute().actionGet(); + .addSort("dense_bytes", SortOrder.ASC).get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo((long) numDocs)); assertThat(searchResponse.getHits().getHits().length, equalTo(size)); @@ -302,8 +302,7 @@ public class FieldSortIT extends ESIntegTestCase { if (!sparseBytes.isEmpty()) { int size = between(1, sparseBytes.size()); SearchResponse searchResponse = client().prepareSearch().setQuery(matchAllQuery()) - .setPostFilter(QueryBuilders.existsQuery("sparse_bytes")).setSize(size).addSort("sparse_bytes", SortOrder.ASC).execute() - .actionGet(); + .setPostFilter(QueryBuilders.existsQuery("sparse_bytes")).setSize(size).addSort("sparse_bytes", SortOrder.ASC).get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo((long) sparseBytes.size())); assertThat(searchResponse.getHits().getHits().length, equalTo(size)); @@ -324,30 +323,30 @@ public class FieldSortIT extends ESIntegTestCase { ensureGreen(); for (int i = 1; i < 101; i++) { - client().prepareIndex("test", "type", Integer.toString(i)).setSource("field", Integer.toString(i)).execute().actionGet(); + client().prepareIndex("test", "type", Integer.toString(i)).setSource("field", Integer.toString(i)).get(); } refresh(); SearchResponse searchResponse = client().prepareSearch("test").setQuery(matchAllQuery()) - .addSort(SortBuilders.fieldSort("field").order(SortOrder.ASC)).execute().actionGet(); + .addSort(SortBuilders.fieldSort("field").order(SortOrder.ASC)).get(); assertThat(searchResponse.getHits().getAt(0).getSortValues()[0].toString(), equalTo("1")); assertThat(searchResponse.getHits().getAt(1).getSortValues()[0].toString(), equalTo("10")); assertThat(searchResponse.getHits().getAt(2).getSortValues()[0].toString(), equalTo("100")); // reindex and refresh - client().prepareIndex("test", "type", Integer.toString(1)).setSource("field", Integer.toString(1)).execute().actionGet(); + client().prepareIndex("test", "type", Integer.toString(1)).setSource("field", Integer.toString(1)).get(); refresh(); searchResponse = client().prepareSearch("test").setQuery(matchAllQuery()) - .addSort(SortBuilders.fieldSort("field").order(SortOrder.ASC)).execute().actionGet(); + .addSort(SortBuilders.fieldSort("field").order(SortOrder.ASC)).get(); assertThat(searchResponse.getHits().getAt(0).getSortValues()[0].toString(), equalTo("1")); assertThat(searchResponse.getHits().getAt(1).getSortValues()[0].toString(), equalTo("10")); assertThat(searchResponse.getHits().getAt(2).getSortValues()[0].toString(), equalTo("100")); // reindex - no refresh - client().prepareIndex("test", "type", Integer.toString(1)).setSource("field", Integer.toString(1)).execute().actionGet(); + client().prepareIndex("test", "type", Integer.toString(1)).setSource("field", Integer.toString(1)).get(); searchResponse = client().prepareSearch("test").setQuery(matchAllQuery()) - .addSort(SortBuilders.fieldSort("field").order(SortOrder.ASC)).execute().actionGet(); + .addSort(SortBuilders.fieldSort("field").order(SortOrder.ASC)).get(); assertThat(searchResponse.getHits().getAt(0).getSortValues()[0].toString(), equalTo("1")); assertThat(searchResponse.getHits().getAt(1).getSortValues()[0].toString(), equalTo("10")); assertThat(searchResponse.getHits().getAt(2).getSortValues()[0].toString(), equalTo("100")); @@ -356,16 +355,16 @@ public class FieldSortIT extends ESIntegTestCase { forceMerge(); refresh(); - client().prepareIndex("test", "type", Integer.toString(1)).setSource("field", Integer.toString(1)).execute().actionGet(); + client().prepareIndex("test", "type", Integer.toString(1)).setSource("field", Integer.toString(1)).get(); searchResponse = client().prepareSearch("test").setQuery(matchAllQuery()) - .addSort(SortBuilders.fieldSort("field").order(SortOrder.ASC)).execute().actionGet(); + .addSort(SortBuilders.fieldSort("field").order(SortOrder.ASC)).get(); assertThat(searchResponse.getHits().getAt(0).getSortValues()[0].toString(), equalTo("1")); assertThat(searchResponse.getHits().getAt(1).getSortValues()[0].toString(), equalTo("10")); assertThat(searchResponse.getHits().getAt(2).getSortValues()[0].toString(), equalTo("100")); refresh(); searchResponse = client().prepareSearch("test").setQuery(matchAllQuery()) - .addSort(SortBuilders.fieldSort("field").order(SortOrder.ASC)).execute().actionGet(); + .addSort(SortBuilders.fieldSort("field").order(SortOrder.ASC)).get(); assertThat(searchResponse.getHits().getAt(0).getSortValues()[0].toString(), equalTo("1")); assertThat(searchResponse.getHits().getAt(1).getSortValues()[0].toString(), equalTo("10")); assertThat(searchResponse.getHits().getAt(2).getSortValues()[0].toString(), equalTo("100")); @@ -375,9 +374,9 @@ public class FieldSortIT extends ESIntegTestCase { createIndex("test"); ensureGreen(); - client().prepareIndex("test", "type", "1").setSource("field", 2).execute().actionGet(); - client().prepareIndex("test", "type", "2").setSource("field", 1).execute().actionGet(); - client().prepareIndex("test", "type", "3").setSource("field", 0).execute().actionGet(); + client().prepareIndex("test", "type", "1").setSource("field", 2).get(); + client().prepareIndex("test", "type", "2").setSource("field", 1).get(); + client().prepareIndex("test", "type", "3").setSource("field", 0).get(); refresh(); @@ -385,7 +384,7 @@ public class FieldSortIT extends ESIntegTestCase { .prepareSearch("test") .setQuery( QueryBuilders.functionScoreQuery(matchAllQuery(), ScoreFunctionBuilders.fieldValueFactorFunction("field"))) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1")); assertThat(searchResponse.getHits().getAt(1).getScore(), Matchers.lessThan(searchResponse.getHits().getAt(0).getScore())); assertThat(searchResponse.getHits().getAt(1).getId(), equalTo("2")); @@ -396,7 +395,7 @@ public class FieldSortIT extends ESIntegTestCase { .prepareSearch("test") .setQuery( QueryBuilders.functionScoreQuery(matchAllQuery(), ScoreFunctionBuilders.fieldValueFactorFunction("field"))) - .addSort("_score", SortOrder.DESC).execute().actionGet(); + .addSort("_score", SortOrder.DESC).get(); assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1")); assertThat(searchResponse.getHits().getAt(1).getScore(), Matchers.lessThan(searchResponse.getHits().getAt(0).getScore())); assertThat(searchResponse.getHits().getAt(1).getId(), equalTo("2")); @@ -407,7 +406,7 @@ public class FieldSortIT extends ESIntegTestCase { .prepareSearch("test") .setQuery( QueryBuilders.functionScoreQuery(matchAllQuery(), ScoreFunctionBuilders.fieldValueFactorFunction("field"))) - .addSort("_score", SortOrder.DESC).execute().actionGet(); + .addSort("_score", SortOrder.DESC).get(); assertThat(searchResponse.getHits().getAt(2).getId(), equalTo("3")); assertThat(searchResponse.getHits().getAt(1).getId(), equalTo("2")); assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1")); @@ -417,14 +416,14 @@ public class FieldSortIT extends ESIntegTestCase { createIndex("test"); ensureGreen(); - client().prepareIndex("test", "type", "1").setSource("field", 2).execute().actionGet(); - client().prepareIndex("test", "type", "2").setSource("field", 1).execute().actionGet(); - client().prepareIndex("test", "type", "3").setSource("field", 0).execute().actionGet(); + client().prepareIndex("test", "type", "1").setSource("field", 2).get(); + client().prepareIndex("test", "type", "2").setSource("field", 1).get(); + client().prepareIndex("test", "type", "3").setSource("field", 0).get(); refresh(); SearchResponse searchResponse = client().prepareSearch("test") - .setQuery(functionScoreQuery(matchAllQuery(), fieldValueFactorFunction("field"))).execute().actionGet(); + .setQuery(functionScoreQuery(matchAllQuery(), fieldValueFactorFunction("field"))).get(); assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1")); assertThat(searchResponse.getHits().getAt(1).getScore(), Matchers.lessThan(searchResponse.getHits().getAt(0).getScore())); assertThat(searchResponse.getHits().getAt(1).getId(), equalTo("2")); @@ -433,7 +432,7 @@ public class FieldSortIT extends ESIntegTestCase { searchResponse = client().prepareSearch("test") .setQuery(functionScoreQuery(matchAllQuery(), fieldValueFactorFunction("field"))) - .addSort("_score", SortOrder.DESC).execute().actionGet(); + .addSort("_score", SortOrder.DESC).get(); assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1")); assertThat(searchResponse.getHits().getAt(1).getScore(), Matchers.lessThan(searchResponse.getHits().getAt(0).getScore())); assertThat(searchResponse.getHits().getAt(1).getId(), equalTo("2")); @@ -442,7 +441,7 @@ public class FieldSortIT extends ESIntegTestCase { searchResponse = client().prepareSearch("test") .setQuery(functionScoreQuery(matchAllQuery(), fieldValueFactorFunction("field"))) - .addSort("_score", SortOrder.DESC).execute().actionGet(); + .addSort("_score", SortOrder.DESC).get(); assertThat(searchResponse.getHits().getAt(2).getId(), equalTo("3")); assertThat(searchResponse.getHits().getAt(1).getId(), equalTo("2")); assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1")); @@ -452,12 +451,12 @@ public class FieldSortIT extends ESIntegTestCase { assertAcked(client().admin().indices().prepareCreate("test") .addMapping("post", "field1", "type=keyword").get()); - client().prepareIndex("test", "post", "1").setSource("{\"field1\":\"value1\"}", XContentType.JSON).execute().actionGet(); - client().prepareIndex("test", "post", "2").setSource("{\"field1\":\"value2\"}", XContentType.JSON).execute().actionGet(); - client().prepareIndex("test", "post", "3").setSource("{\"field1\":\"value3\"}", XContentType.JSON).execute().actionGet(); + client().prepareIndex("test", "post", "1").setSource("{\"field1\":\"value1\"}", XContentType.JSON).get(); + client().prepareIndex("test", "post", "2").setSource("{\"field1\":\"value2\"}", XContentType.JSON).get(); + client().prepareIndex("test", "post", "3").setSource("{\"field1\":\"value3\"}", XContentType.JSON).get(); refresh(); SearchResponse result = client().prepareSearch("test").setQuery(matchAllQuery()).setTrackScores(true) - .addSort("field1", SortOrder.ASC).execute().actionGet(); + .addSort("field1", SortOrder.ASC).get(); for (SearchHit hit : result.getHits()) { assertFalse(Float.isNaN(hit.getScore())); @@ -467,34 +466,34 @@ public class FieldSortIT extends ESIntegTestCase { public void testIssue2991() { for (int i = 1; i < 4; i++) { try { - client().admin().indices().prepareDelete("test").execute().actionGet(); + client().admin().indices().prepareDelete("test").get(); } catch (Exception e) { // ignore } assertAcked(client().admin().indices().prepareCreate("test") .addMapping("type", "tag", "type=keyword").get()); ensureGreen(); - client().prepareIndex("test", "type", "1").setSource("tag", "alpha").execute().actionGet(); + client().prepareIndex("test", "type", "1").setSource("tag", "alpha").get(); refresh(); - client().prepareIndex("test", "type", "3").setSource("tag", "gamma").execute().actionGet(); + client().prepareIndex("test", "type", "3").setSource("tag", "gamma").get(); refresh(); - client().prepareIndex("test", "type", "4").setSource("tag", "delta").execute().actionGet(); + client().prepareIndex("test", "type", "4").setSource("tag", "delta").get(); refresh(); - client().prepareIndex("test", "type", "2").setSource("tag", "beta").execute().actionGet(); + client().prepareIndex("test", "type", "2").setSource("tag", "beta").get(); refresh(); SearchResponse resp = client().prepareSearch("test").setSize(2).setQuery(matchAllQuery()) - .addSort(SortBuilders.fieldSort("tag").order(SortOrder.ASC)).execute().actionGet(); + .addSort(SortBuilders.fieldSort("tag").order(SortOrder.ASC)).get(); assertHitCount(resp, 4); assertThat(resp.getHits().getHits().length, equalTo(2)); assertFirstHit(resp, hasId("1")); assertSecondHit(resp, hasId("2")); resp = client().prepareSearch("test").setSize(2).setQuery(matchAllQuery()) - .addSort(SortBuilders.fieldSort("tag").order(SortOrder.DESC)).execute().actionGet(); + .addSort(SortBuilders.fieldSort("tag").order(SortOrder.DESC)).get(); assertHitCount(resp, 4); assertThat(resp.getHits().getHits().length, equalTo(2)); assertFirstHit(resp, hasId("3")); @@ -529,12 +528,12 @@ public class FieldSortIT extends ESIntegTestCase { } Collections.shuffle(builders, random); for (IndexRequestBuilder builder : builders) { - builder.execute().actionGet(); + builder.get(); if (random.nextBoolean()) { if (random.nextInt(5) != 0) { refresh(); } else { - client().admin().indices().prepareFlush().execute().actionGet(); + client().admin().indices().prepareFlush().get(); } } @@ -548,7 +547,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(size) .addSort("str_value", SortOrder.ASC) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); assertThat(searchResponse.getHits().getHits().length, equalTo(size)); for (int i = 0; i < size; i++) { @@ -561,7 +560,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(size) .addSort("str_value", SortOrder.DESC) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); assertThat(searchResponse.getHits().getHits().length, equalTo(size)); @@ -576,8 +575,7 @@ public class FieldSortIT extends ESIntegTestCase { // BYTE size = 1 + random.nextInt(10); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("byte_value", SortOrder.ASC).execute() - .actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("byte_value", SortOrder.ASC).get(); assertHitCount(searchResponse, 10); assertThat(searchResponse.getHits().getHits().length, equalTo(size)); @@ -586,8 +584,7 @@ public class FieldSortIT extends ESIntegTestCase { assertThat(((Number) searchResponse.getHits().getAt(i).getSortValues()[0]).byteValue(), equalTo((byte) i)); } size = 1 + random.nextInt(10); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("byte_value", SortOrder.DESC).execute() - .actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("byte_value", SortOrder.DESC).get(); assertHitCount(searchResponse, 10); assertThat(searchResponse.getHits().getHits().length, equalTo(size)); @@ -600,8 +597,7 @@ public class FieldSortIT extends ESIntegTestCase { // SHORT size = 1 + random.nextInt(10); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("short_value", SortOrder.ASC).execute() - .actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("short_value", SortOrder.ASC).get(); assertHitCount(searchResponse, 10); assertThat(searchResponse.getHits().getHits().length, equalTo(size)); @@ -610,8 +606,7 @@ public class FieldSortIT extends ESIntegTestCase { assertThat(((Number) searchResponse.getHits().getAt(i).getSortValues()[0]).shortValue(), equalTo((short) i)); } size = 1 + random.nextInt(10); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("short_value", SortOrder.DESC).execute() - .actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("short_value", SortOrder.DESC).get(); assertHitCount(searchResponse, 10); assertThat(searchResponse.getHits().getHits().length, equalTo(size)); @@ -624,8 +619,7 @@ public class FieldSortIT extends ESIntegTestCase { // INTEGER size = 1 + random.nextInt(10); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("integer_value", SortOrder.ASC).execute() - .actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("integer_value", SortOrder.ASC).get(); assertHitCount(searchResponse, 10); assertThat(searchResponse.getHits().getHits().length, equalTo(size)); @@ -637,7 +631,7 @@ public class FieldSortIT extends ESIntegTestCase { assertThat(searchResponse.toString(), not(containsString("error"))); size = 1 + random.nextInt(10); searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("integer_value", SortOrder.DESC) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 10); assertThat(searchResponse.getHits().getHits().length, equalTo(size)); @@ -650,8 +644,7 @@ public class FieldSortIT extends ESIntegTestCase { // LONG size = 1 + random.nextInt(10); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("long_value", SortOrder.ASC).execute() - .actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("long_value", SortOrder.ASC).get(); assertHitCount(searchResponse, 10); assertThat(searchResponse.getHits().getHits().length, equalTo(size)); @@ -662,8 +655,7 @@ public class FieldSortIT extends ESIntegTestCase { assertThat(searchResponse.toString(), not(containsString("error"))); size = 1 + random.nextInt(10); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("long_value", SortOrder.DESC).execute() - .actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("long_value", SortOrder.DESC).get(); assertHitCount(searchResponse, 10L); assertHitCount(searchResponse, 10); assertThat(searchResponse.getHits().getHits().length, equalTo(size)); @@ -676,8 +668,7 @@ public class FieldSortIT extends ESIntegTestCase { // FLOAT size = 1 + random.nextInt(10); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("float_value", SortOrder.ASC).execute() - .actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("float_value", SortOrder.ASC).get(); assertHitCount(searchResponse, 10L); assertThat(searchResponse.getHits().getHits().length, equalTo(size)); @@ -688,8 +679,7 @@ public class FieldSortIT extends ESIntegTestCase { assertThat(searchResponse.toString(), not(containsString("error"))); size = 1 + random.nextInt(10); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("float_value", SortOrder.DESC).execute() - .actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("float_value", SortOrder.DESC).get(); assertHitCount(searchResponse, 10); assertThat(searchResponse.getHits().getHits().length, equalTo(size)); @@ -702,8 +692,7 @@ public class FieldSortIT extends ESIntegTestCase { // DOUBLE size = 1 + random.nextInt(10); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("double_value", SortOrder.ASC).execute() - .actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("double_value", SortOrder.ASC).get(); assertHitCount(searchResponse, 10L); assertThat(searchResponse.getHits().getHits().length, equalTo(size)); @@ -714,8 +703,7 @@ public class FieldSortIT extends ESIntegTestCase { assertThat(searchResponse.toString(), not(containsString("error"))); size = 1 + random.nextInt(10); - searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("double_value", SortOrder.DESC).execute() - .actionGet(); + searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(size).addSort("double_value", SortOrder.DESC).get(); assertHitCount(searchResponse, 10L); assertThat(searchResponse.getHits().getHits().length, equalTo(size)); @@ -747,17 +735,17 @@ public class FieldSortIT extends ESIntegTestCase { .field("id", "1") .field("i_value", -1) .field("d_value", -1.1) - .endObject()).execute().actionGet(); + .endObject()).get(); client().prepareIndex("test", "type1", "2").setSource(jsonBuilder().startObject() .field("id", "2") - .endObject()).execute().actionGet(); + .endObject()).get(); client().prepareIndex("test", "type1", "3").setSource(jsonBuilder().startObject() .field("id", "1") .field("i_value", 2) .field("d_value", 2.2) - .endObject()).execute().actionGet(); + .endObject()).get(); flush(); refresh(); @@ -766,7 +754,7 @@ public class FieldSortIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(SortBuilders.fieldSort("i_value").order(SortOrder.ASC)) - .execute().actionGet(); + .get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); @@ -778,7 +766,7 @@ public class FieldSortIT extends ESIntegTestCase { searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(SortBuilders.fieldSort("i_value").order(SortOrder.ASC).missing("_last")) - .execute().actionGet(); + .get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); @@ -790,7 +778,7 @@ public class FieldSortIT extends ESIntegTestCase { searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(SortBuilders.fieldSort("i_value").order(SortOrder.ASC).missing("_first")) - .execute().actionGet(); + .get(); assertNoFailures(searchResponse); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); @@ -815,16 +803,16 @@ public class FieldSortIT extends ESIntegTestCase { client().prepareIndex("test", "type1", "1").setSource(jsonBuilder().startObject() .field("id", "1") .field("value", "a") - .endObject()).execute().actionGet(); + .endObject()).get(); client().prepareIndex("test", "type1", "2").setSource(jsonBuilder().startObject() .field("id", "2") - .endObject()).execute().actionGet(); + .endObject()).get(); client().prepareIndex("test", "type1", "3").setSource(jsonBuilder().startObject() .field("id", "1") .field("value", "c") - .endObject()).execute().actionGet(); + .endObject()).get(); flush(); refresh(); @@ -840,7 +828,7 @@ public class FieldSortIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(SortBuilders.fieldSort("value").order(SortOrder.ASC)) - .execute().actionGet(); + .get(); assertThat(Arrays.toString(searchResponse.getShardFailures()), searchResponse.getFailedShards(), equalTo(0)); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); @@ -852,7 +840,7 @@ public class FieldSortIT extends ESIntegTestCase { searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(SortBuilders.fieldSort("value").order(SortOrder.ASC).missing("_last")) - .execute().actionGet(); + .get(); assertThat(Arrays.toString(searchResponse.getShardFailures()), searchResponse.getFailedShards(), equalTo(0)); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); @@ -864,7 +852,7 @@ public class FieldSortIT extends ESIntegTestCase { searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(SortBuilders.fieldSort("value").order(SortOrder.ASC).missing("_first")) - .execute().actionGet(); + .get(); assertThat(Arrays.toString(searchResponse.getShardFailures()), searchResponse.getFailedShards(), equalTo(0)); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); @@ -876,7 +864,7 @@ public class FieldSortIT extends ESIntegTestCase { searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(SortBuilders.fieldSort("value").order(SortOrder.ASC).missing("b")) - .execute().actionGet(); + .get(); assertThat(Arrays.toString(searchResponse.getShardFailures()), searchResponse.getFailedShards(), equalTo(0)); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); @@ -892,14 +880,14 @@ public class FieldSortIT extends ESIntegTestCase { .field("id", "1") .field("i_value", -1) .field("d_value", -1.1) - .endObject()).execute().actionGet(); + .endObject()).get(); logger.info("--> sort with an unmapped field, verify it fails"); try { SearchResponse result = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(SortBuilders.fieldSort("kkk")) - .execute().actionGet(); + .get(); assertThat("Expected exception but returned with", result, nullValue()); } catch (SearchPhaseExecutionException e) { //we check that it's a parse failure rather than a different shard failure @@ -911,7 +899,7 @@ public class FieldSortIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(SortBuilders.fieldSort("kkk").unmappedType("keyword")) - .execute().actionGet(); + .get(); assertNoFailures(searchResponse); } @@ -935,7 +923,7 @@ public class FieldSortIT extends ESIntegTestCase { .array("float_values", 1f, 5f, 10f, 8f) .array("double_values", 1d, 5d, 10d, 8d) .array("string_values", "01", "05", "10", "08") - .endObject()).execute().actionGet(); + .endObject()).get(); client().prepareIndex("test", "type1", Integer.toString(2)).setSource(jsonBuilder().startObject() .array("long_values", 11L, 15L, 20L, 7L) .array("int_values", 11, 15, 20, 7) @@ -944,7 +932,7 @@ public class FieldSortIT extends ESIntegTestCase { .array("float_values", 11f, 15f, 20f, 7f) .array("double_values", 11d, 15d, 20d, 7d) .array("string_values", "11", "15", "20", "07") - .endObject()).execute().actionGet(); + .endObject()).get(); client().prepareIndex("test", "type1", Integer.toString(3)).setSource(jsonBuilder().startObject() .array("long_values", 2L, 1L, 3L, -4L) .array("int_values", 2, 1, 3, -4) @@ -953,7 +941,7 @@ public class FieldSortIT extends ESIntegTestCase { .array("float_values", 2f, 1f, 3f, -4f) .array("double_values", 2d, 1d, 3d, -4d) .array("string_values", "02", "01", "03", "!4") - .endObject()).execute().actionGet(); + .endObject()).get(); refresh(); @@ -961,7 +949,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(10) .addSort("long_values", SortOrder.ASC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -979,7 +967,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(10) .addSort("long_values", SortOrder.DESC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -997,7 +985,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(10) .addSort(SortBuilders.fieldSort("long_values").order(SortOrder.DESC).sortMode(SortMode.SUM)) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1015,7 +1003,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(10) .addSort(SortBuilders.fieldSort("long_values").order(SortOrder.DESC).sortMode(SortMode.AVG)) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1033,7 +1021,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(10) .addSort(SortBuilders.fieldSort("long_values").order(SortOrder.DESC).sortMode(SortMode.MEDIAN)) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1051,7 +1039,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(10) .addSort("int_values", SortOrder.ASC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1069,7 +1057,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(10) .addSort("int_values", SortOrder.DESC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1087,7 +1075,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(10) .addSort("short_values", SortOrder.ASC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1105,7 +1093,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(10) .addSort("short_values", SortOrder.DESC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1123,7 +1111,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(10) .addSort("byte_values", SortOrder.ASC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1141,7 +1129,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(10) .addSort("byte_values", SortOrder.DESC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1159,7 +1147,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(10) .addSort("float_values", SortOrder.ASC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1177,7 +1165,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(10) .addSort("float_values", SortOrder.DESC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1195,7 +1183,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(10) .addSort("double_values", SortOrder.ASC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1213,7 +1201,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(10) .addSort("double_values", SortOrder.DESC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1231,7 +1219,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(10) .addSort("string_values", SortOrder.ASC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1249,7 +1237,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(10) .addSort("string_values", SortOrder.DESC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(3L)); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1271,7 +1259,7 @@ public class FieldSortIT extends ESIntegTestCase { ensureGreen(); client().prepareIndex("test", "type1", Integer.toString(1)).setSource(jsonBuilder().startObject() .array("string_values", "01", "05", "10", "08") - .endObject()).execute().actionGet(); + .endObject()).get(); refresh(); @@ -1279,7 +1267,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(3) .addSort("string_values", SortOrder.DESC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getHits().length, equalTo(1)); @@ -1289,11 +1277,11 @@ public class FieldSortIT extends ESIntegTestCase { client().prepareIndex("test", "type1", Integer.toString(2)).setSource(jsonBuilder().startObject() .array("string_values", "11", "15", "20", "07") - .endObject()).execute().actionGet(); + .endObject()).get(); for (int i = 0; i < 15; i++) { client().prepareIndex("test", "type1", Integer.toString(300 + i)).setSource(jsonBuilder().startObject() .array("some_other_field", "foobar") - .endObject()).execute().actionGet(); + .endObject()).get(); } refresh(); @@ -1301,7 +1289,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(2) .addSort("string_values", SortOrder.DESC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getHits().length, equalTo(2)); @@ -1314,11 +1302,11 @@ public class FieldSortIT extends ESIntegTestCase { client().prepareIndex("test", "type1", Integer.toString(3)).setSource(jsonBuilder().startObject() .array("string_values", "02", "01", "03", "!4") - .endObject()).execute().actionGet(); + .endObject()).get(); for (int i = 0; i < 15; i++) { client().prepareIndex("test", "type1", Integer.toString(300 + i)).setSource(jsonBuilder().startObject() .array("some_other_field", "foobar") - .endObject()).execute().actionGet(); + .endObject()).get(); } refresh(); @@ -1326,7 +1314,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(3) .addSort("string_values", SortOrder.DESC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1342,7 +1330,7 @@ public class FieldSortIT extends ESIntegTestCase { for (int i = 0; i < 15; i++) { client().prepareIndex("test", "type1", Integer.toString(300 + i)).setSource(jsonBuilder().startObject() .array("some_other_field", "foobar") - .endObject()).execute().actionGet(); + .endObject()).get(); refresh(); } @@ -1350,7 +1338,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(3) .addSort("string_values", SortOrder.DESC) - .execute().actionGet(); + .get(); assertThat(searchResponse.getHits().getHits().length, equalTo(3)); @@ -1380,7 +1368,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(randomIntBetween(1, numDocs + 5)) .addSort("_id", order) - .execute().actionGet(); + .get(); assertNoFailures(searchResponse); SearchHit[] hits = searchResponse.getHits().getHits(); BytesRef previous = order == SortOrder.ASC ? new BytesRef() : UnicodeUtil.BIG_TERM; @@ -1427,20 +1415,20 @@ public class FieldSortIT extends ESIntegTestCase { .startObject().field("foo", "bar bar").endObject() .startObject().field("foo", "abc abc").endObject() .endArray() - .endObject()).execute().actionGet(); + .endObject()).get(); client().prepareIndex("test", "type", "2").setSource(jsonBuilder().startObject() .startArray("nested") .startObject().field("foo", "abc abc").endObject() .startObject().field("foo", "cba bca").endObject() .endArray() - .endObject()).execute().actionGet(); + .endObject()).get(); refresh(); // We sort on nested field SearchResponse searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(SortBuilders.fieldSort("nested.foo").setNestedPath("nested").order(SortOrder.DESC)) - .execute().actionGet(); + .get(); assertNoFailures(searchResponse); SearchHit[] hits = searchResponse.getHits().getHits(); assertThat(hits.length, is(2)); @@ -1456,7 +1444,7 @@ public class FieldSortIT extends ESIntegTestCase { .fieldSort("nested.foo") .setNestedSort(new NestedSortBuilder("nested").setMaxChildren(1)) .order(SortOrder.DESC)) - .execute().actionGet(); + .get(); assertNoFailures(searchResponse); hits = searchResponse.getHits().getHits(); assertThat(hits.length, is(2)); @@ -1469,7 +1457,7 @@ public class FieldSortIT extends ESIntegTestCase { searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(SortBuilders.fieldSort("nested.foo.sub").setNestedPath("nested").order(SortOrder.DESC)) - .execute().actionGet(); + .get(); assertNoFailures(searchResponse); hits = searchResponse.getHits().getHits(); assertThat(hits.length, is(2)); @@ -1567,7 +1555,7 @@ public class FieldSortIT extends ESIntegTestCase { .setSize(randomIntBetween(1, numDocs + 5)) .addSort(SortBuilders.scriptSort(script, ScriptSortBuilder.ScriptSortType.NUMBER)) .addSort(SortBuilders.scoreSort()) - .execute().actionGet(); + .get(); double expectedValue = 0; for (SearchHit hit : searchResponse.getHits()) { @@ -1584,7 +1572,7 @@ public class FieldSortIT extends ESIntegTestCase { .setSize(randomIntBetween(1, numDocs + 5)) .addSort(SortBuilders.scriptSort(script, ScriptSortBuilder.ScriptSortType.STRING)) .addSort(SortBuilders.scoreSort()) - .execute().actionGet(); + .get(); int expectedValue = 0; for (SearchHit hit : searchResponse.getHits()) { @@ -1614,7 +1602,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(builders.size()) .addSort(SortBuilders.fieldSort("route_length_miles")) - .execute().actionGet(); + .get(); SearchHits hits = response.getHits(); assertEquals(3, hits.getHits().length); @@ -1642,7 +1630,7 @@ public class FieldSortIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(builders.size()) .addSort(SortBuilders.fieldSort("route_length_miles").missing(120.3)) - .execute().actionGet(); + .get(); SearchHits hits = response.getHits(); assertEquals(3, hits.getHits().length); diff --git a/server/src/test/java/org/elasticsearch/search/sort/GeoDistanceIT.java b/server/src/test/java/org/elasticsearch/search/sort/GeoDistanceIT.java index 6925e80ca27..f9e9dab70b2 100644 --- a/server/src/test/java/org/elasticsearch/search/sort/GeoDistanceIT.java +++ b/server/src/test/java/org/elasticsearch/search/sort/GeoDistanceIT.java @@ -65,11 +65,10 @@ public class GeoDistanceIT extends ESIntegTestCase { ensureGreen(); client().prepareIndex("test", "type1", "1").setSource(jsonBuilder().startObject().field("names", "New York") - .startObject("locations").field("lat", 40.7143528).field("lon", -74.0059731).endObject().endObject()).execute().actionGet(); + .startObject("locations").field("lat", 40.7143528).field("lon", -74.0059731).endObject().endObject()).get(); client().prepareIndex("test", "type1", "2").setSource(jsonBuilder().startObject().field("names", "New York 2") - .startObject("locations").field("lat", 400.7143528).field("lon", 285.9990269).endObject().endObject()).execute() - .actionGet(); + .startObject("locations").field("lat", 400.7143528).field("lon", 285.9990269).endObject().endObject()).get(); client().prepareIndex("test", "type1", "3") .setSource(jsonBuilder().startObject().array("names", "Times Square", "Tribeca").startArray("locations") @@ -77,7 +76,7 @@ public class GeoDistanceIT extends ESIntegTestCase { .startObject().field("lat", 40.759011).field("lon", -73.9844722).endObject() // to NY: 0.4621 km .startObject().field("lat", 40.718266).field("lon", -74.007819).endObject().endArray().endObject()) - .execute().actionGet(); + .get(); client().prepareIndex("test", "type1", "4") .setSource(jsonBuilder().startObject().array("names", "Wall Street", "Soho").startArray("locations") @@ -85,7 +84,7 @@ public class GeoDistanceIT extends ESIntegTestCase { .startObject().field("lat", 40.7051157).field("lon", -74.0088305).endObject() // to NY: 1.258 km .startObject().field("lat", 40.7247222).field("lon", -74).endObject().endArray().endObject()) - .execute().actionGet(); + .get(); client().prepareIndex("test", "type1", "5") .setSource(jsonBuilder().startObject().array("names", "Greenwich Village", "Brooklyn").startArray("locations") @@ -93,14 +92,13 @@ public class GeoDistanceIT extends ESIntegTestCase { .startObject().field("lat", 40.731033).field("lon", -73.9962255).endObject() // to NY: 8.572 km .startObject().field("lat", 40.65).field("lon", -73.95).endObject().endArray().endObject()) - .execute().actionGet(); + .get(); - client().admin().indices().prepareRefresh().execute().actionGet(); + client().admin().indices().prepareRefresh().get(); // Order: Asc SearchResponse searchResponse = client().prepareSearch("test").setQuery(matchAllQuery()) - .addSort(SortBuilders.geoDistanceSort("locations", 40.7143528, -74.0059731).order(SortOrder.ASC)).execute() - .actionGet(); + .addSort(SortBuilders.geoDistanceSort("locations", 40.7143528, -74.0059731).order(SortOrder.ASC)).get(); assertHitCount(searchResponse, 5); assertOrderedSearchHits(searchResponse, "1", "2", "3", "4", "5"); @@ -113,7 +111,7 @@ public class GeoDistanceIT extends ESIntegTestCase { // Order: Asc, Mode: max searchResponse = client().prepareSearch("test").setQuery(matchAllQuery()) .addSort(SortBuilders.geoDistanceSort("locations", 40.7143528, -74.0059731).order(SortOrder.ASC).sortMode(SortMode.MAX)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 5); assertOrderedSearchHits(searchResponse, "1", "2", "4", "3", "5"); @@ -125,8 +123,7 @@ public class GeoDistanceIT extends ESIntegTestCase { // Order: Desc searchResponse = client().prepareSearch("test").setQuery(matchAllQuery()) - .addSort(SortBuilders.geoDistanceSort("locations", 40.7143528, -74.0059731).order(SortOrder.DESC)).execute() - .actionGet(); + .addSort(SortBuilders.geoDistanceSort("locations", 40.7143528, -74.0059731).order(SortOrder.DESC)).get(); assertHitCount(searchResponse, 5); assertOrderedSearchHits(searchResponse, "5", "3", "4", "2", "1"); @@ -139,7 +136,7 @@ public class GeoDistanceIT extends ESIntegTestCase { // Order: Desc, Mode: min searchResponse = client().prepareSearch("test").setQuery(matchAllQuery()) .addSort(SortBuilders.geoDistanceSort("locations", 40.7143528, -74.0059731).order(SortOrder.DESC).sortMode(SortMode.MIN)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 5); assertOrderedSearchHits(searchResponse, "5", "4", "3", "2", "1"); @@ -151,7 +148,7 @@ public class GeoDistanceIT extends ESIntegTestCase { searchResponse = client().prepareSearch("test").setQuery(matchAllQuery()) .addSort(SortBuilders.geoDistanceSort("locations", 40.7143528, -74.0059731).sortMode(SortMode.AVG).order(SortOrder.ASC)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 5); assertOrderedSearchHits(searchResponse, "1", "2", "4", "3", "5"); @@ -163,7 +160,7 @@ public class GeoDistanceIT extends ESIntegTestCase { searchResponse = client().prepareSearch("test").setQuery(matchAllQuery()) .addSort(SortBuilders.geoDistanceSort("locations", 40.7143528, -74.0059731).sortMode(SortMode.AVG).order(SortOrder.DESC)) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 5); assertOrderedSearchHits(searchResponse, "5", "3", "4", "2", "1"); @@ -200,17 +197,16 @@ public class GeoDistanceIT extends ESIntegTestCase { .startObject().field("lat", 40.759011).field("lon", -73.9844722).endObject() // to NY: 0.4621 km .startObject().field("lat", 40.718266).field("lon", -74.007819).endObject().endArray().endObject()) - .execute().actionGet(); + .get(); client().prepareIndex("test", "type1", "2").setSource(jsonBuilder().startObject().array("names", "Wall Street", "Soho").endObject()) - .execute().actionGet(); + .get(); refresh(); // Order: Asc SearchResponse searchResponse = client().prepareSearch("test").setQuery(matchAllQuery()) - .addSort(SortBuilders.geoDistanceSort("locations", 40.7143528, -74.0059731).order(SortOrder.ASC)).execute() - .actionGet(); + .addSort(SortBuilders.geoDistanceSort("locations", 40.7143528, -74.0059731).order(SortOrder.ASC)).get(); assertHitCount(searchResponse, 2); assertOrderedSearchHits(searchResponse, "1", "2"); @@ -219,8 +215,7 @@ public class GeoDistanceIT extends ESIntegTestCase { // Order: Desc searchResponse = client().prepareSearch("test").setQuery(matchAllQuery()) - .addSort(SortBuilders.geoDistanceSort("locations", 40.7143528, -74.0059731).order(SortOrder.DESC)).execute() - .actionGet(); + .addSort(SortBuilders.geoDistanceSort("locations", 40.7143528, -74.0059731).order(SortOrder.DESC)).get(); // Doc with missing geo point is first, is consistent with 0.20.x assertHitCount(searchResponse, 2); @@ -281,7 +276,7 @@ public class GeoDistanceIT extends ESIntegTestCase { // Order: Asc SearchResponse searchResponse = client().prepareSearch("companies").setQuery(matchAllQuery()).addSort(SortBuilders .geoDistanceSort("branches.location", 40.7143528, -74.0059731).order(SortOrder.ASC).setNestedPath("branches")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 4); assertOrderedSearchHits(searchResponse, "1", "2", "3", "4"); @@ -294,7 +289,7 @@ public class GeoDistanceIT extends ESIntegTestCase { searchResponse = client() .prepareSearch("companies").setQuery(matchAllQuery()).addSort(SortBuilders.geoDistanceSort("branches.location", 40.7143528, -74.0059731).order(SortOrder.ASC).sortMode(SortMode.MAX).setNestedPath("branches")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 4); assertOrderedSearchHits(searchResponse, "1", "3", "2", "4"); @@ -306,7 +301,7 @@ public class GeoDistanceIT extends ESIntegTestCase { // Order: Desc searchResponse = client().prepareSearch("companies").setQuery(matchAllQuery()).addSort(SortBuilders .geoDistanceSort("branches.location", 40.7143528, -74.0059731).order(SortOrder.DESC).setNestedPath("branches")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 4); assertOrderedSearchHits(searchResponse, "4", "2", "3", "1"); @@ -319,7 +314,7 @@ public class GeoDistanceIT extends ESIntegTestCase { searchResponse = client() .prepareSearch("companies").setQuery(matchAllQuery()).addSort(SortBuilders.geoDistanceSort("branches.location", 40.7143528, -74.0059731).order(SortOrder.DESC).sortMode(SortMode.MIN).setNestedPath("branches")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 4); assertOrderedSearchHits(searchResponse, "4", "3", "2", "1"); @@ -331,7 +326,7 @@ public class GeoDistanceIT extends ESIntegTestCase { searchResponse = client() .prepareSearch("companies").setQuery(matchAllQuery()).addSort(SortBuilders.geoDistanceSort("branches.location", 40.7143528, -74.0059731).sortMode(SortMode.AVG).order(SortOrder.ASC).setNestedPath("branches")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 4); assertOrderedSearchHits(searchResponse, "1", "3", "2", "4"); @@ -343,7 +338,7 @@ public class GeoDistanceIT extends ESIntegTestCase { searchResponse = client().prepareSearch("companies") .setQuery(matchAllQuery()).addSort(SortBuilders.geoDistanceSort("branches.location", 40.7143528, -74.0059731) .setNestedPath("branches").sortMode(SortMode.AVG).order(SortOrder.DESC).setNestedPath("branches")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 4); assertOrderedSearchHits(searchResponse, "4", "2", "3", "1"); @@ -356,7 +351,7 @@ public class GeoDistanceIT extends ESIntegTestCase { .addSort(SortBuilders.geoDistanceSort("branches.location", 40.7143528, -74.0059731) .setNestedFilter(termQuery("branches.name", "brooklyn")) .sortMode(SortMode.AVG).order(SortOrder.ASC).setNestedPath("branches")) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, 4); assertFirstHit(searchResponse, hasId("4")); assertSearchHits(searchResponse, "1", "2", "3", "4"); @@ -392,13 +387,12 @@ public class GeoDistanceIT extends ESIntegTestCase { XContentBuilder source = JsonXContent.contentBuilder().startObject().field("pin", GeoHashUtils.stringEncode(lon, lat)).endObject(); assertAcked(prepareCreate("locations").setSettings(settings).addMapping("location", mapping)); - client().prepareIndex("locations", "location", "1").setCreate(true).setSource(source).execute().actionGet(); + client().prepareIndex("locations", "location", "1").setCreate(true).setSource(source).get(); refresh(); - client().prepareGet("locations", "location", "1").execute().actionGet(); + client().prepareGet("locations", "location", "1").get(); SearchResponse result = client().prepareSearch("locations").setQuery(QueryBuilders.matchAllQuery()) - .setPostFilter(QueryBuilders.geoDistanceQuery("pin").geoDistance(GeoDistance.ARC).point(lat, lon).distance("1m")).execute() - .actionGet(); + .setPostFilter(QueryBuilders.geoDistanceQuery("pin").geoDistance(GeoDistance.ARC).point(lat, lon).distance("1m")).get(); assertHitCount(result, 1); } @@ -417,18 +411,17 @@ public class GeoDistanceIT extends ESIntegTestCase { .startObject().field("lat", 40.759011).field("lon", -73.9844722).endObject() // to NY: 0.4621 km .startObject().field("lat", 40.718266).field("lon", -74.007819).endObject().endArray().endObject()) - .execute().actionGet(); + .get(); client().prepareIndex("test2", "type1", "2") .setSource(jsonBuilder().startObject().array("names", "Wall Street", "Soho").endObject()) - .execute().actionGet(); + .get(); refresh(); // Order: Asc SearchResponse searchResponse = client().prepareSearch("test1", "test2").setQuery(matchAllQuery()) - .addSort(SortBuilders.geoDistanceSort("locations", 40.7143528, -74.0059731).ignoreUnmapped(true).order(SortOrder.ASC)).execute() - .actionGet(); + .addSort(SortBuilders.geoDistanceSort("locations", 40.7143528, -74.0059731).ignoreUnmapped(true).order(SortOrder.ASC)).get(); assertHitCount(searchResponse, 2); assertOrderedSearchHits(searchResponse, "1", "2"); @@ -439,8 +432,7 @@ public class GeoDistanceIT extends ESIntegTestCase { searchResponse = client().prepareSearch("test1", "test2").setQuery(matchAllQuery()) .addSort( SortBuilders.geoDistanceSort("locations", 40.7143528, -74.0059731).ignoreUnmapped(true).order(SortOrder.DESC) - ).execute() - .actionGet(); + ).get(); // Doc with missing geo point is first, is consistent with 0.20.x assertHitCount(searchResponse, 2); @@ -450,8 +442,7 @@ public class GeoDistanceIT extends ESIntegTestCase { // Make sure that by default the unmapped fields continue to fail searchResponse = client().prepareSearch("test1", "test2").setQuery(matchAllQuery()) - .addSort( SortBuilders.geoDistanceSort("locations", 40.7143528, -74.0059731).order(SortOrder.DESC)).execute() - .actionGet(); + .addSort( SortBuilders.geoDistanceSort("locations", 40.7143528, -74.0059731).order(SortOrder.DESC)).get(); assertThat(searchResponse.getFailedShards(), greaterThan(0)); assertHitCount(searchResponse, 1); } diff --git a/server/src/test/java/org/elasticsearch/search/sort/GeoDistanceSortBuilderIT.java b/server/src/test/java/org/elasticsearch/search/sort/GeoDistanceSortBuilderIT.java index a0a919b5a62..87a8015bf36 100644 --- a/server/src/test/java/org/elasticsearch/search/sort/GeoDistanceSortBuilderIT.java +++ b/server/src/test/java/org/elasticsearch/search/sort/GeoDistanceSortBuilderIT.java @@ -96,34 +96,42 @@ public class GeoDistanceSortBuilderIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(new GeoDistanceSortBuilder(LOCATION_FIELD, q).sortMode(SortMode.MIN).order(SortOrder.ASC)) - .execute().actionGet(); + .get(); assertOrderedSearchHits(searchResponse, "d1", "d2"); - assertThat((Double)searchResponse.getHits().getAt(0).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(2, 2, 3, 2, DistanceUnit.METERS), 10d)); - assertThat((Double)searchResponse.getHits().getAt(1).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(2, 1, 5, 1, DistanceUnit.METERS), 10d)); + assertThat((Double)searchResponse.getHits().getAt(0).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(2, 2, 3, 2, DistanceUnit.METERS), 10d)); + assertThat((Double)searchResponse.getHits().getAt(1).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(2, 1, 5, 1, DistanceUnit.METERS), 10d)); searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(new GeoDistanceSortBuilder(LOCATION_FIELD, q).sortMode(SortMode.MIN).order(SortOrder.DESC)) - .execute().actionGet(); + .get(); assertOrderedSearchHits(searchResponse, "d2", "d1"); - assertThat((Double)searchResponse.getHits().getAt(0).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(2, 1, 5, 1, DistanceUnit.METERS), 10d)); - assertThat((Double)searchResponse.getHits().getAt(1).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(2, 2, 3, 2, DistanceUnit.METERS), 10d)); + assertThat((Double)searchResponse.getHits().getAt(0).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(2, 1, 5, 1, DistanceUnit.METERS), 10d)); + assertThat((Double)searchResponse.getHits().getAt(1).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(2, 2, 3, 2, DistanceUnit.METERS), 10d)); searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(new GeoDistanceSortBuilder(LOCATION_FIELD, q).sortMode(SortMode.MAX).order(SortOrder.ASC)) - .execute().actionGet(); + .get(); assertOrderedSearchHits(searchResponse, "d1", "d2"); - assertThat((Double)searchResponse.getHits().getAt(0).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(2, 2, 4, 1, DistanceUnit.METERS), 10d)); - assertThat((Double)searchResponse.getHits().getAt(1).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(2, 1, 6, 2, DistanceUnit.METERS), 10d)); + assertThat((Double)searchResponse.getHits().getAt(0).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(2, 2, 4, 1, DistanceUnit.METERS), 10d)); + assertThat((Double)searchResponse.getHits().getAt(1).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(2, 1, 6, 2, DistanceUnit.METERS), 10d)); searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(new GeoDistanceSortBuilder(LOCATION_FIELD, q).sortMode(SortMode.MAX).order(SortOrder.DESC)) - .execute().actionGet(); + .get(); assertOrderedSearchHits(searchResponse, "d2", "d1"); - assertThat((Double)searchResponse.getHits().getAt(0).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(2, 1, 6, 2, DistanceUnit.METERS), 10d)); - assertThat((Double)searchResponse.getHits().getAt(1).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(2, 2, 4, 1, DistanceUnit.METERS), 10d)); + assertThat((Double)searchResponse.getHits().getAt(0).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(2, 1, 6, 2, DistanceUnit.METERS), 10d)); + assertThat((Double)searchResponse.getHits().getAt(1).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(2, 2, 4, 1, DistanceUnit.METERS), 10d)); } public void testSingeToManyAvgMedian() throws ExecutionException, InterruptedException, IOException { @@ -155,18 +163,22 @@ public class GeoDistanceSortBuilderIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(new GeoDistanceSortBuilder(LOCATION_FIELD, q).sortMode(SortMode.AVG).order(SortOrder.ASC)) - .execute().actionGet(); + .get(); assertOrderedSearchHits(searchResponse, "d2", "d1"); - assertThat((Double)searchResponse.getHits().getAt(0).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(0, 0, 0, 4, DistanceUnit.METERS), 10d)); - assertThat((Double)searchResponse.getHits().getAt(1).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(0, 0, 0, 5, DistanceUnit.METERS), 10d)); + assertThat((Double)searchResponse.getHits().getAt(0).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(0, 0, 0, 4, DistanceUnit.METERS), 10d)); + assertThat((Double)searchResponse.getHits().getAt(1).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(0, 0, 0, 5, DistanceUnit.METERS), 10d)); searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(new GeoDistanceSortBuilder(LOCATION_FIELD, q).sortMode(SortMode.MEDIAN).order(SortOrder.ASC)) - .execute().actionGet(); + .get(); assertOrderedSearchHits(searchResponse, "d1", "d2"); - assertThat((Double)searchResponse.getHits().getAt(0).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(0, 0, 0, 4, DistanceUnit.METERS), 10d)); - assertThat((Double)searchResponse.getHits().getAt(1).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(0, 0, 0, 5, DistanceUnit.METERS), 10d)); + assertThat((Double)searchResponse.getHits().getAt(0).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(0, 0, 0, 4, DistanceUnit.METERS), 10d)); + assertThat((Double)searchResponse.getHits().getAt(1).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(0, 0, 0, 5, DistanceUnit.METERS), 10d)); } protected void createShuffeldJSONArray(XContentBuilder builder, GeoPoint[] pointsArray) throws IOException { @@ -237,26 +249,33 @@ public class GeoDistanceSortBuilderIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(geoDistanceSortBuilder.sortMode(SortMode.MIN).order(SortOrder.ASC)) - .execute().actionGet(); + .get(); assertOrderedSearchHits(searchResponse, "d1", "d2"); - assertThat((Double) searchResponse.getHits().getAt(0).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(2.5, 1, 2, 1, DistanceUnit.METERS), 1.e-1)); - assertThat((Double) searchResponse.getHits().getAt(1).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(4.5, 1, 2, 1, DistanceUnit.METERS), 1.e-1)); + assertThat((Double) searchResponse.getHits().getAt(0).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(2.5, 1, 2, 1, DistanceUnit.METERS), 1.e-1)); + assertThat((Double) searchResponse.getHits().getAt(1).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(4.5, 1, 2, 1, DistanceUnit.METERS), 1.e-1)); searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(geoDistanceSortBuilder.sortMode(SortMode.MAX).order(SortOrder.ASC)) - .execute().actionGet(); + .get(); assertOrderedSearchHits(searchResponse, "d1", "d2"); - assertThat((Double) searchResponse.getHits().getAt(0).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(3.25, 4, 2, 1, DistanceUnit.METERS), 1.e-1)); - assertThat((Double) searchResponse.getHits().getAt(1).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(5.25, 4, 2, 1, DistanceUnit.METERS), 1.e-1)); + assertThat((Double) searchResponse.getHits().getAt(0).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(3.25, 4, 2, 1, DistanceUnit.METERS), 1.e-1)); + assertThat((Double) searchResponse.getHits().getAt(1).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(5.25, 4, 2, 1, DistanceUnit.METERS), 1.e-1)); } public void testSinglePointGeoDistanceSort() throws ExecutionException, InterruptedException, IOException { assertAcked(prepareCreate("index").addMapping("type", LOCATION_FIELD, "type=geo_point")); indexRandom(true, - client().prepareIndex("index", "type", "d1").setSource(jsonBuilder().startObject().startObject(LOCATION_FIELD).field("lat", 1).field("lon", 1).endObject().endObject()), - client().prepareIndex("index", "type", "d2").setSource(jsonBuilder().startObject().startObject(LOCATION_FIELD).field("lat", 1).field("lon", 2).endObject().endObject())); + client().prepareIndex("index", "type", "d1") + .setSource(jsonBuilder().startObject().startObject(LOCATION_FIELD).field("lat", 1).field("lon", 1).endObject().endObject()), + client().prepareIndex("index", "type", "d2") + .setSource(jsonBuilder().startObject().startObject(LOCATION_FIELD).field("lat", 1).field("lon", 2).endObject() + .endObject())); String hashPoint = "s037ms06g7h0"; @@ -265,7 +284,7 @@ public class GeoDistanceSortBuilderIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(geoDistanceSortBuilder.sortMode(SortMode.MIN).order(SortOrder.ASC)) - .execute().actionGet(); + .get(); checkCorrectSortOrderForGeoSort(searchResponse); geoDistanceSortBuilder = new GeoDistanceSortBuilder(LOCATION_FIELD, new GeoPoint(2, 2)); @@ -273,7 +292,7 @@ public class GeoDistanceSortBuilderIT extends ESIntegTestCase { searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(geoDistanceSortBuilder.sortMode(SortMode.MIN).order(SortOrder.ASC)) - .execute().actionGet(); + .get(); checkCorrectSortOrderForGeoSort(searchResponse); geoDistanceSortBuilder = new GeoDistanceSortBuilder(LOCATION_FIELD, 2, 2); @@ -281,42 +300,44 @@ public class GeoDistanceSortBuilderIT extends ESIntegTestCase { searchResponse = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(geoDistanceSortBuilder.sortMode(SortMode.MIN).order(SortOrder.ASC)) - .execute().actionGet(); + .get(); checkCorrectSortOrderForGeoSort(searchResponse); searchResponse = client() .prepareSearch() .setSource( new SearchSourceBuilder().sort(SortBuilders.geoDistanceSort(LOCATION_FIELD, 2.0, 2.0) - )).execute().actionGet(); + )).get(); checkCorrectSortOrderForGeoSort(searchResponse); searchResponse = client() .prepareSearch() .setSource( new SearchSourceBuilder().sort(SortBuilders.geoDistanceSort(LOCATION_FIELD, "s037ms06g7h0") - )).execute().actionGet(); + )).get(); checkCorrectSortOrderForGeoSort(searchResponse); searchResponse = client() .prepareSearch() .setSource( new SearchSourceBuilder().sort(SortBuilders.geoDistanceSort(LOCATION_FIELD, 2.0, 2.0) - )).execute().actionGet(); + )).get(); checkCorrectSortOrderForGeoSort(searchResponse); searchResponse = client() .prepareSearch() .setSource( new SearchSourceBuilder().sort(SortBuilders.geoDistanceSort(LOCATION_FIELD, 2.0, 2.0) - .validation(GeoValidationMethod.COERCE))).execute().actionGet(); + .validation(GeoValidationMethod.COERCE))).get(); checkCorrectSortOrderForGeoSort(searchResponse); } private static void checkCorrectSortOrderForGeoSort(SearchResponse searchResponse) { assertOrderedSearchHits(searchResponse, "d2", "d1"); - assertThat((Double) searchResponse.getHits().getAt(0).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(2, 2, 1, 2, DistanceUnit.METERS), 1.e-1)); - assertThat((Double) searchResponse.getHits().getAt(1).getSortValues()[0], closeTo(GeoDistance.ARC.calculate(2, 2, 1, 1, DistanceUnit.METERS), 1.e-1)); + assertThat((Double) searchResponse.getHits().getAt(0).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(2, 2, 1, 2, DistanceUnit.METERS), 1.e-1)); + assertThat((Double) searchResponse.getHits().getAt(1).getSortValues()[0], + closeTo(GeoDistance.ARC.calculate(2, 2, 1, 1, DistanceUnit.METERS), 1.e-1)); } protected void createQPoints(List qHashes, List qPoints) { diff --git a/server/src/test/java/org/elasticsearch/search/sort/SimpleSortIT.java b/server/src/test/java/org/elasticsearch/search/sort/SimpleSortIT.java index 26fa4c870c9..87aaab501f4 100644 --- a/server/src/test/java/org/elasticsearch/search/sort/SimpleSortIT.java +++ b/server/src/test/java/org/elasticsearch/search/sort/SimpleSortIT.java @@ -169,7 +169,7 @@ public class SimpleSortIT extends ESIntegTestCase { } Collections.shuffle(builders, random); for (IndexRequestBuilder builder : builders) { - builder.execute().actionGet(); + builder.get(); if (random.nextBoolean()) { if (random.nextInt(5) != 0) { refresh(); diff --git a/server/src/test/java/org/elasticsearch/search/source/MetadataFetchingIT.java b/server/src/test/java/org/elasticsearch/search/source/MetadataFetchingIT.java index d317b0ffa5a..545968140f6 100644 --- a/server/src/test/java/org/elasticsearch/search/source/MetadataFetchingIT.java +++ b/server/src/test/java/org/elasticsearch/search/source/MetadataFetchingIT.java @@ -41,7 +41,7 @@ public class MetadataFetchingIT extends ESIntegTestCase { assertAcked(prepareCreate("test")); ensureGreen(); - client().prepareIndex("test", "_doc", "1").setSource("field", "value").execute().actionGet(); + client().prepareIndex("test", "_doc", "1").setSource("field", "value").get(); refresh(); SearchResponse response = client() @@ -66,7 +66,7 @@ public class MetadataFetchingIT extends ESIntegTestCase { assertAcked(prepareCreate("test").addMapping("_doc", "nested", "type=nested")); ensureGreen(); client().prepareIndex("test", "_doc", "1") - .setSource("field", "value", "nested", Collections.singletonMap("title", "foo")).execute().actionGet(); + .setSource("field", "value", "nested", Collections.singletonMap("title", "foo")).get(); refresh(); SearchResponse response = client() @@ -96,7 +96,7 @@ public class MetadataFetchingIT extends ESIntegTestCase { assertAcked(prepareCreate("test")); ensureGreen(); - client().prepareIndex("test", "_doc", "1").setSource("field", "value").setRouting("toto").execute().actionGet(); + client().prepareIndex("test", "_doc", "1").setSource("field", "value").setRouting("toto").get(); refresh(); SearchResponse response = client() diff --git a/server/src/test/java/org/elasticsearch/search/stats/SearchStatsIT.java b/server/src/test/java/org/elasticsearch/search/stats/SearchStatsIT.java index 11806a1cea9..a575d1ad63e 100644 --- a/server/src/test/java/org/elasticsearch/search/stats/SearchStatsIT.java +++ b/server/src/test/java/org/elasticsearch/search/stats/SearchStatsIT.java @@ -85,7 +85,7 @@ public class SearchStatsIT extends ESIntegTestCase { public void testSimpleStats() throws Exception { // clear all stats first - client().admin().indices().prepareStats().clear().execute().actionGet(); + client().admin().indices().prepareStats().clear().get(); final int numNodes = cluster().numDataNodes(); assertThat(numNodes, greaterThanOrEqualTo(2)); final int shardsIdx1 = randomIntBetween(1, 10); // we make sure each node gets at least a single shard... @@ -96,7 +96,7 @@ public class SearchStatsIT extends ESIntegTestCase { .put(SETTING_NUMBER_OF_REPLICAS, 0))); int docsTest1 = scaledRandomIntBetween(3*shardsIdx1, 5*shardsIdx1); for (int i = 0; i < docsTest1; i++) { - client().prepareIndex("test1", "type", Integer.toString(i)).setSource("field", "value").execute().actionGet(); + client().prepareIndex("test1", "type", Integer.toString(i)).setSource("field", "value").get(); if (rarely()) { refresh(); } @@ -106,7 +106,7 @@ public class SearchStatsIT extends ESIntegTestCase { .put(SETTING_NUMBER_OF_REPLICAS, 0))); int docsTest2 = scaledRandomIntBetween(3*shardsIdx2, 5*shardsIdx2); for (int i = 0; i < docsTest2; i++) { - client().prepareIndex("test2", "type", Integer.toString(i)).setSource("field", "value").execute().actionGet(); + client().prepareIndex("test2", "type", Integer.toString(i)).setSource("field", "value").get(); if (rarely()) { refresh(); } @@ -124,12 +124,12 @@ public class SearchStatsIT extends ESIntegTestCase { .addScriptField("script1", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_source.field", Collections.emptyMap())) .setSize(100) - .execute().actionGet(); + .get(); assertHitCount(searchResponse, docsTest1 + docsTest2); assertAllSuccessful(searchResponse); } - IndicesStatsResponse indicesStats = client().admin().indices().prepareStats().execute().actionGet(); + IndicesStatsResponse indicesStats = client().admin().indices().prepareStats().get(); logger.debug("###### indices search stats: {}", indicesStats.getTotal().getSearch()); assertThat(indicesStats.getTotal().getSearch().getTotal().getQueryCount(), greaterThan(0L)); assertThat(indicesStats.getTotal().getSearch().getTotal().getQueryTimeInMillis(), greaterThan(0L)); @@ -137,13 +137,13 @@ public class SearchStatsIT extends ESIntegTestCase { assertThat(indicesStats.getTotal().getSearch().getTotal().getFetchTimeInMillis(), greaterThan(0L)); assertThat(indicesStats.getTotal().getSearch().getGroupStats(), nullValue()); - indicesStats = client().admin().indices().prepareStats().setGroups("group1").execute().actionGet(); + indicesStats = client().admin().indices().prepareStats().setGroups("group1").get(); assertThat(indicesStats.getTotal().getSearch().getGroupStats(), notNullValue()); assertThat(indicesStats.getTotal().getSearch().getGroupStats().get("group1").getQueryCount(), greaterThan(0L)); assertThat(indicesStats.getTotal().getSearch().getGroupStats().get("group1").getQueryTimeInMillis(), greaterThan(0L)); assertThat(indicesStats.getTotal().getSearch().getGroupStats().get("group1").getFetchCount(), greaterThan(0L)); assertThat(indicesStats.getTotal().getSearch().getGroupStats().get("group1").getFetchTimeInMillis(), greaterThan(0L)); - NodesStatsResponse nodeStats = client().admin().cluster().prepareNodesStats().execute().actionGet(); + NodesStatsResponse nodeStats = client().admin().cluster().prepareNodesStats().get(); Set nodeIdsWithIndex = nodeIdsWithIndex("test1", "test2"); int num = 0; @@ -164,7 +164,7 @@ public class SearchStatsIT extends ESIntegTestCase { } private Set nodeIdsWithIndex(String... indices) { - ClusterState state = client().admin().cluster().prepareState().execute().actionGet().getState(); + ClusterState state = client().admin().cluster().prepareState().get().getState(); GroupShardsIterator allAssignedShardsGrouped = state.routingTable().allAssignedShardsGrouped(indices, true); Set nodes = new HashSet<>(); for (ShardIterator shardIterator : allAssignedShardsGrouped) { @@ -193,13 +193,12 @@ public class SearchStatsIT extends ESIntegTestCase { .prepareIndex(index, "type", Integer.toString(s * docs + i)) .setSource("field", "value") .setRouting(Integer.toString(s)) - .execute() - .actionGet(); + .get(); } } - client().admin().indices().prepareRefresh(index).execute().actionGet(); + client().admin().indices().prepareRefresh(index).get(); - IndicesStatsResponse indicesStats = client().admin().indices().prepareStats(index).execute().actionGet(); + IndicesStatsResponse indicesStats = client().admin().indices().prepareStats(index).get(); assertThat(indicesStats.getTotal().getSearch().getOpenContexts(), equalTo(0L)); int size = scaledRandomIntBetween(1, docs); @@ -207,11 +206,11 @@ public class SearchStatsIT extends ESIntegTestCase { .setQuery(matchAllQuery()) .setSize(size) .setScroll(TimeValue.timeValueMinutes(2)) - .execute().actionGet(); + .get(); assertSearchResponse(searchResponse); // refresh the stats now that scroll contexts are opened - indicesStats = client().admin().indices().prepareStats(index).execute().actionGet(); + indicesStats = client().admin().indices().prepareStats(index).get(); assertThat(indicesStats.getTotal().getSearch().getOpenContexts(), equalTo((long) numAssignedShards(index))); assertThat(indicesStats.getTotal().getSearch().getTotal().getScrollCurrent(), equalTo((long) numAssignedShards(index))); @@ -224,23 +223,23 @@ public class SearchStatsIT extends ESIntegTestCase { hits += searchResponse.getHits().getHits().length; searchResponse = client().prepareSearchScroll(searchResponse.getScrollId()) .setScroll(TimeValue.timeValueMinutes(2)) - .execute().actionGet(); + .get(); } long expected = 0; // the number of queries executed is equal to at least the sum of number of pages in shard over all shards - IndicesStatsResponse r = client().admin().indices().prepareStats(index).execute().actionGet(); + IndicesStatsResponse r = client().admin().indices().prepareStats(index).get(); for (int s = 0; s < numAssignedShards(index); s++) { expected += (long)Math.ceil(r.getShards()[s].getStats().getDocs().getCount() / size); } - indicesStats = client().admin().indices().prepareStats().execute().actionGet(); + indicesStats = client().admin().indices().prepareStats().get(); Stats stats = indicesStats.getTotal().getSearch().getTotal(); assertEquals(hits, docs * numAssignedShards(index)); assertThat(stats.getQueryCount(), greaterThanOrEqualTo(expected)); clearScroll(searchResponse.getScrollId()); - indicesStats = client().admin().indices().prepareStats().execute().actionGet(); + indicesStats = client().admin().indices().prepareStats().get(); stats = indicesStats.getTotal().getSearch().getTotal(); assertThat(indicesStats.getTotal().getSearch().getOpenContexts(), equalTo(0L)); assertThat(stats.getScrollCount(), equalTo((long)numAssignedShards(index))); @@ -248,7 +247,7 @@ public class SearchStatsIT extends ESIntegTestCase { } protected int numAssignedShards(String... indices) { - ClusterState state = client().admin().cluster().prepareState().execute().actionGet().getState(); + ClusterState state = client().admin().cluster().prepareState().get().getState(); GroupShardsIterator allAssignedShardsGrouped = state.routingTable().allAssignedShardsGrouped(indices, true); return allAssignedShardsGrouped.size(); } diff --git a/server/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchIT.java b/server/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchIT.java index 76c11e4f4a6..d4a0edf914e 100644 --- a/server/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchIT.java +++ b/server/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchIT.java @@ -160,17 +160,17 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { indexRandom(true, indexRequestBuilders); CompletionSuggestionBuilder noText = SuggestBuilders.completionSuggestion(FIELD); SearchResponse searchResponse = client().prepareSearch(INDEX) - .suggest(new SuggestBuilder().addSuggestion("foo", noText).setGlobalText("sugg")).execute().actionGet(); + .suggest(new SuggestBuilder().addSuggestion("foo", noText).setGlobalText("sugg")).get(); assertSuggestions(searchResponse, "foo", "suggestion10", "suggestion9", "suggestion8", "suggestion7", "suggestion6"); CompletionSuggestionBuilder withText = SuggestBuilders.completionSuggestion(FIELD).text("sugg"); searchResponse = client().prepareSearch(INDEX) - .suggest(new SuggestBuilder().addSuggestion("foo", withText)).execute().actionGet(); + .suggest(new SuggestBuilder().addSuggestion("foo", withText)).get(); assertSuggestions(searchResponse, "foo", "suggestion10", "suggestion9", "suggestion8", "suggestion7", "suggestion6"); // test that suggestion text takes precedence over global text searchResponse = client().prepareSearch(INDEX) - .suggest(new SuggestBuilder().addSuggestion("foo", withText).setGlobalText("bogus")).execute().actionGet(); + .suggest(new SuggestBuilder().addSuggestion("foo", withText).setGlobalText("bogus")).get(); assertSuggestions(searchResponse, "foo", "suggestion10", "suggestion9", "suggestion8", "suggestion7", "suggestion6"); } @@ -405,10 +405,11 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch(INDEX).suggest( new SuggestBuilder().addSuggestion("testSuggestions", new CompletionSuggestionBuilder(FIELD).text("test").size(10)) - ).execute().actionGet(); + ).get(); assertSuggestions(searchResponse, "testSuggestions", "testing"); - Suggest.Suggestion.Entry.Option option = searchResponse.getSuggest().getSuggestion("testSuggestions").getEntries().get(0).getOptions().get(0); + Suggest.Suggestion.Entry.Option option = searchResponse.getSuggest().getSuggestion("testSuggestions").getEntries().get(0) + .getOptions().get(0); assertThat(option, is(instanceOf(CompletionSuggestion.Entry.Option.class))); CompletionSuggestion.Entry.Option prefixOption = (CompletionSuggestion.Entry.Option) option; @@ -570,7 +571,8 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { .setSource(jsonBuilder().startObject().field(FIELD, "Foo Fighters").endObject()).get(); ensureGreen(INDEX); - AcknowledgedResponse putMappingResponse = client().admin().indices().preparePutMapping(INDEX).setType(TYPE).setSource(jsonBuilder().startObject() + AcknowledgedResponse putMappingResponse = client().admin().indices().preparePutMapping(INDEX).setType(TYPE) + .setSource(jsonBuilder().startObject() .startObject(TYPE).startObject("properties") .startObject(FIELD) .field("type", "text") @@ -585,7 +587,7 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch(INDEX).suggest( new SuggestBuilder().addSuggestion("suggs", SuggestBuilders.completionSuggestion(FIELD + ".suggest").text("f").size(10)) - ).execute().actionGet(); + ).get(); assertSuggestions(searchResponse, "suggs"); client().prepareIndex(INDEX, TYPE, "1").setRefreshPolicy(IMMEDIATE) @@ -594,7 +596,7 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { SearchResponse afterReindexingResponse = client().prepareSearch(INDEX).suggest( new SuggestBuilder().addSuggestion("suggs", SuggestBuilders.completionSuggestion(FIELD + ".suggest").text("f").size(10)) - ).execute().actionGet(); + ).get(); assertSuggestions(afterReindexingResponse, "suggs", "Foo Fighters"); } @@ -611,12 +613,12 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch(INDEX).suggest( new SuggestBuilder().addSuggestion("foo", SuggestBuilders.completionSuggestion(FIELD).prefix("Nirv").size(10)) - ).execute().actionGet(); + ).get(); assertSuggestions(searchResponse, false, "foo", "Nirvana"); searchResponse = client().prepareSearch(INDEX).suggest( new SuggestBuilder().addSuggestion("foo", SuggestBuilders.completionSuggestion(FIELD).prefix("Nirw", Fuzziness.ONE).size(10)) - ).execute().actionGet(); + ).get(); assertSuggestions(searchResponse, false, "foo", "Nirvana"); } @@ -634,13 +636,13 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { // edit distance 1 SearchResponse searchResponse = client().prepareSearch(INDEX).suggest( new SuggestBuilder().addSuggestion("foo", SuggestBuilders.completionSuggestion(FIELD).prefix("Norw", Fuzziness.ONE).size(10)) - ).execute().actionGet(); + ).get(); assertSuggestions(searchResponse, false, "foo"); // edit distance 2 searchResponse = client().prepareSearch(INDEX).suggest( new SuggestBuilder().addSuggestion("foo", SuggestBuilders.completionSuggestion(FIELD).prefix("Norw", Fuzziness.TWO).size(10)) - ).execute().actionGet(); + ).get(); assertSuggestions(searchResponse, false, "foo", "Nirvana"); } @@ -657,13 +659,14 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch(INDEX).suggest( new SuggestBuilder().addSuggestion("foo", - SuggestBuilders.completionSuggestion(FIELD).prefix("Nriv", FuzzyOptions.builder().setTranspositions(false).build()).size(10)) - ).execute().actionGet(); + SuggestBuilders.completionSuggestion(FIELD).prefix("Nriv", FuzzyOptions.builder().setTranspositions(false).build()) + .size(10)) + ).get(); assertSuggestions(searchResponse, false, "foo"); searchResponse = client().prepareSearch(INDEX).suggest( new SuggestBuilder().addSuggestion("foo", SuggestBuilders.completionSuggestion(FIELD).prefix("Nriv", Fuzziness.ONE).size(10)) - ).execute().actionGet(); + ).get(); assertSuggestions(searchResponse, false, "foo", "Nirvana"); } @@ -681,13 +684,13 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch(INDEX).suggest( new SuggestBuilder().addSuggestion("foo", SuggestBuilders.completionSuggestion(FIELD).prefix("Nriva", FuzzyOptions.builder().setFuzzyMinLength(6).build()).size(10)) - ).execute().actionGet(); + ).get(); assertSuggestions(searchResponse, false, "foo"); searchResponse = client().prepareSearch(INDEX).suggest( new SuggestBuilder().addSuggestion("foo", SuggestBuilders.completionSuggestion(FIELD).prefix("Nrivan", FuzzyOptions.builder().setFuzzyMinLength(6).build()).size(10)) - ).execute().actionGet(); + ).get(); assertSuggestions(searchResponse, false, "foo", "Nirvana"); } @@ -705,13 +708,14 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch(INDEX).suggest( new SuggestBuilder().addSuggestion("foo", SuggestBuilders.completionSuggestion(FIELD).prefix("Nirw", FuzzyOptions.builder().setFuzzyPrefixLength(4).build()).size(10)) - ).execute().actionGet(); + ).get(); assertSuggestions(searchResponse, false, "foo"); searchResponse = client().prepareSearch(INDEX).suggest( new SuggestBuilder().addSuggestion("foo", - SuggestBuilders.completionSuggestion(FIELD).prefix("Nirvo", FuzzyOptions.builder().setFuzzyPrefixLength(4).build()).size(10)) - ).execute().actionGet(); + SuggestBuilders.completionSuggestion(FIELD).prefix("Nirvo", FuzzyOptions.builder().setFuzzyPrefixLength(4).build()) + .size(10)) + ).get(); assertSuggestions(searchResponse, false, "foo", "Nirvana"); } @@ -730,17 +734,22 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { org.elasticsearch.search.suggest.completion.CompletionSuggestionBuilder completionSuggestionBuilder = SuggestBuilders.completionSuggestion(FIELD).prefix("öööи", FuzzyOptions.builder().setUnicodeAware(true).build()).size(10); - SearchResponse searchResponse = client().prepareSearch(INDEX).suggest(new SuggestBuilder().addSuggestion("foo", completionSuggestionBuilder)).execute().actionGet(); + SearchResponse searchResponse = client().prepareSearch(INDEX).suggest(new SuggestBuilder() + .addSuggestion("foo", completionSuggestionBuilder)).get(); assertSuggestions(searchResponse, false, "foo", "ööööö"); // removing unicode awareness leads to no result - completionSuggestionBuilder = SuggestBuilders.completionSuggestion(FIELD).prefix("öööи", FuzzyOptions.builder().setUnicodeAware(false).build()).size(10); - searchResponse = client().prepareSearch(INDEX).suggest(new SuggestBuilder().addSuggestion("foo", completionSuggestionBuilder)).execute().actionGet(); + completionSuggestionBuilder = SuggestBuilders.completionSuggestion(FIELD) + .prefix("öööи", FuzzyOptions.builder().setUnicodeAware(false).build()).size(10); + searchResponse = client().prepareSearch(INDEX).suggest(new SuggestBuilder() + .addSuggestion("foo", completionSuggestionBuilder)).get(); assertSuggestions(searchResponse, false, "foo"); // increasing edit distance instead of unicode awareness works again, as this is only a single character - completionSuggestionBuilder = SuggestBuilders.completionSuggestion(FIELD).prefix("öööи", FuzzyOptions.builder().setUnicodeAware(false).setFuzziness(Fuzziness.TWO).build()).size(10); - searchResponse = client().prepareSearch(INDEX).suggest(new SuggestBuilder().addSuggestion("foo", completionSuggestionBuilder)).execute().actionGet(); + completionSuggestionBuilder = SuggestBuilders.completionSuggestion(FIELD) + .prefix("öööи", FuzzyOptions.builder().setUnicodeAware(false).setFuzziness(Fuzziness.TWO).build()).size(10); + searchResponse = client().prepareSearch(INDEX).suggest(new SuggestBuilder() + .addSuggestion("foo", completionSuggestionBuilder)).get(); assertSuggestions(searchResponse, false, "foo", "ööööö"); } @@ -748,9 +757,10 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { String otherField = "testOtherField"; client().admin().indices().prepareCreate(INDEX) .setSettings(Settings.builder().put("index.number_of_replicas", 0).put("index.number_of_shards", 2)) - .execute().actionGet(); + .get(); ensureGreen(); - AcknowledgedResponse putMappingResponse = client().admin().indices().preparePutMapping(INDEX).setType(TYPE).setSource(jsonBuilder().startObject() + AcknowledgedResponse putMappingResponse = client().admin().indices().preparePutMapping(INDEX).setType(TYPE) + .setSource(jsonBuilder().startObject() .startObject(TYPE).startObject("properties") .startObject(FIELD) .field("type", "completion").field("analyzer", "simple") @@ -763,30 +773,38 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { assertThat(putMappingResponse.isAcknowledged(), is(true)); // Index two entities - client().prepareIndex(INDEX, TYPE, "1").setSource(jsonBuilder().startObject().field(FIELD, "Foo Fighters").field(otherField, "WHATEVER").endObject()).get(); - client().prepareIndex(INDEX, TYPE, "2").setSource(jsonBuilder().startObject().field(FIELD, "Bar Fighters").field(otherField, "WHATEVER2").endObject()).get(); + client().prepareIndex(INDEX, TYPE, "1") + .setSource(jsonBuilder().startObject().field(FIELD, "Foo Fighters").field(otherField, "WHATEVER").endObject()).get(); + client().prepareIndex(INDEX, TYPE, "2") + .setSource(jsonBuilder().startObject().field(FIELD, "Bar Fighters").field(otherField, "WHATEVER2").endObject()).get(); refresh(); ensureGreen(); // load the fst index into ram - client().prepareSearch(INDEX).suggest(new SuggestBuilder().addSuggestion("foo", SuggestBuilders.completionSuggestion(FIELD).prefix("f"))).get(); - client().prepareSearch(INDEX).suggest(new SuggestBuilder().addSuggestion("foo", SuggestBuilders.completionSuggestion(otherField).prefix("f"))).get(); + client().prepareSearch(INDEX).suggest(new SuggestBuilder() + .addSuggestion("foo", SuggestBuilders.completionSuggestion(FIELD).prefix("f"))).get(); + client().prepareSearch(INDEX).suggest(new SuggestBuilder() + .addSuggestion("foo", SuggestBuilders.completionSuggestion(otherField).prefix("f"))).get(); // Get all stats - IndicesStatsResponse indicesStatsResponse = client().admin().indices().prepareStats(INDEX).setIndices(INDEX).setCompletion(true).get(); + IndicesStatsResponse indicesStatsResponse = client().admin().indices().prepareStats(INDEX).setIndices(INDEX).setCompletion(true) + .get(); CompletionStats completionStats = indicesStatsResponse.getIndex(INDEX).getPrimaries().completion; assertThat(completionStats, notNullValue()); long totalSizeInBytes = completionStats.getSizeInBytes(); assertThat(totalSizeInBytes, is(greaterThan(0L))); - IndicesStatsResponse singleFieldStats = client().admin().indices().prepareStats(INDEX).setIndices(INDEX).setCompletion(true).setCompletionFields(FIELD).get(); + IndicesStatsResponse singleFieldStats = client().admin().indices().prepareStats(INDEX).setIndices(INDEX).setCompletion(true) + .setCompletionFields(FIELD).get(); long singleFieldSizeInBytes = singleFieldStats.getIndex(INDEX).getPrimaries().completion.getFields().get(FIELD); - IndicesStatsResponse otherFieldStats = client().admin().indices().prepareStats(INDEX).setIndices(INDEX).setCompletion(true).setCompletionFields(otherField).get(); + IndicesStatsResponse otherFieldStats = client().admin().indices().prepareStats(INDEX).setIndices(INDEX).setCompletion(true) + .setCompletionFields(otherField).get(); long otherFieldSizeInBytes = otherFieldStats.getIndex(INDEX).getPrimaries().completion.getFields().get(otherField); assertThat(singleFieldSizeInBytes + otherFieldSizeInBytes, is(totalSizeInBytes)); // regexes - IndicesStatsResponse regexFieldStats = client().admin().indices().prepareStats(INDEX).setIndices(INDEX).setCompletion(true).setCompletionFields("*").get(); + IndicesStatsResponse regexFieldStats = client().admin().indices().prepareStats(INDEX).setIndices(INDEX).setCompletion(true) + .setCompletionFields("*").get(); FieldMemoryStats fields = regexFieldStats.getIndex(INDEX).getPrimaries().completion.getFields(); long regexSizeInBytes = fields.get(FIELD) + fields.get(otherField); assertThat(regexSizeInBytes, is(totalSizeInBytes)); @@ -803,7 +821,7 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { refresh(); try { - client().prepareSearch(INDEX).setTypes(TYPE).addSort(new FieldSortBuilder(FIELD)).execute().actionGet(); + client().prepareSearch(INDEX).setTypes(TYPE).addSort(new FieldSortBuilder(FIELD)).get(); fail("Expected an exception due to trying to sort on completion field, but did not happen"); } catch (SearchPhaseExecutionException e) { assertThat(e.status().getStatus(), is(400)); @@ -894,12 +912,13 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { SuggestBuilders.completionSuggestion(FIELD).prefix("sugg").skipDuplicates(true).size(numUnique); SearchResponse searchResponse = client().prepareSearch(INDEX) - .suggest(new SuggestBuilder().addSuggestion("suggestions", completionSuggestionBuilder)).execute().actionGet(); + .suggest(new SuggestBuilder().addSuggestion("suggestions", completionSuggestionBuilder)).get(); assertSuggestions(searchResponse, true, "suggestions", expected); } public void assertSuggestions(String suggestionName, SuggestionBuilder suggestBuilder, String... suggestions) { - SearchResponse searchResponse = client().prepareSearch(INDEX).suggest(new SuggestBuilder().addSuggestion(suggestionName, suggestBuilder)).execute().actionGet(); + SearchResponse searchResponse = client().prepareSearch(INDEX) + .suggest(new SuggestBuilder().addSuggestion(suggestionName, suggestBuilder)).get(); assertSuggestions(searchResponse, suggestionName, suggestions); } @@ -914,7 +933,7 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { SearchResponse searchResponse = client().prepareSearch(INDEX).suggest( new SuggestBuilder().addSuggestion(suggestionName, SuggestBuilders.completionSuggestion(FIELD).text(suggestString).size(10)) - ).execute().actionGet(); + ).get(); assertSuggestions(searchResponse, false, suggestionName, suggestions); } @@ -923,26 +942,32 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { assertSuggestions(searchResponse, true, name, suggestions); } - private static void assertSuggestions(SearchResponse searchResponse, boolean suggestionOrderStrict, String name, String... suggestions) { + private static void assertSuggestions(SearchResponse searchResponse, boolean suggestionOrderStrict, String name, + String... suggestions) { assertAllSuccessful(searchResponse); List suggestionNames = new ArrayList<>(); - for (Suggest.Suggestion> suggestion : iterableAsArrayList(searchResponse.getSuggest())) { + for (Suggest.Suggestion> suggestion : + iterableAsArrayList(searchResponse.getSuggest())) { suggestionNames.add(suggestion.getName()); } - String expectFieldInResponseMsg = String.format(Locale.ROOT, "Expected suggestion named %s in response, got %s", name, suggestionNames); + String expectFieldInResponseMsg = String.format(Locale.ROOT, "Expected suggestion named %s in response, got %s", name, + suggestionNames); assertThat(expectFieldInResponseMsg, searchResponse.getSuggest().getSuggestion(name), is(notNullValue())); - Suggest.Suggestion> suggestion = searchResponse.getSuggest().getSuggestion(name); + Suggest.Suggestion> suggestion = searchResponse.getSuggest() + .getSuggestion(name); List suggestionList = getNames(suggestion.getEntries().get(0)); List options = suggestion.getEntries().get(0).getOptions(); - String assertMsg = String.format(Locale.ROOT, "Expected options %s length to be %s, but was %s", suggestionList, suggestions.length, options.size()); + String assertMsg = String.format(Locale.ROOT, "Expected options %s length to be %s, but was %s", suggestionList, + suggestions.length, options.size()); assertThat(assertMsg, options.size(), is(suggestions.length)); if (suggestionOrderStrict) { for (int i = 0; i < suggestions.length; i++) { - String errMsg = String.format(Locale.ROOT, "Expected elem %s in list %s to be [%s] score: %s", i, suggestionList, suggestions[i], options.get(i).getScore()); + String errMsg = String.format(Locale.ROOT, "Expected elem %s in list %s to be [%s] score: %s", i, suggestionList, + suggestions[i], options.get(i).getScore()); assertThat(errMsg, options.get(i).getText().toString(), is(suggestions[i])); } } else { @@ -1015,7 +1040,8 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { // see #3555 public void testPrunedSegments() throws IOException { - createIndexAndMappingAndSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0).build(), completionMappingBuilder); + createIndexAndMappingAndSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0).build(), + completionMappingBuilder); client().prepareIndex(INDEX, TYPE, "1").setSource(jsonBuilder() .startObject().startObject(FIELD) @@ -1027,7 +1053,7 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { .field("somefield", "somevalue") .endObject() ).get(); // we have 2 docs in a segment... - ForceMergeResponse actionGet = client().admin().indices().prepareForceMerge().setFlush(true).setMaxNumSegments(1).execute().actionGet(); + ForceMergeResponse actionGet = client().admin().indices().prepareForceMerge().setFlush(true).setMaxNumSegments(1).get(); assertAllSuccessful(actionGet); refresh(); // update the first one and then merge.. the target segment will have no value in FIELD @@ -1036,7 +1062,7 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { .field("somefield", "somevalue") .endObject() ).get(); - actionGet = client().admin().indices().prepareForceMerge().setFlush(true).setMaxNumSegments(1).execute().actionGet(); + actionGet = client().admin().indices().prepareForceMerge().setFlush(true).setMaxNumSegments(1).get(); assertAllSuccessful(actionGet); refresh(); @@ -1111,7 +1137,7 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { try { client().prepareSearch(INDEX).addAggregation(AggregationBuilders.terms("suggest_agg").field(FIELD) - .collectMode(randomFrom(SubAggCollectionMode.values()))).execute().actionGet(); + .collectMode(randomFrom(SubAggCollectionMode.values()))).get(); // Exception must be thrown assertFalse(true); } catch (SearchPhaseExecutionException e) { diff --git a/server/src/test/java/org/elasticsearch/search/suggest/ContextCompletionSuggestSearchIT.java b/server/src/test/java/org/elasticsearch/search/suggest/ContextCompletionSuggestSearchIT.java index 3c91cda5f86..90df75cfc9f 100644 --- a/server/src/test/java/org/elasticsearch/search/suggest/ContextCompletionSuggestSearchIT.java +++ b/server/src/test/java/org/elasticsearch/search/suggest/ContextCompletionSuggestSearchIT.java @@ -207,7 +207,8 @@ public class ContextCompletionSuggestSearchIT extends ESIntegTestCase { } indexRandom(true, indexRequestBuilders); CompletionSuggestionBuilder prefix = SuggestBuilders.completionSuggestion(FIELD).prefix("sugg") - .contexts(Collections.singletonMap("cat", Collections.singletonList(CategoryQueryContext.builder().setCategory("cat0").build()))); + .contexts(Collections.singletonMap("cat", Collections.singletonList(CategoryQueryContext.builder() + .setCategory("cat0").build()))); assertSuggestions("foo", prefix, "suggestion8", "suggestion6", "suggestion4", "suggestion2", "suggestion0"); } @@ -265,12 +266,14 @@ public class ContextCompletionSuggestSearchIT extends ESIntegTestCase { // filter only on context cat CompletionSuggestionBuilder catFilterSuggest = SuggestBuilders.completionSuggestion(FIELD).prefix("sugg"); - catFilterSuggest.contexts(Collections.singletonMap("cat", Collections.singletonList(CategoryQueryContext.builder().setCategory("cat0").build()))); + catFilterSuggest.contexts(Collections.singletonMap("cat", Collections.singletonList(CategoryQueryContext.builder() + .setCategory("cat0").build()))); assertSuggestions("foo", catFilterSuggest, "suggestion8", "suggestion6", "suggestion4", "suggestion2", "suggestion0"); // filter only on context type CompletionSuggestionBuilder typeFilterSuggest = SuggestBuilders.completionSuggestion(FIELD).prefix("sugg"); - typeFilterSuggest.contexts(Collections.singletonMap("type", Arrays.asList(CategoryQueryContext.builder().setCategory("type2").build(), + typeFilterSuggest.contexts(Collections.singletonMap("type", Arrays.asList(CategoryQueryContext.builder().setCategory("type2") + .build(), CategoryQueryContext.builder().setCategory("type1").build()))); assertSuggestions("foo", typeFilterSuggest, "suggestion9", "suggestion6", "suggestion5", "suggestion2", "suggestion1"); } @@ -449,7 +452,8 @@ public class ContextCompletionSuggestSearchIT extends ESIntegTestCase { } indexRandom(true, indexRequestBuilders); CompletionSuggestionBuilder prefix = SuggestBuilders.completionSuggestion(FIELD).prefix("sugg") - .contexts(Collections.singletonMap("geo", Collections.singletonList(GeoQueryContext.builder().setGeoPoint(new GeoPoint(52.2263, 4.543)).build()))); + .contexts(Collections.singletonMap("geo", Collections.singletonList(GeoQueryContext.builder() + .setGeoPoint(new GeoPoint(52.2263, 4.543)).build()))); assertSuggestions("foo", prefix, "suggestion9", "suggestion8", "suggestion7", "suggestion6", "suggestion5"); } @@ -487,7 +491,8 @@ public class ContextCompletionSuggestSearchIT extends ESIntegTestCase { indexRandom(true, indexRequestBuilders); CompletionSuggestionBuilder geoNeighbourPrefix = SuggestBuilders.completionSuggestion(FIELD).prefix("sugg") - .contexts(Collections.singletonMap("geo", Collections.singletonList(GeoQueryContext.builder().setGeoPoint(GeoPoint.fromGeohash(geohash)).build()))); + .contexts(Collections.singletonMap("geo", Collections.singletonList(GeoQueryContext.builder() + .setGeoPoint(GeoPoint.fromGeohash(geohash)).build()))); assertSuggestions("foo", geoNeighbourPrefix, "suggestion9", "suggestion8", "suggestion7", "suggestion6", "suggestion5"); } @@ -540,7 +545,7 @@ public class ContextCompletionSuggestSearchIT extends ESIntegTestCase { .array("input", "Hotel Amsterdam in Berlin") .endObject() .endObject(); - client().prepareIndex(INDEX, TYPE, "1").setSource(source1).execute().actionGet(); + client().prepareIndex(INDEX, TYPE, "1").setSource(source1).get(); XContentBuilder source2 = jsonBuilder() .startObject() @@ -551,17 +556,20 @@ public class ContextCompletionSuggestSearchIT extends ESIntegTestCase { .array("input", "Hotel Berlin in Amsterdam") .endObject() .endObject(); - client().prepareIndex(INDEX, TYPE, "2").setSource(source2).execute().actionGet(); + client().prepareIndex(INDEX, TYPE, "2").setSource(source2).get(); refresh(); String suggestionName = randomAlphaOfLength(10); CompletionSuggestionBuilder context = SuggestBuilders.completionSuggestion(FIELD).text("h").size(10) - .contexts(Collections.singletonMap("st", Collections.singletonList(GeoQueryContext.builder().setGeoPoint(new GeoPoint(52.52, 13.4)).build()))); - SearchResponse searchResponse = client().prepareSearch(INDEX).suggest(new SuggestBuilder().addSuggestion(suggestionName, context)).get(); + .contexts(Collections.singletonMap("st", Collections.singletonList(GeoQueryContext.builder() + .setGeoPoint(new GeoPoint(52.52, 13.4)).build()))); + SearchResponse searchResponse = client().prepareSearch(INDEX).suggest(new SuggestBuilder().addSuggestion(suggestionName, context)) + .get(); assertEquals(searchResponse.getSuggest().size(), 1); - assertEquals("Hotel Amsterdam in Berlin", searchResponse.getSuggest().getSuggestion(suggestionName).iterator().next().getOptions().iterator().next().getText().string()); + assertEquals("Hotel Amsterdam in Berlin", searchResponse.getSuggest() + .getSuggestion(suggestionName).iterator().next().getOptions().iterator().next().getText().string()); } public void testSkipDuplicatesWithContexts() throws Exception { @@ -606,7 +614,7 @@ public class ContextCompletionSuggestSearchIT extends ESIntegTestCase { public void assertSuggestions(String suggestionName, SuggestionBuilder suggestBuilder, String... suggestions) { SearchResponse searchResponse = client().prepareSearch(INDEX).suggest( new SuggestBuilder().addSuggestion(suggestionName, suggestBuilder) - ).execute().actionGet(); + ).get(); CompletionSuggestSearchIT.assertSuggestions(searchResponse, suggestionName, suggestions); } diff --git a/server/src/test/java/org/elasticsearch/search/suggest/SuggestSearchIT.java b/server/src/test/java/org/elasticsearch/search/suggest/SuggestSearchIT.java index 98ed6a4a598..2c81a42463c 100644 --- a/server/src/test/java/org/elasticsearch/search/suggest/SuggestSearchIT.java +++ b/server/src/test/java/org/elasticsearch/search/suggest/SuggestSearchIT.java @@ -1229,7 +1229,7 @@ public class SuggestSearchIT extends ESIntegTestCase { suggestBuilder.addSuggestion(suggestion.getKey(), suggestion.getValue()); } builder.suggest(suggestBuilder); - SearchResponse actionGet = builder.execute().actionGet(); + SearchResponse actionGet = builder.get(); assertThat(Arrays.toString(actionGet.getShardFailures()), actionGet.getFailedShards(), equalTo(expectShardsFailed)); return actionGet.getSuggest(); } diff --git a/server/src/test/java/org/elasticsearch/search/suggest/completion/CategoryContextMappingTests.java b/server/src/test/java/org/elasticsearch/search/suggest/completion/CategoryContextMappingTests.java index b79fa790fdd..62db66eacda 100644 --- a/server/src/test/java/org/elasticsearch/search/suggest/completion/CategoryContextMappingTests.java +++ b/server/src/test/java/org/elasticsearch/search/suggest/completion/CategoryContextMappingTests.java @@ -74,7 +74,8 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase { .endObject().endObject() .endObject().endObject()); - DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser().parse("type1", new CompressedXContent(mapping)); + DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser() + .parse("type1", new CompressedXContent(mapping)); Mapper fieldMapper = defaultMapper.mappers().getMapper("completion"); ParsedDocument parsedDocument = defaultMapper.parse(SourceToParse.source("test", "type1", "1", BytesReference .bytes(jsonBuilder() @@ -112,7 +113,8 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase { .endObject().endObject() .endObject().endObject()); - DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser().parse("type1", new CompressedXContent(mapping)); + DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser() + .parse("type1", new CompressedXContent(mapping)); Mapper fieldMapper = defaultMapper.mappers().getMapper("completion"); ParsedDocument parsedDocument = defaultMapper.parse(SourceToParse.source("test", "type1", "1", BytesReference .bytes(jsonBuilder() @@ -145,7 +147,8 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase { .endObject().endObject() .endObject().endObject()); - DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser().parse("type1", new CompressedXContent(mapping)); + DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser() + .parse("type1", new CompressedXContent(mapping)); Mapper fieldMapper = defaultMapper.mappers().getMapper("completion"); ParsedDocument parsedDocument = defaultMapper.parse(SourceToParse.source("test", "type1", "1", BytesReference .bytes(jsonBuilder() @@ -178,7 +181,8 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase { .endObject().endObject() .endObject().endObject()); - DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser().parse("type1", new CompressedXContent(mapping)); + DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser() + .parse("type1", new CompressedXContent(mapping)); Mapper fieldMapper = defaultMapper.mappers().getMapper("completion"); ParsedDocument parsedDocument = defaultMapper.parse(SourceToParse.source("test", "type1", "1", BytesReference .bytes(jsonBuilder() @@ -211,7 +215,8 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase { .endObject().endObject() .endObject().endObject()); - DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser().parse("type1", new CompressedXContent(mapping)); + DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser() + .parse("type1", new CompressedXContent(mapping)); XContentBuilder builder = jsonBuilder() .startObject() .startArray("completion") @@ -227,7 +232,8 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase { Exception e = expectThrows(MapperParsingException.class, () -> defaultMapper.parse(SourceToParse.source("test", "type1", "1", BytesReference.bytes(builder), XContentType.JSON))); - assertEquals("contexts must be a string, number or boolean or a list of string, number or boolean, but was [VALUE_NULL]", e.getCause().getMessage()); + assertEquals("contexts must be a string, number or boolean or a list of string, number or boolean, but was [VALUE_NULL]", + e.getCause().getMessage()); } public void testIndexingWithContextList() throws Exception { @@ -243,7 +249,8 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase { .endObject().endObject() .endObject().endObject()); - DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser().parse("type1", new CompressedXContent(mapping)); + DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser() + .parse("type1", new CompressedXContent(mapping)); Mapper fieldMapper = defaultMapper.mappers().getMapper("completion"); ParsedDocument parsedDocument = defaultMapper.parse(SourceToParse.source("test", "type1", "1", BytesReference .bytes(jsonBuilder() @@ -274,7 +281,8 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase { .endObject().endObject() .endObject().endObject()); - DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser().parse("type1", new CompressedXContent(mapping)); + DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser() + .parse("type1", new CompressedXContent(mapping)); Mapper fieldMapper = defaultMapper.mappers().getMapper("completion"); ParsedDocument parsedDocument = defaultMapper.parse(SourceToParse.source("test", "type1", "1", BytesReference .bytes(jsonBuilder() @@ -305,7 +313,8 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase { .endObject().endObject() .endObject().endObject()); - DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser().parse("type1", new CompressedXContent(mapping)); + DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser() + .parse("type1", new CompressedXContent(mapping)); XContentBuilder builder = jsonBuilder() .startObject() .startObject("completion") @@ -339,7 +348,8 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase { .endObject().endObject() .endObject().endObject()); - DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser().parse("type1", new CompressedXContent(mapping)); + DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser() + .parse("type1", new CompressedXContent(mapping)); Mapper fieldMapper = defaultMapper.mappers().getMapper("completion"); XContentBuilder builder = jsonBuilder() .startObject() @@ -402,7 +412,8 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase { CategoryContextMapping mapping = ContextBuilder.category("cat").build(); XContentParseException e = expectThrows(XContentParseException.class, () -> mapping.parseQueryContext(parser)); - assertThat(ExceptionsHelper.detailedMessage(e), containsString("category context must be an object, string, number or boolean")); + assertThat(ExceptionsHelper.detailedMessage(e), + containsString("category context must be an object, string, number or boolean")); } } @@ -462,7 +473,8 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase { CategoryContextMapping mapping = ContextBuilder.category("cat").build(); XContentParseException e = expectThrows(XContentParseException.class, () -> mapping.parseQueryContext(parser)); - assertThat(ExceptionsHelper.detailedMessage(e), containsString("category context must be an object, string, number or boolean")); + assertThat(ExceptionsHelper.detailedMessage(e), + containsString("category context must be an object, string, number or boolean")); } } @@ -687,7 +699,8 @@ public class CategoryContextMappingTests extends ESSingleNodeTestCase { CategoryContextMapping mapping = ContextBuilder.category("cat").build(); XContentParseException e = expectThrows(XContentParseException.class, () -> mapping.parseQueryContext(parser)); - assertThat(ExceptionsHelper.detailedMessage(e), containsString("category context must be an object, string, number or boolean")); + assertThat(ExceptionsHelper.detailedMessage(e), + containsString("category context must be an object, string, number or boolean")); } } diff --git a/settings.gradle b/settings.gradle index b6e57582f6d..43313f7236c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -20,6 +20,7 @@ List projects = [ 'distribution:archives:zip', 'distribution:archives:oss-tar', 'distribution:archives:tar', + 'distribution:docker', 'distribution:packages:oss-deb', 'distribution:packages:deb', 'distribution:packages:oss-rpm', diff --git a/test/framework/src/main/java/org/elasticsearch/test/discovery/TestZenDiscovery.java b/test/framework/src/main/java/org/elasticsearch/test/discovery/TestZenDiscovery.java index 41007b9e9fd..783dc6325c4 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/discovery/TestZenDiscovery.java +++ b/test/framework/src/main/java/org/elasticsearch/test/discovery/TestZenDiscovery.java @@ -19,10 +19,7 @@ package org.elasticsearch.test.discovery; -import org.elasticsearch.cluster.coordination.CoordinationState; import org.elasticsearch.cluster.coordination.Coordinator; -import org.elasticsearch.cluster.coordination.InMemoryPersistedState; -import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.allocation.AllocationService; import org.elasticsearch.cluster.service.ClusterApplier; import org.elasticsearch.cluster.service.ClusterApplierService; @@ -81,20 +78,10 @@ public class TestZenDiscovery extends ZenDiscovery { Settings fixedSettings = Settings.builder().put(settings).putList(DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey()).build(); return Collections.singletonMap("test-zen", () -> { if (USE_ZEN2.get(settings)) { - Supplier persistedStateSupplier = () -> { - gatewayMetaState.applyClusterStateUpdaters(); - if (DiscoveryNode.isMasterNode(settings) == false) { - // use Zen1 way of writing cluster state for non-master-eligible nodes - // this avoids concurrent manipulating of IndexMetadata with IndicesStore - ((ClusterApplierService) clusterApplier).addLowPriorityApplier(gatewayMetaState); - return new InMemoryPersistedState(gatewayMetaState.getCurrentTerm(), gatewayMetaState.getLastAcceptedState()); - } - return gatewayMetaState; - }; - return new Coordinator("test_node", fixedSettings, clusterSettings, transportService, namedWriteableRegistry, - allocationService, masterService, persistedStateSupplier, hostsProvider, clusterApplier, - new Random(Randomness.get().nextLong())); + allocationService, masterService, + () -> gatewayMetaState.getPersistedState(settings, (ClusterApplierService) clusterApplier), hostsProvider, + clusterApplier, new Random(Randomness.get().nextLong())); } else { return new TestZenDiscovery(fixedSettings, threadPool, transportService, namedWriteableRegistry, masterService, clusterApplier, clusterSettings, hostsProvider, allocationService, gatewayMetaState); diff --git a/x-pack/plugin/ccr/build.gradle b/x-pack/plugin/ccr/build.gradle index f70e15bac9f..df3466c2788 100644 --- a/x-pack/plugin/ccr/build.gradle +++ b/x-pack/plugin/ccr/build.gradle @@ -27,6 +27,8 @@ task internalClusterTest(type: RandomizedTestingTask, include '**/*IT.class' systemProperty 'es.set.netty.runtime.available.processors', 'false' } +check.dependsOn internalClusterTest +internalClusterTest.mustRunAfter test // add all sub-projects of the qa sub-project gradle.projectsEvaluated { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/LicenseStateListener.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/LicenseStateListener.java new file mode 100644 index 00000000000..ef3302613c3 --- /dev/null +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/LicenseStateListener.java @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +package org.elasticsearch.license; + +import org.elasticsearch.Version; + +/** + * Marker interface for callbacks that are invoked when the license state changes. + */ +@FunctionalInterface +public interface LicenseStateListener { + + /** + * Callback when the license state changes. See {@link XPackLicenseState#update(License.OperationMode, boolean, Version)}. + */ + void licenseStateChanged(); + +} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/XPackLicenseState.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/XPackLicenseState.java index 3cb189b5795..0b964083920 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/XPackLicenseState.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/XPackLicenseState.java @@ -266,7 +266,7 @@ public class XPackLicenseState { } } - private final List listeners; + private final List listeners; private final boolean isSecurityEnabled; private final boolean isSecurityExplicitlyEnabled; @@ -315,17 +315,17 @@ public class XPackLicenseState { } } } - listeners.forEach(Runnable::run); + listeners.forEach(LicenseStateListener::licenseStateChanged); } /** Add a listener to be notified on license change */ - public void addListener(Runnable runnable) { - listeners.add(Objects.requireNonNull(runnable)); + public void addListener(final LicenseStateListener listener) { + listeners.add(Objects.requireNonNull(listener)); } /** Remove a listener */ - public void removeListener(Runnable runnable) { - listeners.remove(runnable); + public void removeListener(final LicenseStateListener listener) { + listeners.remove(Objects.requireNonNull(listener)); } /** Return the current license type. */ diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java index 0525ca28b1b..4ebb12555e2 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java @@ -10,6 +10,7 @@ import org.elasticsearch.Version; import org.elasticsearch.cluster.AbstractDiffable; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.TriFunction; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.unit.TimeValue; @@ -46,7 +47,6 @@ import java.util.Map; import java.util.Objects; import java.util.Random; import java.util.concurrent.TimeUnit; -import java.util.function.BiFunction; /** * Datafeed configuration options. Describes where to proactively pull input @@ -65,9 +65,10 @@ public class DatafeedConfig extends AbstractDiffable implements private static final int TWENTY_MINS_SECONDS = 20 * SECONDS_IN_MINUTE; private static final int HALF_DAY_SECONDS = 12 * 60 * SECONDS_IN_MINUTE; static final XContentObjectTransformer QUERY_TRANSFORMER = XContentObjectTransformer.queryBuilderTransformer(); - private static final BiFunction, String, QueryBuilder> lazyQueryParser = (objectMap, id) -> { + static final TriFunction, String, List, QueryBuilder> lazyQueryParser = + (objectMap, id, warnings) -> { try { - return QUERY_TRANSFORMER.fromMap(objectMap); + return QUERY_TRANSFORMER.fromMap(objectMap, warnings); } catch (IOException | XContentParseException exception) { // Certain thrown exceptions wrap up the real Illegal argument making it hard to determine cause for the user if (exception.getCause() instanceof IllegalArgumentException) { @@ -85,9 +86,10 @@ public class DatafeedConfig extends AbstractDiffable implements }; static final XContentObjectTransformer AGG_TRANSFORMER = XContentObjectTransformer.aggregatorTransformer(); - private static final BiFunction, String, AggregatorFactories.Builder> lazyAggParser = (objectMap, id) -> { + static final TriFunction, String, List, AggregatorFactories.Builder> lazyAggParser = + (objectMap, id, warnings) -> { try { - return AGG_TRANSFORMER.fromMap(objectMap); + return AGG_TRANSFORMER.fromMap(objectMap, warnings); } catch (IOException | XContentParseException exception) { // Certain thrown exceptions wrap up the real Illegal argument making it hard to determine cause for the user if (exception.getCause() instanceof IllegalArgumentException) { @@ -237,8 +239,8 @@ public class DatafeedConfig extends AbstractDiffable implements this.chunkingConfig = chunkingConfig; this.headers = Collections.unmodifiableMap(headers); this.delayedDataCheckConfig = delayedDataCheckConfig; - this.querySupplier = new CachedSupplier<>(() -> lazyQueryParser.apply(query, id)); - this.aggSupplier = new CachedSupplier<>(() -> lazyAggParser.apply(aggregations, id)); + this.querySupplier = new CachedSupplier<>(() -> lazyQueryParser.apply(query, id, new ArrayList<>())); + this.aggSupplier = new CachedSupplier<>(() -> lazyAggParser.apply(aggregations, id, new ArrayList<>())); } public DatafeedConfig(StreamInput in) throws IOException { @@ -284,8 +286,8 @@ public class DatafeedConfig extends AbstractDiffable implements } else { delayedDataCheckConfig = DelayedDataCheckConfig.defaultDelayedDataCheckConfig(); } - this.querySupplier = new CachedSupplier<>(() -> lazyQueryParser.apply(query, id)); - this.aggSupplier = new CachedSupplier<>(() -> lazyAggParser.apply(aggregations, id)); + this.querySupplier = new CachedSupplier<>(() -> lazyQueryParser.apply(query, id, new ArrayList<>())); + this.aggSupplier = new CachedSupplier<>(() -> lazyAggParser.apply(aggregations, id, new ArrayList<>())); } public String getId() { @@ -320,6 +322,20 @@ public class DatafeedConfig extends AbstractDiffable implements return querySupplier.get(); } + /** + * Calls the lazy parser and returns any gathered deprecations + * @return The deprecations from parsing the query + */ + public List getQueryDeprecations() { + return getQueryDeprecations(lazyQueryParser); + } + + List getQueryDeprecations(TriFunction, String, List, QueryBuilder> parser) { + List deprecations = new ArrayList<>(); + parser.apply(query, id, deprecations); + return deprecations; + } + public Map getQuery() { return query; } @@ -328,6 +344,20 @@ public class DatafeedConfig extends AbstractDiffable implements return aggSupplier.get(); } + /** + * Calls the lazy parser and returns any gathered deprecations + * @return The deprecations from parsing the aggregations + */ + public List getAggDeprecations() { + return getAggDeprecations(lazyAggParser); + } + + List getAggDeprecations(TriFunction, String, List, AggregatorFactories.Builder> parser) { + List deprecations = new ArrayList<>(); + parser.apply(aggregations, id, deprecations); + return deprecations; + } + public Map getAggregations() { return aggregations; } @@ -758,7 +788,8 @@ public class DatafeedConfig extends AbstractDiffable implements if (aggregations == null) { chunkingConfig = ChunkingConfig.newAuto(); } else { - long histogramIntervalMillis = ExtractorUtils.getHistogramIntervalMillis(lazyAggParser.apply(aggregations, id)); + long histogramIntervalMillis = + ExtractorUtils.getHistogramIntervalMillis(lazyAggParser.apply(aggregations, id, new ArrayList<>())); chunkingConfig = ChunkingConfig.newManual(TimeValue.timeValueMillis( DEFAULT_AGGREGATION_CHUNKING_BUCKETS * histogramIntervalMillis)); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/utils/LoggingDeprecationAccumulationHandler.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/utils/LoggingDeprecationAccumulationHandler.java index 1ab443b12de..2322b3d9026 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/utils/LoggingDeprecationAccumulationHandler.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/utils/LoggingDeprecationAccumulationHandler.java @@ -29,16 +29,14 @@ public class LoggingDeprecationAccumulationHandler implements DeprecationHandler public void usedDeprecatedName(String usedName, String modernName) { LoggingDeprecationHandler.INSTANCE.usedDeprecatedName(usedName, modernName); deprecations.add(LoggerMessageFormat.format("Deprecated field [{}] used, expected [{}] instead", - usedName, - modernName)); + new Object[] {usedName, modernName})); } @Override public void usedDeprecatedField(String usedName, String replacedWith) { LoggingDeprecationHandler.INSTANCE.usedDeprecatedField(usedName, replacedWith); deprecations.add(LoggerMessageFormat.format("Deprecated field [{}] used, replaced by [{}]", - usedName, - replacedWith)); + new Object[] {usedName, replacedWith})); } /** diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/utils/XContentObjectTransformer.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/utils/XContentObjectTransformer.java index 5d25b9d71e6..bbea1014183 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/utils/XContentObjectTransformer.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/utils/XContentObjectTransformer.java @@ -22,7 +22,9 @@ import org.elasticsearch.search.SearchModule; import org.elasticsearch.search.aggregations.AggregatorFactories; import java.io.IOException; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; import java.util.Map; /** @@ -46,7 +48,8 @@ public class XContentObjectTransformer { public static XContentObjectTransformer aggregatorTransformer() { return new XContentObjectTransformer<>(searchRegistry, (p) -> { // Serializing a map creates an object, need to skip the start object for the aggregation parser - assert(XContentParser.Token.START_OBJECT.equals(p.nextToken())); + XContentParser.Token token = p.nextToken(); + assert(XContentParser.Token.START_OBJECT.equals(token)); return AggregatorFactories.parseAggregators(p); }); } @@ -60,7 +63,27 @@ public class XContentObjectTransformer { this.registry = registry; } + /** + * Parses the map into the type T with the previously supplied parserFunction + * All deprecation warnings are ignored + * @param stringObjectMap The Map to parse into the Object + * @return parsed object T + * @throws IOException When there is an unforeseen parsing issue + */ public T fromMap(Map stringObjectMap) throws IOException { + return fromMap(stringObjectMap, new ArrayList<>()); + } + + /** + * Parses the map into the type T with the previously supplied parserFunction + * All deprecation warnings are added to the passed deprecationWarnings list. + * + * @param stringObjectMap The Map to parse into the Object + * @param deprecationWarnings The list to which to add all deprecation warnings + * @return parsed object T + * @throws IOException When there is an unforeseen parsing issue + */ + public T fromMap(Map stringObjectMap, List deprecationWarnings) throws IOException { if (stringObjectMap == null) { return null; } @@ -71,8 +94,9 @@ public class XContentObjectTransformer { .createParser(registry, deprecationLogger, BytesReference.bytes(xContentBuilder).streamInput())) { - //TODO do something with the accumulated deprecation warnings - return parserFunction.apply(parser); + T retVal = parserFunction.apply(parser); + deprecationWarnings.addAll(deprecationLogger.getDeprecations()); + return retVal; } } diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfigTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfigTests.java index 2787f67952a..d39fd35dd9c 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfigTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfigTests.java @@ -8,28 +8,38 @@ package org.elasticsearch.xpack.core.ml.datafeed; import com.carrotsearch.randomizedtesting.generators.CodepointSetGenerator; import org.elasticsearch.ElasticsearchException; +import org.elasticsearch.Version; +import org.elasticsearch.common.bytes.BytesReference; +import org.elasticsearch.common.io.stream.BytesStreamOutput; +import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput; import org.elasticsearch.common.io.stream.NamedWriteableRegistry; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.DeprecationHandler; import org.elasticsearch.common.xcontent.NamedXContentRegistry; import org.elasticsearch.common.xcontent.XContentFactory; +import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentParseException; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.index.query.BoolQueryBuilder; +import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.TermQueryBuilder; import org.elasticsearch.script.Script; import org.elasticsearch.search.SearchModule; import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.PipelineAggregatorBuilders; import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramAggregationBuilder; import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval; import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; import org.elasticsearch.search.aggregations.metrics.AvgAggregationBuilder; import org.elasticsearch.search.aggregations.metrics.MaxAggregationBuilder; +import org.elasticsearch.search.aggregations.pipeline.BucketScriptPipelineAggregationBuilder; +import org.elasticsearch.search.aggregations.pipeline.DerivativePipelineAggregationBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder.ScriptField; import org.elasticsearch.test.AbstractSerializingTestCase; @@ -47,9 +57,12 @@ import java.util.TimeZone; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo; +import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.lessThan; import static org.hamcrest.Matchers.not; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; public class DatafeedConfigTests extends AbstractSerializingTestCase { @@ -83,7 +96,7 @@ public class DatafeedConfigTests extends AbstractSerializingTestCase bucketSpanMillis ? bucketSpanMillis : aggHistogramInterval; @@ -567,6 +580,126 @@ public class DatafeedConfigTests extends AbstractSerializingTestCase deprecations = datafeed.getAggDeprecations((map, id, deprecationlist) -> { + deprecationlist.add(deprecationWarning); + return new AggregatorFactories.Builder().addAggregator(new MaxAggregationBuilder("field").field("field")); + }); + assertThat(deprecations, hasItem(deprecationWarning)); + + DatafeedConfig spiedConfig = spy(datafeed); + spiedConfig.getAggDeprecations(); + verify(spiedConfig).getAggDeprecations(DatafeedConfig.lazyAggParser); + } + + public void testGetQueryDeprecations() { + DatafeedConfig datafeed = createDatafeedWithDateHistogram("1h"); + String deprecationWarning = "Warning"; + List deprecations = datafeed.getQueryDeprecations((map, id, deprecationlist) -> { + deprecationlist.add(deprecationWarning); + return new BoolQueryBuilder(); + }); + assertThat(deprecations, hasItem(deprecationWarning)); + + DatafeedConfig spiedConfig = spy(datafeed); + spiedConfig.getQueryDeprecations(); + verify(spiedConfig).getQueryDeprecations(DatafeedConfig.lazyQueryParser); + } + + public void testSerializationOfComplexAggs() throws IOException { + MaxAggregationBuilder maxTime = AggregationBuilders.max("timestamp").field("timestamp"); + AvgAggregationBuilder avgAggregationBuilder = AggregationBuilders.avg("bytes_in_avg").field("system.network.in.bytes"); + DerivativePipelineAggregationBuilder derivativePipelineAggregationBuilder = + PipelineAggregatorBuilders.derivative("bytes_in_derivative", "bytes_in_avg"); + BucketScriptPipelineAggregationBuilder bucketScriptPipelineAggregationBuilder = + PipelineAggregatorBuilders.bucketScript("non_negative_bytes", + Collections.singletonMap("bytes", "bytes_in_derivative"), + new Script("params.bytes > 0 ? params.bytes : null")); + DateHistogramAggregationBuilder dateHistogram = + AggregationBuilders.dateHistogram("histogram_buckets") + .field("timestamp").interval(300000).timeZone(DateTimeZone.UTC) + .subAggregation(maxTime) + .subAggregation(avgAggregationBuilder) + .subAggregation(derivativePipelineAggregationBuilder) + .subAggregation(bucketScriptPipelineAggregationBuilder); + DatafeedConfig.Builder datafeedConfigBuilder = createDatafeedBuilderWithDateHistogram(dateHistogram); + QueryBuilder terms = + new BoolQueryBuilder().filter(new TermQueryBuilder(randomAlphaOfLengthBetween(1, 10), randomAlphaOfLengthBetween(1, 10))); + datafeedConfigBuilder.setParsedQuery(terms); + DatafeedConfig datafeedConfig = datafeedConfigBuilder.build(); + AggregatorFactories.Builder aggBuilder = new AggregatorFactories.Builder().addAggregator(dateHistogram); + + + XContentType xContentType = XContentType.JSON; + BytesReference bytes = XContentHelper.toXContent(datafeedConfig, xContentType, false); + XContentParser parser = XContentHelper.createParser(xContentRegistry(), + DeprecationHandler.THROW_UNSUPPORTED_OPERATION, + bytes, + xContentType); + + DatafeedConfig parsedDatafeedConfig = doParseInstance(parser); + assertEquals(datafeedConfig, parsedDatafeedConfig); + + // Assert that the parsed versions of our aggs and queries work as well + assertEquals(aggBuilder, parsedDatafeedConfig.getParsedAggregations()); + assertEquals(terms, parsedDatafeedConfig.getParsedQuery()); + + try(BytesStreamOutput output = new BytesStreamOutput()) { + datafeedConfig.writeTo(output); + try(StreamInput streamInput = output.bytes().streamInput()) { + DatafeedConfig streamedDatafeedConfig = new DatafeedConfig(streamInput); + assertEquals(datafeedConfig, streamedDatafeedConfig); + + // Assert that the parsed versions of our aggs and queries work as well + assertEquals(aggBuilder, streamedDatafeedConfig.getParsedAggregations()); + assertEquals(terms, streamedDatafeedConfig.getParsedQuery()); + } + } + } + + public void testSerializationOfComplexAggsBetweenVersions() throws IOException { + MaxAggregationBuilder maxTime = AggregationBuilders.max("timestamp").field("timestamp"); + AvgAggregationBuilder avgAggregationBuilder = AggregationBuilders.avg("bytes_in_avg").field("system.network.in.bytes"); + DerivativePipelineAggregationBuilder derivativePipelineAggregationBuilder = + PipelineAggregatorBuilders.derivative("bytes_in_derivative", "bytes_in_avg"); + BucketScriptPipelineAggregationBuilder bucketScriptPipelineAggregationBuilder = + PipelineAggregatorBuilders.bucketScript("non_negative_bytes", + Collections.singletonMap("bytes", "bytes_in_derivative"), + new Script("params.bytes > 0 ? params.bytes : null")); + DateHistogramAggregationBuilder dateHistogram = + AggregationBuilders.dateHistogram("histogram_buckets") + .field("timestamp").interval(300000).timeZone(DateTimeZone.UTC) + .subAggregation(maxTime) + .subAggregation(avgAggregationBuilder) + .subAggregation(derivativePipelineAggregationBuilder) + .subAggregation(bucketScriptPipelineAggregationBuilder); + DatafeedConfig.Builder datafeedConfigBuilder = createDatafeedBuilderWithDateHistogram(dateHistogram); + QueryBuilder terms = + new BoolQueryBuilder().filter(new TermQueryBuilder(randomAlphaOfLengthBetween(1, 10), randomAlphaOfLengthBetween(1, 10))); + datafeedConfigBuilder.setParsedQuery(terms); + DatafeedConfig datafeedConfig = datafeedConfigBuilder.build(); + + SearchModule searchModule = new SearchModule(Settings.EMPTY, false, Collections.emptyList()); + NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry(searchModule.getNamedWriteables()); + + try (BytesStreamOutput output = new BytesStreamOutput()) { + output.setVersion(Version.V_6_0_0); + datafeedConfig.writeTo(output); + try (StreamInput in = new NamedWriteableAwareStreamInput(output.bytes().streamInput(), namedWriteableRegistry)) { + in.setVersion(Version.V_6_0_0); + DatafeedConfig streamedDatafeedConfig = new DatafeedConfig(in); + assertEquals(datafeedConfig, streamedDatafeedConfig); + + // Assert that the parsed versions of our aggs and queries work as well + assertEquals(new AggregatorFactories.Builder().addAggregator(dateHistogram), + streamedDatafeedConfig.getParsedAggregations()); + assertEquals(terms, streamedDatafeedConfig.getParsedQuery()); + } + } + } + public static String randomValidDatafeedId() { CodepointSetGenerator generator = new CodepointSetGenerator("abcdefghijklmnopqrstuvwxyz".toCharArray()); return generator.ofCodePointsLength(random(), 10, 10); @@ -590,14 +723,18 @@ public class DatafeedConfigTests extends AbstractSerializingTestCase queryBuilderTransformer = new XContentObjectTransformer<>(NamedXContentRegistry.EMPTY, + (p)-> { + p.getDeprecationHandler().usedDeprecatedField("oldField", "newField"); + p.getDeprecationHandler().usedDeprecatedName("oldName", "modernName"); + return new BoolQueryBuilder(); + }); + List deprecations = new ArrayList<>(); + queryBuilderTransformer.fromMap(Collections.singletonMap("bool", "match"), deprecations); + + assertThat(deprecations, hasSize(2)); + assertThat(deprecations, hasItem("Deprecated field [oldField] used, replaced by [newField]")); + assertThat(deprecations, hasItem("Deprecated field [oldName] used, expected [modernName] instead")); + } + + @Override + protected boolean enableWarningsCheck() { + return false; + } + private void assertXContentAreEqual(ToXContentObject object, Map map) throws IOException { XContentType xContentType = XContentType.JSON; BytesReference objectReference = XContentHelper.toXContent(object, xContentType, EMPTY_PARAMS, false); diff --git a/x-pack/plugin/ml/build.gradle b/x-pack/plugin/ml/build.gradle index ab95b02ffdb..76f2daa0c5d 100644 --- a/x-pack/plugin/ml/build.gradle +++ b/x-pack/plugin/ml/build.gradle @@ -101,6 +101,8 @@ task internalClusterTest(type: RandomizedTestingTask, include '**/*IT.class' systemProperty 'es.set.netty.runtime.available.processors', 'false' } +check.dependsOn internalClusterTest +internalClusterTest.mustRunAfter test // add all sub-projects of the qa sub-project gradle.projectsEvaluated { diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStartDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStartDatafeedAction.java index de0caee778e..9e749ddf8b3 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStartDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStartDatafeedAction.java @@ -5,6 +5,7 @@ */ package org.elasticsearch.xpack.ml.action; +import org.elasticsearch.common.Strings; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchStatusException; import org.elasticsearch.ResourceAlreadyExistsException; @@ -47,7 +48,9 @@ import org.elasticsearch.xpack.ml.MachineLearning; import org.elasticsearch.xpack.ml.datafeed.DatafeedManager; import org.elasticsearch.xpack.ml.datafeed.DatafeedNodeSelector; import org.elasticsearch.xpack.ml.datafeed.extractor.DataExtractorFactory; +import org.elasticsearch.xpack.ml.notifications.Auditor; +import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Map; @@ -66,18 +69,20 @@ public class TransportStartDatafeedAction extends TransportMasterNodeAction deprecationWarnings = new ArrayList<>(); + deprecationWarnings.addAll(datafeed.getAggDeprecations()); + deprecationWarnings.addAll(datafeed.getQueryDeprecations()); + if (deprecationWarnings.isEmpty() == false) { + String msg = "datafeed [" + datafeed.getId() +"] configuration has deprecations. [" + + Strings.collectionToDelimitedString(deprecationWarnings, ", ") + "]"; + auditor.warning(job.getId(), msg); + } + + } + @Override protected String executor() { // This api doesn't do heavy or blocking operations (just delegates PersistentTasksService), @@ -142,6 +160,8 @@ public class TransportStartDatafeedAction extends TransportMasterNodeAction this.clear("license state changed")); + licenseState.addListener(this); } @Override public void close() throws ElasticsearchException { + licenseState.removeListener(this); clear("close"); } + @Override + public void licenseStateChanged() { + clear("license state changed"); + } + @Override public void clear(String reason) { logger.debug("full cache clear, reason [{}]", reason); diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java index f1f3993261e..286a6a7cc22 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java @@ -163,7 +163,7 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTestCase { assertAccessIsAllowed("u1", "PUT", "/" + randomIndex() + "/foo/_bulk", "{ \"index\" : { \"_id\" : \"123\" } }\n{ \"foo\" : \"bar\" }\n"); assertAccessIsAllowed("u1", - "GET", "/" + randomIndex() + "/foo/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); + "GET", "/" + randomIndex() + "/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); } public void testUserU2() throws Exception { @@ -180,7 +180,7 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTestCase { assertAccessIsAllowed("u2", "PUT", "/" + randomIndex() + "/foo/_bulk", "{ \"index\" : { \"_id\" : \"123\" } }\n{ \"foo\" : \"bar\" }\n"); assertAccessIsAllowed("u2", - "GET", "/" + randomIndex() + "/foo/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); + "GET", "/" + randomIndex() + "/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); } public void testUserU3() throws Exception { @@ -194,7 +194,7 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTestCase { assertAccessIsAllowed("u3", "PUT", "/" + randomIndex() + "/foo/_bulk", "{ \"index\" : { \"_id\" : \"123\" } }\n{ \"foo\" : \"bar\" }\n"); assertAccessIsAllowed("u3", - "GET", "/" + randomIndex() + "/foo/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); + "GET", "/" + randomIndex() + "/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); } public void testUserU4() throws Exception { @@ -218,7 +218,7 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTestCase { assertAccessIsDenied("u4", "PUT", "/" + randomIndex() + "/foo/_bulk", "{ \"index\" : { \"_id\" : \"123\" } }\n{ \"foo\" : \"bar\" }\n"); assertAccessIsAllowed("u4", - "GET", "/" + randomIndex() + "/foo/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); + "GET", "/" + randomIndex() + "/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); } public void testUserU5() throws Exception { @@ -237,7 +237,7 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTestCase { assertAccessIsDenied("u5", "PUT", "/" + randomIndex() + "/foo/_bulk", "{ \"index\" : { \"_id\" : \"123\" } }\n{ \"foo\" : \"bar\" }\n"); assertAccessIsAllowed("u5", - "GET", "/" + randomIndex() + "/foo/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); + "GET", "/" + randomIndex() + "/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); } public void testUserU6() throws Exception { @@ -253,7 +253,7 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTestCase { assertAccessIsAllowed("u6", "PUT", "/" + randomIndex() + "/foo/_bulk", "{ \"index\" : { \"_id\" : \"123\" } }\n{ \"foo\" : \"bar\" }\n"); assertAccessIsAllowed("u6", - "GET", "/" + randomIndex() + "/foo/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); + "GET", "/" + randomIndex() + "/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); } public void testUserU7() throws Exception { @@ -267,7 +267,7 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTestCase { assertAccessIsDenied("u7", "PUT", "/" + randomIndex() + "/foo/_bulk", "{ \"index\" : { \"_id\" : \"123\" } }\n{ \"foo\" : \"bar\" }\n"); assertAccessIsDenied("u7", - "GET", "/" + randomIndex() + "/foo/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); + "GET", "/" + randomIndex() + "/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); } public void testUserU8() throws Exception { @@ -281,7 +281,7 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTestCase { assertAccessIsAllowed("u8", "PUT", "/" + randomIndex() + "/foo/_bulk", "{ \"index\" : { \"_id\" : \"123\" } }\n{ \"foo\" : \"bar\" }\n"); assertAccessIsAllowed("u8", - "GET", "/" + randomIndex() + "/foo/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); + "GET", "/" + randomIndex() + "/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); } public void testUserU9() throws Exception { @@ -298,7 +298,7 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTestCase { assertAccessIsAllowed("u9", "PUT", "/" + randomIndex() + "/foo/_bulk", "{ \"index\" : { \"_id\" : \"123\" } }\n{ \"foo\" : \"bar\" }\n"); assertAccessIsAllowed("u9", - "GET", "/" + randomIndex() + "/foo/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); + "GET", "/" + randomIndex() + "/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); } public void testUserU11() throws Exception { @@ -321,7 +321,7 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTestCase { assertBodyHasAccessIsDenied("u11", "PUT", "/" + randomIndex() + "/foo/_bulk", "{ \"index\" : { \"_id\" : \"123\" } }\n{ \"foo\" : \"bar\" }\n"); assertAccessIsDenied("u11", - "GET", "/" + randomIndex() + "/foo/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); + "GET", "/" + randomIndex() + "/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); } public void testUserU12() throws Exception { @@ -338,7 +338,7 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTestCase { assertAccessIsAllowed("u12", "PUT", "/" + randomIndex() + "/foo/_bulk", "{ \"index\" : { \"_id\" : \"123\" } }\n{ \"foo\" : \"bar\" }\n"); assertAccessIsAllowed("u12", - "GET", "/" + randomIndex() + "/foo/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); + "GET", "/" + randomIndex() + "/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); } public void testUserU13() throws Exception { @@ -360,7 +360,7 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTestCase { assertAccessIsAllowed("u13", "PUT", "/a/foo/_bulk", "{ \"index\" : { \"_id\" : \"123\" } }\n{ \"foo\" : \"bar\" }\n"); assertBodyHasAccessIsDenied("u13", "PUT", "/b/foo/_bulk", "{ \"index\" : { \"_id\" : \"123\" } }\n{ \"foo\" : \"bar\" }\n"); assertAccessIsAllowed("u13", - "GET", "/" + randomIndex() + "/foo/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); + "GET", "/" + randomIndex() + "/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); } public void testUserU14() throws Exception { @@ -382,7 +382,7 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTestCase { assertAccessIsDenied("u14", "PUT", "/" + randomIndex() + "/foo/_bulk", "{ \"index\" : { \"_id\" : \"123\" } }\n{ \"foo\" : \"bar\" }\n"); assertAccessIsAllowed("u14", - "GET", "/" + randomIndex() + "/foo/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); + "GET", "/" + randomIndex() + "/_mtermvectors", "{ \"docs\" : [ { \"_id\": \"1\" }, { \"_id\": \"2\" } ] }"); } public void testThatUnknownUserIsRejectedProperly() throws Exception { diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/SecurityTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/SecurityTests.java index ec0a20faf58..e9924b9d852 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/SecurityTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/SecurityTests.java @@ -64,6 +64,8 @@ import java.util.function.Predicate; import java.util.stream.Collectors; import static org.elasticsearch.cluster.metadata.IndexMetaData.INDEX_FORMAT_SETTING; +import static org.elasticsearch.discovery.DiscoveryModule.ZEN2_DISCOVERY_TYPE; +import static org.elasticsearch.discovery.DiscoveryModule.ZEN_DISCOVERY_TYPE; import static org.elasticsearch.xpack.security.support.SecurityIndexManager.SECURITY_INDEX_NAME; import static org.elasticsearch.xpack.security.support.SecurityIndexManager.INTERNAL_INDEX_FORMAT; import static org.hamcrest.Matchers.containsString; @@ -281,7 +283,7 @@ public class SecurityTests extends ESTestCase { int numIters = randomIntBetween(1, 10); for (int i = 0; i < numIters; i++) { boolean tlsOn = randomBoolean(); - String discoveryType = randomFrom("single-node", "zen", randomAlphaOfLength(4)); + String discoveryType = randomFrom("single-node", ZEN_DISCOVERY_TYPE, ZEN2_DISCOVERY_TYPE, randomAlphaOfLength(4)); Security.ValidateTLSOnJoin validator = new Security.ValidateTLSOnJoin(tlsOn, discoveryType); MetaData.Builder builder = MetaData.builder(); License license = TestUtils.generateSignedLicense(TimeValue.timeValueHours(24)); diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/accesscontrol/OptOutQueryCacheTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/accesscontrol/OptOutQueryCacheTests.java index d2b6c736fd8..3eab5714371 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/accesscontrol/OptOutQueryCacheTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/accesscontrol/OptOutQueryCacheTests.java @@ -11,8 +11,8 @@ import org.apache.lucene.index.Term; import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.IndexSearcher; -import org.apache.lucene.search.ScoreMode; import org.apache.lucene.search.QueryCachingPolicy; +import org.apache.lucene.search.ScoreMode; import org.apache.lucene.search.TermQuery; import org.apache.lucene.search.Weight; import org.apache.lucene.store.Directory; @@ -184,6 +184,22 @@ public class OptOutQueryCacheTests extends ESTestCase { verify(indicesQueryCache).doCache(same(weight), same(policy)); } + public void testOptOutQueryCacheRemovesLicenseStateListenerOnClose() { + final Settings.Builder settings = Settings.builder() + .put("index.version.created", Version.CURRENT) + .put("index.number_of_shards", 1) + .put("index.number_of_replicas", 0); + final IndexMetaData indexMetaData = IndexMetaData.builder("index").settings(settings).build(); + final IndexSettings indexSettings = new IndexSettings(indexMetaData, Settings.EMPTY); + final IndicesQueryCache indicesQueryCache = mock(IndicesQueryCache.class); + final ThreadContext threadContext = new ThreadContext(Settings.EMPTY); + final XPackLicenseState licenseState = mock(XPackLicenseState.class); + final OptOutQueryCache cache = new OptOutQueryCache(indexSettings, indicesQueryCache, threadContext, licenseState); + verify(licenseState).addListener(cache); + cache.close(); + verify(licenseState).removeListener(cache); + } + private static FieldPermissionsDefinition fieldPermissionDef(String[] granted, String[] denied) { return new FieldPermissionsDefinition(granted, denied); } diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/nio/SSLChannelContextTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/nio/SSLChannelContextTests.java index bfee50b65bf..d7fe1bbda25 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/nio/SSLChannelContextTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/nio/SSLChannelContextTests.java @@ -10,8 +10,8 @@ import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.nio.BytesWriteHandler; import org.elasticsearch.nio.FlushReadyWrite; import org.elasticsearch.nio.InboundChannelBuffer; -import org.elasticsearch.nio.NioSocketChannel; import org.elasticsearch.nio.NioSelector; +import org.elasticsearch.nio.NioSocketChannel; import org.elasticsearch.nio.WriteOperation; import org.elasticsearch.test.ESTestCase; import org.junit.Before; @@ -68,12 +68,17 @@ public class SSLChannelContextTests extends ESTestCase { when(selector.isOnCurrentThread()).thenReturn(true); when(sslDriver.getNetworkReadBuffer()).thenReturn(readBuffer); when(sslDriver.getNetworkWriteBuffer()).thenReturn(writeBuffer); + ByteBuffer buffer = ByteBuffer.allocate(1 << 14); + when(selector.getIoBuffer()).thenAnswer(invocationOnMock -> { + buffer.clear(); + return buffer; + }); } public void testSuccessfulRead() throws IOException { byte[] bytes = createMessage(messageLength); - when(rawChannel.read(same(readBuffer))).thenReturn(bytes.length); + when(rawChannel.read(any(ByteBuffer.class))).thenReturn(bytes.length); doAnswer(getAnswerForBytes(bytes)).when(sslDriver).read(channelBuffer); when(readConsumer.apply(channelBuffer)).thenReturn(messageLength, 0); @@ -88,7 +93,7 @@ public class SSLChannelContextTests extends ESTestCase { public void testMultipleReadsConsumed() throws IOException { byte[] bytes = createMessage(messageLength * 2); - when(rawChannel.read(same(readBuffer))).thenReturn(bytes.length); + when(rawChannel.read(any(ByteBuffer.class))).thenReturn(bytes.length); doAnswer(getAnswerForBytes(bytes)).when(sslDriver).read(channelBuffer); when(readConsumer.apply(channelBuffer)).thenReturn(messageLength, messageLength, 0); @@ -103,7 +108,7 @@ public class SSLChannelContextTests extends ESTestCase { public void testPartialRead() throws IOException { byte[] bytes = createMessage(messageLength); - when(rawChannel.read(same(readBuffer))).thenReturn(bytes.length); + when(rawChannel.read(any(ByteBuffer.class))).thenReturn(bytes.length); doAnswer(getAnswerForBytes(bytes)).when(sslDriver).read(channelBuffer); @@ -212,7 +217,7 @@ public class SSLChannelContextTests extends ESTestCase { context.flushChannel(); verify(sslDriver, times(2)).nonApplicationWrite(); - verify(rawChannel, times(2)).write(sslDriver.getNetworkWriteBuffer()); + verify(rawChannel, times(2)).write(same(selector.getIoBuffer())); } public void testNonAppWritesStopIfBufferNotFullyFlushed() throws Exception { @@ -223,7 +228,7 @@ public class SSLChannelContextTests extends ESTestCase { context.flushChannel(); verify(sslDriver, times(1)).nonApplicationWrite(); - verify(rawChannel, times(1)).write(sslDriver.getNetworkWriteBuffer()); + verify(rawChannel, times(1)).write(same(selector.getIoBuffer())); } public void testQueuedWriteIsFlushedInFlushCall() throws Exception { @@ -240,7 +245,7 @@ public class SSLChannelContextTests extends ESTestCase { context.flushChannel(); verify(flushOperation).incrementIndex(10); - verify(rawChannel, times(1)).write(sslDriver.getNetworkWriteBuffer()); + verify(rawChannel, times(1)).write(same(selector.getIoBuffer())); verify(selector).executeListener(listener, null); assertFalse(context.readyForFlush()); } @@ -258,8 +263,7 @@ public class SSLChannelContextTests extends ESTestCase { when(flushOperation.isFullyFlushed()).thenReturn(false, false); context.flushChannel(); - verify(flushOperation).incrementIndex(5); - verify(rawChannel, times(1)).write(sslDriver.getNetworkWriteBuffer()); + verify(rawChannel, times(1)).write(same(selector.getIoBuffer())); verify(selector, times(0)).executeListener(listener, null); assertTrue(context.readyForFlush()); } @@ -287,7 +291,7 @@ public class SSLChannelContextTests extends ESTestCase { context.flushChannel(); verify(flushOperation1, times(2)).incrementIndex(5); - verify(rawChannel, times(3)).write(sslDriver.getNetworkWriteBuffer()); + verify(rawChannel, times(3)).write(same(selector.getIoBuffer())); verify(selector).executeListener(listener, null); verify(selector, times(0)).executeListener(listener2, null); assertTrue(context.readyForFlush()); @@ -304,7 +308,7 @@ public class SSLChannelContextTests extends ESTestCase { when(sslDriver.hasFlushPending()).thenReturn(false, false); when(sslDriver.readyForApplicationWrites()).thenReturn(true); when(sslDriver.applicationWrite(buffers)).thenReturn(5); - when(rawChannel.write(sslDriver.getNetworkWriteBuffer())).thenThrow(exception); + when(rawChannel.write(any(ByteBuffer.class))).thenThrow(exception); when(flushOperation.isFullyFlushed()).thenReturn(false); expectThrows(IOException.class, () -> context.flushChannel()); @@ -317,7 +321,7 @@ public class SSLChannelContextTests extends ESTestCase { when(sslDriver.hasFlushPending()).thenReturn(true); when(sslDriver.needsNonApplicationWrite()).thenReturn(true); when(sslDriver.readyForApplicationWrites()).thenReturn(false); - when(rawChannel.write(sslDriver.getNetworkWriteBuffer())).thenThrow(new IOException()); + when(rawChannel.write(any(ByteBuffer.class))).thenThrow(new IOException()); assertFalse(context.selectorShouldClose()); expectThrows(IOException.class, () -> context.flushChannel()); diff --git a/x-pack/plugin/sql/sql-action/licenses/lucene-core-8.0.0-snapshot-aaa64d70159.jar.sha1 b/x-pack/plugin/sql/sql-action/licenses/lucene-core-8.0.0-snapshot-aaa64d70159.jar.sha1 new file mode 100644 index 00000000000..06ff778cdf4 --- /dev/null +++ b/x-pack/plugin/sql/sql-action/licenses/lucene-core-8.0.0-snapshot-aaa64d70159.jar.sha1 @@ -0,0 +1 @@ +4367ce6eeceb1aefd34909dd54f37e5ba1d19155 \ No newline at end of file diff --git a/x-pack/plugin/sql/sql-action/licenses/lucene-core-8.0.0-snapshot-c78429a554.jar.sha1 b/x-pack/plugin/sql/sql-action/licenses/lucene-core-8.0.0-snapshot-c78429a554.jar.sha1 deleted file mode 100644 index ad0dba43211..00000000000 --- a/x-pack/plugin/sql/sql-action/licenses/lucene-core-8.0.0-snapshot-c78429a554.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -a6149ea94d695ebad4e5037f2926ca20c768777d \ No newline at end of file diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/datafeeds_crud.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/datafeeds_crud.yml index 6e11a1dddc7..d9e4c5ba641 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/datafeeds_crud.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/datafeeds_crud.yml @@ -11,7 +11,8 @@ setup: "job_id":"datafeeds-crud-1", "analysis_config" : { "bucket_span": "1h", - "detectors" :[{"function":"count"}] + "detectors" :[{"function":"count"}], + "summary_count_field_name": "doc_count" }, "data_description" : { "format":"xcontent", @@ -321,6 +322,61 @@ setup: - match: { chunking_config.mode: "manual" } - match: { chunking_config.time_span: "1h" } +--- +"Test put datafeed with aggregations": + - do: + xpack.ml.put_datafeed: + datafeed_id: test-datafeed-aggs-1 + body: > + { + "job_id":"datafeeds-crud-1", + "indices":["index-foo"], + "types":["type-bar"], + "aggs": { + "histogram_buckets":{ + "date_histogram": { + "field": "@timestamp", + "interval": "5m", + "time_zone": "UTC", + "min_doc_count": 0 + }, + "aggs": { + "@timestamp": { + "max": { + "field": "@timestamp" + } + }, + "bytes_in_avg": { + "avg": { + "field": "system.network.in.bytes" + } + }, + "bytes_in_derivative": { + "derivative": { + "buckets_path": "bytes_in_avg" + } + }, + "non_negative_bytes": { + "bucket_script": { + "buckets_path": { + "bytes": "bytes_in_derivative" + }, + "script": "params.bytes > 0 ? params.bytes : null" + } + } + } + } + } + } + - do: + xpack.ml.get_datafeeds: + datafeed_id: test-datafeed-aggs-1 + - match: { datafeeds.0.datafeed_id: "test-datafeed-aggs-1" } + - match: { datafeeds.0.aggregations.histogram_buckets.date_histogram.field: "@timestamp" } + - match: { datafeeds.0.aggregations.histogram_buckets.aggregations.@timestamp.max.field: "@timestamp" } + - match: { datafeeds.0.aggregations.histogram_buckets.aggregations.bytes_in_avg.avg.field: "system.network.in.bytes" } + - match: { datafeeds.0.aggregations.histogram_buckets.aggregations.non_negative_bytes.bucket_script.buckets_path.bytes: "bytes_in_derivative" } + --- "Test delete datafeed": - do: diff --git a/x-pack/plugin/upgrade/build.gradle b/x-pack/plugin/upgrade/build.gradle index 4ee315af910..3ba8f30f874 100644 --- a/x-pack/plugin/upgrade/build.gradle +++ b/x-pack/plugin/upgrade/build.gradle @@ -36,6 +36,8 @@ task internalClusterTest(type: RandomizedTestingTask, include '**/*IT.class' systemProperty 'es.set.netty.runtime.available.processors', 'false' } +check.dependsOn internalClusterTest +internalClusterTest.mustRunAfter test // also add an "alias" task to make typing on the command line easier task icTest { diff --git a/x-pack/qa/rolling-upgrade-basic/build.gradle b/x-pack/qa/rolling-upgrade-basic/build.gradle index da070850864..6bf085841fb 100644 --- a/x-pack/qa/rolling-upgrade-basic/build.gradle +++ b/x-pack/qa/rolling-upgrade-basic/build.gradle @@ -66,6 +66,8 @@ for (Version version : bwcVersions.wireCompatible) { setting 'xpack.watcher.enabled', 'false' setting 'xpack.license.self_generated.type', 'basic' setting 'node.name', "upgraded-node-${stopNode}" + // TODO: Move to Zen2 once we support rolling upgrade with Zen2 + setting 'discovery.type', 'zen' } } diff --git a/x-pack/qa/rolling-upgrade/build.gradle b/x-pack/qa/rolling-upgrade/build.gradle index 8a3a322efcc..68270032c89 100644 --- a/x-pack/qa/rolling-upgrade/build.gradle +++ b/x-pack/qa/rolling-upgrade/build.gradle @@ -215,6 +215,8 @@ subprojects { if (version.before('6.0.0')) { keystoreSetting 'xpack.security.authc.token.passphrase', 'token passphrase' } + // TODO: Move to Zen2 once we support rolling upgrade with Zen2 + setting 'discovery.type', 'zen' } }