Skip to content

Commit 0e55c87

Browse files
committed
rename create mapping to put mapping
1 parent 2201839 commit 0e55c87

15 files changed

+207
-251
lines changed

modules/elasticsearch/src/main/java/org/elasticsearch/action/TransportActionModule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import org.elasticsearch.action.admin.indices.gateway.snapshot.TransportGatewaySnapshotAction;
3434
import org.elasticsearch.action.admin.indices.gateway.snapshot.TransportIndexGatewaySnapshotAction;
3535
import org.elasticsearch.action.admin.indices.gateway.snapshot.TransportShardGatewaySnapshotAction;
36-
import org.elasticsearch.action.admin.indices.mapping.create.TransportCreateMappingAction;
36+
import org.elasticsearch.action.admin.indices.mapping.put.TransportPutMappingAction;
3737
import org.elasticsearch.action.admin.indices.optimize.TransportOptimizeAction;
3838
import org.elasticsearch.action.admin.indices.refresh.TransportRefreshAction;
3939
import org.elasticsearch.action.admin.indices.status.TransportIndicesStatusAction;
@@ -67,7 +67,7 @@ public class TransportActionModule extends AbstractModule {
6767

6868
bind(TransportIndicesStatusAction.class).asEagerSingleton();
6969
bind(TransportCreateIndexAction.class).asEagerSingleton();
70-
bind(TransportCreateMappingAction.class).asEagerSingleton();
70+
bind(TransportPutMappingAction.class).asEagerSingleton();
7171
bind(TransportDeleteIndexAction.class).asEagerSingleton();
7272

7373
bind(TransportShardGatewaySnapshotAction.class).asEagerSingleton();

modules/elasticsearch/src/main/java/org/elasticsearch/action/TransportActions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
package org.elasticsearch.action;
2121

2222
/**
23-
* @author kimchy (Shay Banon)
23+
* @author kimchy (shay.banon)
2424
*/
2525
public class TransportActions {
2626

@@ -55,7 +55,7 @@ public static class Gateway {
5555
}
5656

5757
public static class Mapping {
58-
public static final String CREATE = "indices/createMapping";
58+
public static final String PUT = "indices/mapping/put";
5959
}
6060
}
6161

modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/mapping/create/TransportCreateMappingAction.java

Lines changed: 0 additions & 162 deletions
This file was deleted.
Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717
* under the License.
1818
*/
1919

20-
package org.elasticsearch.action.admin.indices.mapping.create;
20+
package org.elasticsearch.action.admin.indices.mapping.put;
2121

22-
import org.elasticsearch.action.ActionRequest;
2322
import org.elasticsearch.action.ActionRequestValidationException;
23+
import org.elasticsearch.action.support.master.MasterNodeOperationRequest;
2424
import org.elasticsearch.util.Required;
2525
import org.elasticsearch.util.TimeValue;
26-
import org.elasticsearch.util.io.Streamable;
2726

2827
import java.io.DataInput;
2928
import java.io.DataOutput;
@@ -36,7 +35,7 @@
3635
/**
3736
* @author kimchy (Shay Banon)
3837
*/
39-
public class CreateMappingRequest implements ActionRequest, Streamable {
38+
public class PutMappingRequest extends MasterNodeOperationRequest {
4039

4140
private String[] indices;
4241

@@ -46,18 +45,18 @@ public class CreateMappingRequest implements ActionRequest, Streamable {
4645

4746
private TimeValue timeout = new TimeValue(10, TimeUnit.SECONDS);
4847

49-
CreateMappingRequest() {
48+
PutMappingRequest() {
5049
}
5150

52-
public CreateMappingRequest(String... indices) {
51+
public PutMappingRequest(String... indices) {
5352
this.indices = indices;
5453
}
5554

56-
public CreateMappingRequest(String index, String mappingType, String mappingSource) {
55+
public PutMappingRequest(String index, String mappingType, String mappingSource) {
5756
this(new String[]{index}, mappingType, mappingSource);
5857
}
5958

60-
public CreateMappingRequest(String[] indices, String mappingType, String mappingSource) {
59+
public PutMappingRequest(String[] indices, String mappingType, String mappingSource) {
6160
this.indices = indices;
6261
this.mappingType = mappingType;
6362
this.mappingSource = mappingSource;
@@ -71,12 +70,7 @@ public CreateMappingRequest(String[] indices, String mappingType, String mapping
7170
return validationException;
7271
}
7372

74-
@Override public boolean listenerThreaded() {
75-
// we don't really care about this...
76-
return true;
77-
}
78-
79-
@Override public CreateMappingRequest listenerThreaded(boolean threadedListener) {
73+
@Override public PutMappingRequest listenerThreaded(boolean threadedListener) {
8074
return this;
8175
}
8276

@@ -92,7 +86,7 @@ String type() {
9286
* The type of the mappings. Not required since it can be defined explicitly within the mapping source.
9387
* If it is not defined within the mapping source, then it is required.
9488
*/
95-
public CreateMappingRequest type(String mappingType) {
89+
public PutMappingRequest type(String mappingType) {
9690
this.mappingType = mappingType;
9791
return this;
9892
}
@@ -101,7 +95,7 @@ String mappingSource() {
10195
return mappingSource;
10296
}
10397

104-
@Required public CreateMappingRequest mappingSource(String mappingSource) {
98+
@Required public PutMappingRequest mappingSource(String mappingSource) {
10599
this.mappingSource = mappingSource;
106100
return this;
107101
}
@@ -110,12 +104,13 @@ TimeValue timeout() {
110104
return timeout;
111105
}
112106

113-
public CreateMappingRequest timeout(TimeValue timeout) {
107+
public PutMappingRequest timeout(TimeValue timeout) {
114108
this.timeout = timeout;
115109
return this;
116110
}
117111

118112
@Override public void readFrom(DataInput in) throws IOException, ClassNotFoundException {
113+
super.readFrom(in);
119114
indices = new String[in.readInt()];
120115
for (int i = 0; i < indices.length; i++) {
121116
indices[i] = in.readUTF();
@@ -128,6 +123,7 @@ public CreateMappingRequest timeout(TimeValue timeout) {
128123
}
129124

130125
@Override public void writeTo(DataOutput out) throws IOException {
126+
super.writeTo(out);
131127
if (indices == null) {
132128
out.writeInt(0);
133129
} else {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* under the License.
1818
*/
1919

20-
package org.elasticsearch.action.admin.indices.mapping.create;
20+
package org.elasticsearch.action.admin.indices.mapping.put;
2121

2222
import org.elasticsearch.action.ActionResponse;
2323
import org.elasticsearch.util.io.Streamable;
@@ -27,9 +27,9 @@
2727
import java.io.IOException;
2828

2929
/**
30-
* @author kimchy (Shay Banon)
30+
* @author kimchy (shay.banon)
3131
*/
32-
public class CreateMappingResponse implements ActionResponse, Streamable {
32+
public class PutMappingResponse implements ActionResponse, Streamable {
3333

3434
@Override public void readFrom(DataInput in) throws IOException, ClassNotFoundException {
3535
}

0 commit comments

Comments
 (0)