Skip to content

Commit fc1b178

Browse files
committed
Merge branch 'master' into feature/query-refactoring
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
2 parents a0cccec + a6c0007 commit fc1b178

File tree

211 files changed

+7394
-3205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+7394
-3205
lines changed

core/pom.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,50 @@
10241024
</execution>
10251025
</executions>
10261026
</plugin>
1027+
<!-- integration tests -->
1028+
<plugin>
1029+
<groupId>org.apache.maven.plugins</groupId>
1030+
<artifactId>maven-antrun-plugin</artifactId>
1031+
<executions>
1032+
<!-- start up external cluster -->
1033+
<execution>
1034+
<id>integ-setup</id>
1035+
<phase>pre-integration-test</phase>
1036+
<goals>
1037+
<goal>run</goal>
1038+
</goals>
1039+
<configuration>
1040+
<target>
1041+
<ant antfile="${elasticsearch.tools.directory}/ant/integration-tests.xml"
1042+
target="start-external-cluster"/>
1043+
</target>
1044+
</configuration>
1045+
</execution>
1046+
<!-- shut down external cluster -->
1047+
<execution>
1048+
<id>integ-teardown</id>
1049+
<phase>post-integration-test</phase>
1050+
<goals>
1051+
<goal>run</goal>
1052+
</goals>
1053+
<configuration>
1054+
<target>
1055+
<ant antfile="${elasticsearch.tools.directory}/ant/integration-tests.xml"
1056+
target="stop-external-cluster"/>
1057+
</target>
1058+
</configuration>
1059+
</execution>
1060+
</executions>
1061+
</plugin>
1062+
<plugin>
1063+
<groupId>org.apache.maven.plugins</groupId>
1064+
<artifactId>maven-failsafe-plugin</artifactId>
1065+
<configuration>
1066+
<systemPropertyVariables>
1067+
<tests.cluster>127.0.0.1:9300</tests.cluster>
1068+
</systemPropertyVariables>
1069+
</configuration>
1070+
</plugin>
10271071
</plugins>
10281072
<pluginManagement>
10291073
<plugins>

core/src/main/java/org/apache/lucene/queryparser/classic/MapperQueryParser.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,7 @@ private Query getFuzzyQuerySingle(String field, String termStr, String minSimila
428428
currentFieldType = parseContext.fieldMapper(field);
429429
if (currentFieldType != null) {
430430
try {
431-
//LUCENE 4 UPGRADE I disabled transpositions here by default - maybe this needs to be changed
432-
return currentFieldType.fuzzyQuery(termStr, Fuzziness.build(minSimilarity), fuzzyPrefixLength, settings.fuzzyMaxExpansions(), false);
431+
return currentFieldType.fuzzyQuery(termStr, Fuzziness.build(minSimilarity), fuzzyPrefixLength, settings.fuzzyMaxExpansions(), FuzzyQuery.defaultTranspositions);
433432
} catch (RuntimeException e) {
434433
if (settings.lenient()) {
435434
return null;
@@ -444,8 +443,7 @@ private Query getFuzzyQuerySingle(String field, String termStr, String minSimila
444443
protected Query newFuzzyQuery(Term term, float minimumSimilarity, int prefixLength) {
445444
String text = term.text();
446445
int numEdits = FuzzyQuery.floatToEdits(minimumSimilarity, text.codePointCount(0, text.length()));
447-
//LUCENE 4 UPGRADE I disabled transpositions here by default - maybe this needs to be changed
448-
FuzzyQuery query = new FuzzyQuery(term, numEdits, prefixLength, settings.fuzzyMaxExpansions(), false);
446+
FuzzyQuery query = new FuzzyQuery(term, numEdits, prefixLength, settings.fuzzyMaxExpansions(), FuzzyQuery.defaultTranspositions);
449447
QueryParsers.setRewriteMethod(query, settings.fuzzyRewriteMethod());
450448
return query;
451449
}

core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import org.elasticsearch.common.settings.Settings;
3131
import org.elasticsearch.http.HttpInfo;
3232
import org.elasticsearch.monitor.jvm.JvmInfo;
33-
import org.elasticsearch.monitor.network.NetworkInfo;
3433
import org.elasticsearch.monitor.os.OsInfo;
3534
import org.elasticsearch.monitor.process.ProcessInfo;
3635
import org.elasticsearch.threadpool.ThreadPoolInfo;
@@ -65,9 +64,6 @@ public class NodeInfo extends BaseNodeResponse {
6564
@Nullable
6665
private ThreadPoolInfo threadPool;
6766

68-
@Nullable
69-
private NetworkInfo network;
70-
7167
@Nullable
7268
private TransportInfo transport;
7369

@@ -81,7 +77,7 @@ public class NodeInfo extends BaseNodeResponse {
8177
}
8278

8379
public NodeInfo(Version version, Build build, DiscoveryNode node, @Nullable ImmutableMap<String, String> serviceAttributes, @Nullable Settings settings,
84-
@Nullable OsInfo os, @Nullable ProcessInfo process, @Nullable JvmInfo jvm, @Nullable ThreadPoolInfo threadPool, @Nullable NetworkInfo network,
80+
@Nullable OsInfo os, @Nullable ProcessInfo process, @Nullable JvmInfo jvm, @Nullable ThreadPoolInfo threadPool,
8581
@Nullable TransportInfo transport, @Nullable HttpInfo http, @Nullable PluginsInfo plugins) {
8682
super(node);
8783
this.version = version;
@@ -92,7 +88,6 @@ public NodeInfo(Version version, Build build, DiscoveryNode node, @Nullable Immu
9288
this.process = process;
9389
this.jvm = jvm;
9490
this.threadPool = threadPool;
95-
this.network = network;
9691
this.transport = transport;
9792
this.http = http;
9893
this.plugins = plugins;
@@ -165,14 +160,6 @@ public ThreadPoolInfo getThreadPool() {
165160
return this.threadPool;
166161
}
167162

168-
/**
169-
* Network level information.
170-
*/
171-
@Nullable
172-
public NetworkInfo getNetwork() {
173-
return network;
174-
}
175-
176163
@Nullable
177164
public TransportInfo getTransport() {
178165
return transport;
@@ -222,9 +209,6 @@ public void readFrom(StreamInput in) throws IOException {
222209
if (in.readBoolean()) {
223210
threadPool = ThreadPoolInfo.readThreadPoolInfo(in);
224211
}
225-
if (in.readBoolean()) {
226-
network = NetworkInfo.readNetworkInfo(in);
227-
}
228212
if (in.readBoolean()) {
229213
transport = TransportInfo.readTransportInfo(in);
230214
}
@@ -281,12 +265,6 @@ public void writeTo(StreamOutput out) throws IOException {
281265
out.writeBoolean(true);
282266
threadPool.writeTo(out);
283267
}
284-
if (network == null) {
285-
out.writeBoolean(false);
286-
} else {
287-
out.writeBoolean(true);
288-
network.writeTo(out);
289-
}
290268
if (transport == null) {
291269
out.writeBoolean(false);
292270
} else {
@@ -306,5 +284,4 @@ public void writeTo(StreamOutput out) throws IOException {
306284
plugins.writeTo(out);
307285
}
308286
}
309-
310287
}

core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
111111
if (nodeInfo.getThreadPool() != null) {
112112
nodeInfo.getThreadPool().toXContent(builder, params);
113113
}
114-
if (nodeInfo.getNetwork() != null) {
115-
nodeInfo.getNetwork().toXContent(builder, params);
116-
}
117114
if (nodeInfo.getTransport() != null) {
118115
nodeInfo.getTransport().toXContent(builder, params);
119116
}

core/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodeStats.java

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@
2929
import org.elasticsearch.http.HttpStats;
3030
import org.elasticsearch.indices.NodeIndicesStats;
3131
import org.elasticsearch.indices.breaker.AllCircuitBreakerStats;
32-
import org.elasticsearch.monitor.fs.FsStats;
32+
import org.elasticsearch.monitor.fs.FsInfo;
3333
import org.elasticsearch.monitor.jvm.JvmStats;
34-
import org.elasticsearch.monitor.network.NetworkStats;
3534
import org.elasticsearch.monitor.os.OsStats;
3635
import org.elasticsearch.monitor.process.ProcessStats;
3736
import org.elasticsearch.threadpool.ThreadPoolStats;
@@ -63,10 +62,7 @@ public class NodeStats extends BaseNodeResponse implements ToXContent {
6362
private ThreadPoolStats threadPool;
6463

6564
@Nullable
66-
private NetworkStats network;
67-
68-
@Nullable
69-
private FsStats fs;
65+
private FsInfo fs;
7066

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

8379
public NodeStats(DiscoveryNode node, long timestamp, @Nullable NodeIndicesStats indices,
8480
@Nullable OsStats os, @Nullable ProcessStats process, @Nullable JvmStats jvm, @Nullable ThreadPoolStats threadPool,
85-
@Nullable NetworkStats network, @Nullable FsStats fs, @Nullable TransportStats transport, @Nullable HttpStats http,
81+
@Nullable FsInfo fs, @Nullable TransportStats transport, @Nullable HttpStats http,
8682
@Nullable AllCircuitBreakerStats breaker) {
8783
super(node);
8884
this.timestamp = timestamp;
@@ -91,7 +87,6 @@ public NodeStats(DiscoveryNode node, long timestamp, @Nullable NodeIndicesStats
9187
this.process = process;
9288
this.jvm = jvm;
9389
this.threadPool = threadPool;
94-
this.network = network;
9590
this.fs = fs;
9691
this.transport = transport;
9792
this.http = http;
@@ -147,19 +142,11 @@ public ThreadPoolStats getThreadPool() {
147142
return this.threadPool;
148143
}
149144

150-
/**
151-
* Network level statistics.
152-
*/
153-
@Nullable
154-
public NetworkStats getNetwork() {
155-
return network;
156-
}
157-
158145
/**
159146
* File system level stats.
160147
*/
161148
@Nullable
162-
public FsStats getFs() {
149+
public FsInfo getFs() {
163150
return fs;
164151
}
165152

@@ -204,10 +191,7 @@ public void readFrom(StreamInput in) throws IOException {
204191
threadPool = ThreadPoolStats.readThreadPoolStats(in);
205192
}
206193
if (in.readBoolean()) {
207-
network = NetworkStats.readNetworkStats(in);
208-
}
209-
if (in.readBoolean()) {
210-
fs = FsStats.readFsStats(in);
194+
fs = FsInfo.readFsInfo(in);
211195
}
212196
if (in.readBoolean()) {
213197
transport = TransportStats.readTransportStats(in);
@@ -253,12 +237,6 @@ public void writeTo(StreamOutput out) throws IOException {
253237
out.writeBoolean(true);
254238
threadPool.writeTo(out);
255239
}
256-
if (network == null) {
257-
out.writeBoolean(false);
258-
} else {
259-
out.writeBoolean(true);
260-
network.writeTo(out);
261-
}
262240
if (fs == null) {
263241
out.writeBoolean(false);
264242
} else {
@@ -313,9 +291,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
313291
if (getThreadPool() != null) {
314292
getThreadPool().toXContent(builder, params);
315293
}
316-
if (getNetwork() != null) {
317-
getNetwork().toXContent(builder, params);
318-
}
319294
if (getFs() != null) {
320295
getFs().toXContent(builder, params);
321296
}

core/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodes.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import org.elasticsearch.common.xcontent.ToXContent;
3737
import org.elasticsearch.common.xcontent.XContentBuilder;
3838
import org.elasticsearch.common.xcontent.XContentBuilderString;
39-
import org.elasticsearch.monitor.fs.FsStats;
39+
import org.elasticsearch.monitor.fs.FsInfo;
4040
import org.elasticsearch.monitor.jvm.JvmInfo;
4141
import org.elasticsearch.monitor.os.OsInfo;
4242

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

5858
private ClusterStatsNodes() {
@@ -63,7 +63,7 @@ public ClusterStatsNodes(ClusterStatsNodeResponse[] nodeResponses) {
6363
this.versions = new HashSet<>();
6464
this.os = new OsStats();
6565
this.jvm = new JvmStats();
66-
this.fs = new FsStats.Info();
66+
this.fs = new FsInfo.Path();
6767
this.plugins = new HashSet<>();
6868
this.process = new ProcessStats();
6969

@@ -116,7 +116,7 @@ public JvmStats getJvm() {
116116
return jvm;
117117
}
118118

119-
public FsStats.Info getFs() {
119+
public FsInfo.Path getFs() {
120120
return fs;
121121
}
122122

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

143143
size = in.readVInt();
144144
plugins = new HashSet<>(size);

core/src/main/java/org/elasticsearch/action/bulk/BulkItemResponse.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
package org.elasticsearch.action.bulk;
2121

22-
import org.elasticsearch.ElasticsearchException;
2322
import org.elasticsearch.ExceptionsHelper;
2423
import org.elasticsearch.action.ActionWriteResponse;
2524
import org.elasticsearch.action.delete.DeleteResponse;
@@ -28,7 +27,6 @@
2827
import org.elasticsearch.common.io.stream.StreamInput;
2928
import org.elasticsearch.common.io.stream.StreamOutput;
3029
import org.elasticsearch.common.io.stream.Streamable;
31-
import org.elasticsearch.common.xcontent.XContentBuilder;
3230
import org.elasticsearch.rest.RestStatus;
3331

3432
import java.io.IOException;

core/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,13 @@ private boolean setResponseFailureIfIndexMatches(AtomicArray<BulkItemResponse> r
168168
} else if (request instanceof DeleteRequest) {
169169
DeleteRequest deleteRequest = (DeleteRequest) request;
170170
if (index.equals(deleteRequest.index())) {
171-
responses.set(idx, new BulkItemResponse(idx, "index", new BulkItemResponse.Failure(deleteRequest.index(), deleteRequest.type(), deleteRequest.id(), e)));
171+
responses.set(idx, new BulkItemResponse(idx, "delete", new BulkItemResponse.Failure(deleteRequest.index(), deleteRequest.type(), deleteRequest.id(), e)));
172172
return true;
173173
}
174174
} else if (request instanceof UpdateRequest) {
175175
UpdateRequest updateRequest = (UpdateRequest) request;
176176
if (index.equals(updateRequest.index())) {
177-
responses.set(idx, new BulkItemResponse(idx, "index", new BulkItemResponse.Failure(updateRequest.index(), updateRequest.type(), updateRequest.id(), e)));
177+
responses.set(idx, new BulkItemResponse(idx, "update", new BulkItemResponse.Failure(updateRequest.index(), updateRequest.type(), updateRequest.id(), e)));
178178
return true;
179179
}
180180
} else {
@@ -379,7 +379,15 @@ private boolean addFailureIfIndexIsUnavailable(DocumentRequest request, BulkRequ
379379
if (unavailableException != null) {
380380
BulkItemResponse.Failure failure = new BulkItemResponse.Failure(request.index(), request.type(), request.id(),
381381
unavailableException);
382-
BulkItemResponse bulkItemResponse = new BulkItemResponse(idx, "index", failure);
382+
String operationType = "unknown";
383+
if (request instanceof IndexRequest) {
384+
operationType = "index";
385+
} else if (request instanceof DeleteRequest) {
386+
operationType = "delete";
387+
} else if (request instanceof UpdateRequest) {
388+
operationType = "update";
389+
}
390+
BulkItemResponse bulkItemResponse = new BulkItemResponse(idx, operationType, failure);
383391
responses.set(idx, bulkItemResponse);
384392
// make sure the request gets never processed again
385393
bulkRequest.requests.set(idx, null);

0 commit comments

Comments
 (0)