Skip to content

Commit

Permalink
Merge branch 'master' into feature/query-refactoring
Browse files Browse the repository at this point in the history
 Conflicts:
	core/src/main/java/org/elasticsearch/index/query/FuzzyQueryBuilder.java
	core/src/main/java/org/elasticsearch/index/query/FuzzyQueryParser.java
	core/src/main/java/org/elasticsearch/index/query/RegexpQueryBuilder.java
	core/src/main/java/org/elasticsearch/index/query/RegexpQueryParser.java
  • Loading branch information
cbuescher committed Jul 8, 2015
2 parents a0cccec + a6c0007 commit fc1b178
Show file tree
Hide file tree
Showing 211 changed files with 7,394 additions and 3,205 deletions.
44 changes: 44 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,50 @@
</execution>
</executions>
</plugin>
<!-- integration tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<!-- start up external cluster -->
<execution>
<id>integ-setup</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<ant antfile="${elasticsearch.tools.directory}/ant/integration-tests.xml"
target="start-external-cluster"/>
</target>
</configuration>
</execution>
<!-- shut down external cluster -->
<execution>
<id>integ-teardown</id>
<phase>post-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<ant antfile="${elasticsearch.tools.directory}/ant/integration-tests.xml"
target="stop-external-cluster"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<tests.cluster>127.0.0.1:9300</tests.cluster>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,7 @@ private Query getFuzzyQuerySingle(String field, String termStr, String minSimila
currentFieldType = parseContext.fieldMapper(field);
if (currentFieldType != null) {
try {
//LUCENE 4 UPGRADE I disabled transpositions here by default - maybe this needs to be changed
return currentFieldType.fuzzyQuery(termStr, Fuzziness.build(minSimilarity), fuzzyPrefixLength, settings.fuzzyMaxExpansions(), false);
return currentFieldType.fuzzyQuery(termStr, Fuzziness.build(minSimilarity), fuzzyPrefixLength, settings.fuzzyMaxExpansions(), FuzzyQuery.defaultTranspositions);
} catch (RuntimeException e) {
if (settings.lenient()) {
return null;
Expand All @@ -444,8 +443,7 @@ private Query getFuzzyQuerySingle(String field, String termStr, String minSimila
protected Query newFuzzyQuery(Term term, float minimumSimilarity, int prefixLength) {
String text = term.text();
int numEdits = FuzzyQuery.floatToEdits(minimumSimilarity, text.codePointCount(0, text.length()));
//LUCENE 4 UPGRADE I disabled transpositions here by default - maybe this needs to be changed
FuzzyQuery query = new FuzzyQuery(term, numEdits, prefixLength, settings.fuzzyMaxExpansions(), false);
FuzzyQuery query = new FuzzyQuery(term, numEdits, prefixLength, settings.fuzzyMaxExpansions(), FuzzyQuery.defaultTranspositions);
QueryParsers.setRewriteMethod(query, settings.fuzzyRewriteMethod());
return query;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.http.HttpInfo;
import org.elasticsearch.monitor.jvm.JvmInfo;
import org.elasticsearch.monitor.network.NetworkInfo;
import org.elasticsearch.monitor.os.OsInfo;
import org.elasticsearch.monitor.process.ProcessInfo;
import org.elasticsearch.threadpool.ThreadPoolInfo;
Expand Down Expand Up @@ -65,9 +64,6 @@ public class NodeInfo extends BaseNodeResponse {
@Nullable
private ThreadPoolInfo threadPool;

@Nullable
private NetworkInfo network;

@Nullable
private TransportInfo transport;

Expand All @@ -81,7 +77,7 @@ public class NodeInfo extends BaseNodeResponse {
}

public NodeInfo(Version version, Build build, DiscoveryNode node, @Nullable ImmutableMap<String, String> serviceAttributes, @Nullable Settings settings,
@Nullable OsInfo os, @Nullable ProcessInfo process, @Nullable JvmInfo jvm, @Nullable ThreadPoolInfo threadPool, @Nullable NetworkInfo network,
@Nullable OsInfo os, @Nullable ProcessInfo process, @Nullable JvmInfo jvm, @Nullable ThreadPoolInfo threadPool,
@Nullable TransportInfo transport, @Nullable HttpInfo http, @Nullable PluginsInfo plugins) {
super(node);
this.version = version;
Expand All @@ -92,7 +88,6 @@ public NodeInfo(Version version, Build build, DiscoveryNode node, @Nullable Immu
this.process = process;
this.jvm = jvm;
this.threadPool = threadPool;
this.network = network;
this.transport = transport;
this.http = http;
this.plugins = plugins;
Expand Down Expand Up @@ -165,14 +160,6 @@ public ThreadPoolInfo getThreadPool() {
return this.threadPool;
}

/**
* Network level information.
*/
@Nullable
public NetworkInfo getNetwork() {
return network;
}

@Nullable
public TransportInfo getTransport() {
return transport;
Expand Down Expand Up @@ -222,9 +209,6 @@ public void readFrom(StreamInput in) throws IOException {
if (in.readBoolean()) {
threadPool = ThreadPoolInfo.readThreadPoolInfo(in);
}
if (in.readBoolean()) {
network = NetworkInfo.readNetworkInfo(in);
}
if (in.readBoolean()) {
transport = TransportInfo.readTransportInfo(in);
}
Expand Down Expand Up @@ -281,12 +265,6 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(true);
threadPool.writeTo(out);
}
if (network == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
network.writeTo(out);
}
if (transport == null) {
out.writeBoolean(false);
} else {
Expand All @@ -306,5 +284,4 @@ public void writeTo(StreamOutput out) throws IOException {
plugins.writeTo(out);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
if (nodeInfo.getThreadPool() != null) {
nodeInfo.getThreadPool().toXContent(builder, params);
}
if (nodeInfo.getNetwork() != null) {
nodeInfo.getNetwork().toXContent(builder, params);
}
if (nodeInfo.getTransport() != null) {
nodeInfo.getTransport().toXContent(builder, params);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
import org.elasticsearch.http.HttpStats;
import org.elasticsearch.indices.NodeIndicesStats;
import org.elasticsearch.indices.breaker.AllCircuitBreakerStats;
import org.elasticsearch.monitor.fs.FsStats;
import org.elasticsearch.monitor.fs.FsInfo;
import org.elasticsearch.monitor.jvm.JvmStats;
import org.elasticsearch.monitor.network.NetworkStats;
import org.elasticsearch.monitor.os.OsStats;
import org.elasticsearch.monitor.process.ProcessStats;
import org.elasticsearch.threadpool.ThreadPoolStats;
Expand Down Expand Up @@ -63,10 +62,7 @@ public class NodeStats extends BaseNodeResponse implements ToXContent {
private ThreadPoolStats threadPool;

@Nullable
private NetworkStats network;

@Nullable
private FsStats fs;
private FsInfo fs;

@Nullable
private TransportStats transport;
Expand All @@ -82,7 +78,7 @@ public class NodeStats extends BaseNodeResponse implements ToXContent {

public NodeStats(DiscoveryNode node, long timestamp, @Nullable NodeIndicesStats indices,
@Nullable OsStats os, @Nullable ProcessStats process, @Nullable JvmStats jvm, @Nullable ThreadPoolStats threadPool,
@Nullable NetworkStats network, @Nullable FsStats fs, @Nullable TransportStats transport, @Nullable HttpStats http,
@Nullable FsInfo fs, @Nullable TransportStats transport, @Nullable HttpStats http,
@Nullable AllCircuitBreakerStats breaker) {
super(node);
this.timestamp = timestamp;
Expand All @@ -91,7 +87,6 @@ public NodeStats(DiscoveryNode node, long timestamp, @Nullable NodeIndicesStats
this.process = process;
this.jvm = jvm;
this.threadPool = threadPool;
this.network = network;
this.fs = fs;
this.transport = transport;
this.http = http;
Expand Down Expand Up @@ -147,19 +142,11 @@ public ThreadPoolStats getThreadPool() {
return this.threadPool;
}

/**
* Network level statistics.
*/
@Nullable
public NetworkStats getNetwork() {
return network;
}

/**
* File system level stats.
*/
@Nullable
public FsStats getFs() {
public FsInfo getFs() {
return fs;
}

Expand Down Expand Up @@ -204,10 +191,7 @@ public void readFrom(StreamInput in) throws IOException {
threadPool = ThreadPoolStats.readThreadPoolStats(in);
}
if (in.readBoolean()) {
network = NetworkStats.readNetworkStats(in);
}
if (in.readBoolean()) {
fs = FsStats.readFsStats(in);
fs = FsInfo.readFsInfo(in);
}
if (in.readBoolean()) {
transport = TransportStats.readTransportStats(in);
Expand Down Expand Up @@ -253,12 +237,6 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(true);
threadPool.writeTo(out);
}
if (network == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
network.writeTo(out);
}
if (fs == null) {
out.writeBoolean(false);
} else {
Expand Down Expand Up @@ -313,9 +291,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
if (getThreadPool() != null) {
getThreadPool().toXContent(builder, params);
}
if (getNetwork() != null) {
getNetwork().toXContent(builder, params);
}
if (getFs() != null) {
getFs().toXContent(builder, params);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.monitor.fs.FsStats;
import org.elasticsearch.monitor.fs.FsInfo;
import org.elasticsearch.monitor.jvm.JvmInfo;
import org.elasticsearch.monitor.os.OsInfo;

Expand All @@ -52,7 +52,7 @@ public class ClusterStatsNodes implements ToXContent, Streamable {
private OsStats os;
private ProcessStats process;
private JvmStats jvm;
private FsStats.Info fs;
private FsInfo.Path fs;
private Set<PluginInfo> plugins;

private ClusterStatsNodes() {
Expand All @@ -63,7 +63,7 @@ public ClusterStatsNodes(ClusterStatsNodeResponse[] nodeResponses) {
this.versions = new HashSet<>();
this.os = new OsStats();
this.jvm = new JvmStats();
this.fs = new FsStats.Info();
this.fs = new FsInfo.Path();
this.plugins = new HashSet<>();
this.process = new ProcessStats();

Expand Down Expand Up @@ -116,7 +116,7 @@ public JvmStats getJvm() {
return jvm;
}

public FsStats.Info getFs() {
public FsInfo.Path getFs() {
return fs;
}

Expand All @@ -138,7 +138,7 @@ public void readFrom(StreamInput in) throws IOException {
os = OsStats.readOsStats(in);
process = ProcessStats.readStats(in);
jvm = JvmStats.readJvmStats(in);
fs = FsStats.Info.readInfoFrom(in);
fs = FsInfo.Path.readInfoFrom(in);

size = in.readVInt();
plugins = new HashSet<>(size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

package org.elasticsearch.action.bulk;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.action.ActionWriteResponse;
import org.elasticsearch.action.delete.DeleteResponse;
Expand All @@ -28,7 +27,6 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.RestStatus;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ private boolean setResponseFailureIfIndexMatches(AtomicArray<BulkItemResponse> r
} else if (request instanceof DeleteRequest) {
DeleteRequest deleteRequest = (DeleteRequest) request;
if (index.equals(deleteRequest.index())) {
responses.set(idx, new BulkItemResponse(idx, "index", new BulkItemResponse.Failure(deleteRequest.index(), deleteRequest.type(), deleteRequest.id(), e)));
responses.set(idx, new BulkItemResponse(idx, "delete", new BulkItemResponse.Failure(deleteRequest.index(), deleteRequest.type(), deleteRequest.id(), e)));
return true;
}
} else if (request instanceof UpdateRequest) {
UpdateRequest updateRequest = (UpdateRequest) request;
if (index.equals(updateRequest.index())) {
responses.set(idx, new BulkItemResponse(idx, "index", new BulkItemResponse.Failure(updateRequest.index(), updateRequest.type(), updateRequest.id(), e)));
responses.set(idx, new BulkItemResponse(idx, "update", new BulkItemResponse.Failure(updateRequest.index(), updateRequest.type(), updateRequest.id(), e)));
return true;
}
} else {
Expand Down Expand Up @@ -379,7 +379,15 @@ private boolean addFailureIfIndexIsUnavailable(DocumentRequest request, BulkRequ
if (unavailableException != null) {
BulkItemResponse.Failure failure = new BulkItemResponse.Failure(request.index(), request.type(), request.id(),
unavailableException);
BulkItemResponse bulkItemResponse = new BulkItemResponse(idx, "index", failure);
String operationType = "unknown";
if (request instanceof IndexRequest) {
operationType = "index";
} else if (request instanceof DeleteRequest) {
operationType = "delete";
} else if (request instanceof UpdateRequest) {
operationType = "update";
}
BulkItemResponse bulkItemResponse = new BulkItemResponse(idx, operationType, failure);
responses.set(idx, bulkItemResponse);
// make sure the request gets never processed again
bulkRequest.requests.set(idx, null);
Expand Down
Loading

0 comments on commit fc1b178

Please sign in to comment.