Merge branch 'master' into feature/client_aggs_parsing
This commit is contained in:
commit
39e791291e
|
@ -44,6 +44,7 @@ import org.apache.lucene.util.IOUtils;
|
||||||
import org.apache.lucene.util.automaton.RegExp;
|
import org.apache.lucene.util.automaton.RegExp;
|
||||||
import org.elasticsearch.common.lucene.search.Queries;
|
import org.elasticsearch.common.lucene.search.Queries;
|
||||||
import org.elasticsearch.common.unit.Fuzziness;
|
import org.elasticsearch.common.unit.Fuzziness;
|
||||||
|
import org.elasticsearch.index.mapper.AllFieldMapper;
|
||||||
import org.elasticsearch.index.mapper.DateFieldMapper;
|
import org.elasticsearch.index.mapper.DateFieldMapper;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.MapperService;
|
import org.elasticsearch.index.mapper.MapperService;
|
||||||
|
@ -569,7 +570,11 @@ public class MapperQueryParser extends AnalyzingQueryParser {
|
||||||
@Override
|
@Override
|
||||||
protected Query getWildcardQuery(String field, String termStr) throws ParseException {
|
protected Query getWildcardQuery(String field, String termStr) throws ParseException {
|
||||||
if (termStr.equals("*") && field != null) {
|
if (termStr.equals("*") && field != null) {
|
||||||
if ("*".equals(field)) {
|
/**
|
||||||
|
* We rewrite _all:* to a match all query.
|
||||||
|
* TODO: We can remove this special case when _all is completely removed.
|
||||||
|
*/
|
||||||
|
if ("*".equals(field) || AllFieldMapper.NAME.equals(field)) {
|
||||||
return newMatchAllDocsQuery();
|
return newMatchAllDocsQuery();
|
||||||
}
|
}
|
||||||
String actualField = field;
|
String actualField = field;
|
||||||
|
|
|
@ -249,8 +249,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase {
|
||||||
String[] newNodes = internalCluster().startNodes(2, settings).stream().toArray(String[]::new);
|
String[] newNodes = internalCluster().startNodes(2, settings).stream().toArray(String[]::new);
|
||||||
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
clusterHealthResponse = client().admin().cluster().prepareHealth().setWaitForNodes("4").execute().actionGet();
|
internalCluster().validateClusterFormed();
|
||||||
assertThat(clusterHealthResponse.isTimedOut(), equalTo(false));
|
|
||||||
|
|
||||||
state = client().admin().cluster().prepareState().execute().actionGet().getState();
|
state = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||||
assertThat(state.nodes().getSize(), equalTo(4));
|
assertThat(state.nodes().getSize(), equalTo(4));
|
||||||
|
|
|
@ -56,11 +56,13 @@ import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import static java.util.Collections.emptyMap;
|
import static java.util.Collections.emptyMap;
|
||||||
import static java.util.Collections.emptySet;
|
import static java.util.Collections.emptySet;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
|
import static org.hamcrest.Matchers.either;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
import static org.hamcrest.Matchers.not;
|
import static org.hamcrest.Matchers.not;
|
||||||
|
@ -131,10 +133,10 @@ public class ZenDiscoveryIT extends ESIntegTestCase {
|
||||||
client().admin().cluster().prepareHealth().setWaitForNodes("3").get();
|
client().admin().cluster().prepareHealth().setWaitForNodes("3").get();
|
||||||
|
|
||||||
ClusterService clusterService = internalCluster().getInstance(ClusterService.class, master);
|
ClusterService clusterService = internalCluster().getInstance(ClusterService.class, master);
|
||||||
final ArrayList<ClusterState> statesFound = new ArrayList<>();
|
final AtomicInteger numUpdates = new AtomicInteger();
|
||||||
final CountDownLatch nodesStopped = new CountDownLatch(1);
|
final CountDownLatch nodesStopped = new CountDownLatch(1);
|
||||||
clusterService.addStateApplier(event -> {
|
clusterService.addStateApplier(event -> {
|
||||||
statesFound.add(event.state());
|
numUpdates.incrementAndGet();
|
||||||
try {
|
try {
|
||||||
// block until both nodes have stopped to accumulate node failures
|
// block until both nodes have stopped to accumulate node failures
|
||||||
nodesStopped.await();
|
nodesStopped.await();
|
||||||
|
@ -148,7 +150,7 @@ public class ZenDiscoveryIT extends ESIntegTestCase {
|
||||||
nodesStopped.countDown();
|
nodesStopped.countDown();
|
||||||
|
|
||||||
client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).get(); // wait for all to be processed
|
client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).get(); // wait for all to be processed
|
||||||
assertThat(statesFound, Matchers.hasSize(2));
|
assertThat(numUpdates.get(), either(equalTo(1)).or(equalTo(2))); // due to batching, both nodes can be handled in same CS update
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNodeRejectsClusterStateWithWrongMasterNode() throws Exception {
|
public void testNodeRejectsClusterStateWithWrongMasterNode() throws Exception {
|
||||||
|
|
|
@ -822,7 +822,7 @@ public class QueryStringQueryBuilderTests extends AbstractQueryTestCase<QueryStr
|
||||||
|
|
||||||
queryBuilder = new QueryStringQueryBuilder("_all:*");
|
queryBuilder = new QueryStringQueryBuilder("_all:*");
|
||||||
query = queryBuilder.toQuery(context);
|
query = queryBuilder.toQuery(context);
|
||||||
expected = new ConstantScoreQuery(new TermQuery(new Term("_field_names", "_all")));
|
expected = new MatchAllDocsQuery();
|
||||||
assertThat(query, equalTo(expected));
|
assertThat(query, equalTo(expected));
|
||||||
|
|
||||||
queryBuilder = new QueryStringQueryBuilder("*:*");
|
queryBuilder = new QueryStringQueryBuilder("*:*");
|
||||||
|
|
|
@ -160,7 +160,9 @@ public class TopHitsTests extends BaseAggregationTestCase<TopHitsAggregationBuil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
factory.highlighter(HighlightBuilderTests.randomHighlighterBuilder());
|
// parent test shuffles xContent, we need to make sure highlight fields are ordered
|
||||||
|
factory.highlighter(
|
||||||
|
HighlightBuilderTests.randomHighlighterBuilder().useExplicitFieldOrder(true));
|
||||||
}
|
}
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import java.io.InputStreamReader;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.attribute.PosixFileAttributeView;
|
||||||
import java.nio.file.attribute.PosixFilePermission;
|
import java.nio.file.attribute.PosixFilePermission;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -188,19 +189,23 @@ public class SpawnerNoBootstrapTests extends LuceneTestCase {
|
||||||
equalTo("plugin [test_plugin] does not have permission to fork native controller"));
|
equalTo("plugin [test_plugin] does not have permission to fork native controller"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createControllerProgram(Path outputFile) throws IOException {
|
private void createControllerProgram(final Path outputFile) throws IOException {
|
||||||
Path outputDir = outputFile.getParent();
|
final Path outputDir = outputFile.getParent();
|
||||||
Files.createDirectories(outputDir);
|
Files.createDirectories(outputDir);
|
||||||
Files.write(outputFile, CONTROLLER_SOURCE.getBytes(StandardCharsets.UTF_8));
|
Files.write(outputFile, CONTROLLER_SOURCE.getBytes(StandardCharsets.UTF_8));
|
||||||
Set<PosixFilePermission> perms = new HashSet<>();
|
final PosixFileAttributeView view =
|
||||||
perms.add(PosixFilePermission.OWNER_READ);
|
Files.getFileAttributeView(outputFile, PosixFileAttributeView.class);
|
||||||
perms.add(PosixFilePermission.OWNER_WRITE);
|
if (view != null) {
|
||||||
perms.add(PosixFilePermission.OWNER_EXECUTE);
|
final Set<PosixFilePermission> perms = new HashSet<>();
|
||||||
perms.add(PosixFilePermission.GROUP_READ);
|
perms.add(PosixFilePermission.OWNER_READ);
|
||||||
perms.add(PosixFilePermission.GROUP_EXECUTE);
|
perms.add(PosixFilePermission.OWNER_WRITE);
|
||||||
perms.add(PosixFilePermission.OTHERS_READ);
|
perms.add(PosixFilePermission.OWNER_EXECUTE);
|
||||||
perms.add(PosixFilePermission.OTHERS_EXECUTE);
|
perms.add(PosixFilePermission.GROUP_READ);
|
||||||
Files.setPosixFilePermissions(outputFile, perms);
|
perms.add(PosixFilePermission.GROUP_EXECUTE);
|
||||||
|
perms.add(PosixFilePermission.OTHERS_READ);
|
||||||
|
perms.add(PosixFilePermission.OTHERS_EXECUTE);
|
||||||
|
Files.setPosixFilePermissions(outputFile, perms);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1059,13 +1059,13 @@ public final class InternalTestCluster extends TestCluster {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ensure a cluster is formed with all published nodes. */
|
/** ensure a cluster is formed with all published nodes. */
|
||||||
private void validateClusterFormed() {
|
public synchronized void validateClusterFormed() {
|
||||||
String name = randomFrom(random, getNodeNames());
|
String name = randomFrom(random, getNodeNames());
|
||||||
validateClusterFormed(name);
|
validateClusterFormed(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ensure a cluster is formed with all published nodes, but do so by using the client of the specified node */
|
/** ensure a cluster is formed with all published nodes, but do so by using the client of the specified node */
|
||||||
private void validateClusterFormed(String viaNode) {
|
public synchronized void validateClusterFormed(String viaNode) {
|
||||||
Set<DiscoveryNode> expectedNodes = new HashSet<>();
|
Set<DiscoveryNode> expectedNodes = new HashSet<>();
|
||||||
for (NodeAndClient nodeAndClient : nodes.values()) {
|
for (NodeAndClient nodeAndClient : nodes.values()) {
|
||||||
expectedNodes.add(getInstanceFromNode(ClusterService.class, nodeAndClient.node()).localNode());
|
expectedNodes.add(getInstanceFromNode(ClusterService.class, nodeAndClient.node()).localNode());
|
||||||
|
|
Loading…
Reference in New Issue