Skip to content

Commit 95a7eed

Browse files
authored
Rename MetaData to Metadata in all of the places (#54519)
This is a simple naming change PR, to fix the fact that "metadata" is a single English word, and for too long we have not followed general naming conventions for it. We are also not consistent about it, for example, METADATA instead of META_DATA if we were trying to be consistent with MetaData (although METADATA is correct when considered in the context of "metadata"). This was a simple find and replace across the code base, only taking a few minutes to fix this naming issue forever.
1 parent 1eb0047 commit 95a7eed

File tree

1,779 files changed

+18769
-18757
lines changed

Some content is hidden

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

1,779 files changed

+18769
-18757
lines changed

benchmarks/src/main/java/org/elasticsearch/benchmark/routing/allocation/AllocationBenchmark.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import org.elasticsearch.Version;
2222
import org.elasticsearch.cluster.ClusterName;
2323
import org.elasticsearch.cluster.ClusterState;
24-
import org.elasticsearch.cluster.metadata.IndexMetaData;
25-
import org.elasticsearch.cluster.metadata.MetaData;
24+
import org.elasticsearch.cluster.metadata.IndexMetadata;
25+
import org.elasticsearch.cluster.metadata.Metadata;
2626
import org.elasticsearch.cluster.node.DiscoveryNodes;
2727
import org.elasticsearch.cluster.routing.RoutingTable;
2828
import org.elasticsearch.cluster.routing.ShardRoutingState;
@@ -127,27 +127,27 @@ public void setUp() throws Exception {
127127
Settings.builder().put("cluster.routing.allocation.awareness.attributes", "tag").build()
128128
);
129129

130-
MetaData.Builder mb = MetaData.builder();
130+
Metadata.Builder mb = Metadata.builder();
131131
for (int i = 1; i <= numIndices; i++) {
132132
mb.put(
133-
IndexMetaData.builder("test_" + i)
133+
IndexMetadata.builder("test_" + i)
134134
.settings(Settings.builder().put("index.version.created", Version.CURRENT))
135135
.numberOfShards(numShards)
136136
.numberOfReplicas(numReplicas)
137137
);
138138
}
139-
MetaData metaData = mb.build();
139+
Metadata metadata = mb.build();
140140
RoutingTable.Builder rb = RoutingTable.builder();
141141
for (int i = 1; i <= numIndices; i++) {
142-
rb.addAsNew(metaData.index("test_" + i));
142+
rb.addAsNew(metadata.index("test_" + i));
143143
}
144144
RoutingTable routingTable = rb.build();
145145
DiscoveryNodes.Builder nb = DiscoveryNodes.builder();
146146
for (int i = 1; i <= numNodes; i++) {
147147
nb.add(Allocators.newNode("node" + i, Collections.singletonMap("tag", "tag_" + (i % numTags))));
148148
}
149149
initialClusterState = ClusterState.builder(ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY))
150-
.metaData(metaData)
150+
.metadata(metadata)
151151
.routingTable(routingTable)
152152
.nodes(nb)
153153
.build();

client/benchmark/src/main/java/org/elasticsearch/client/benchmark/rest/RestClientBenchmark.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ protected SearchRequestExecutor searchRequestExecutor(RestClient client, String
6363

6464
private static final class RestBulkRequestExecutor implements BulkRequestExecutor {
6565
private final RestClient client;
66-
private final String actionMetaData;
66+
private final String actionMetadata;
6767

6868
RestBulkRequestExecutor(RestClient client, String index, String type) {
6969
this.client = client;
70-
this.actionMetaData = String.format(Locale.ROOT, "{ \"index\" : { \"_index\" : \"%s\", \"_type\" : \"%s\" } }%n", index, type);
70+
this.actionMetadata = String.format(Locale.ROOT, "{ \"index\" : { \"_index\" : \"%s\", \"_type\" : \"%s\" } }%n", index, type);
7171
}
7272

7373
@Override
7474
public boolean bulkIndex(List<String> bulkData) {
7575
StringBuilder bulkRequestBody = new StringBuilder();
7676
for (String bulkItem : bulkData) {
77-
bulkRequestBody.append(actionMetaData);
77+
bulkRequestBody.append(actionMetadata);
7878
bulkRequestBody.append(bulkItem);
7979
bulkRequestBody.append("\n");
8080
}

client/rest-high-level/src/main/java/org/elasticsearch/client/GetAliasesResponse.java

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

2222
import org.elasticsearch.ElasticsearchException;
23-
import org.elasticsearch.cluster.metadata.AliasMetaData;
23+
import org.elasticsearch.cluster.metadata.AliasMetadata;
2424
import org.elasticsearch.common.xcontent.StatusToXContentObject;
2525
import org.elasticsearch.common.xcontent.ToXContent;
2626
import org.elasticsearch.common.xcontent.XContentBuilder;
@@ -52,9 +52,9 @@ public class GetAliasesResponse implements StatusToXContentObject {
5252
private final String error;
5353
private final ElasticsearchException exception;
5454

55-
private final Map<String, Set<AliasMetaData>> aliases;
55+
private final Map<String, Set<AliasMetadata>> aliases;
5656

57-
GetAliasesResponse(RestStatus status, String error, Map<String, Set<AliasMetaData>> aliases) {
57+
GetAliasesResponse(RestStatus status, String error, Map<String, Set<AliasMetadata>> aliases) {
5858
this.status = status;
5959
this.error = error;
6060
this.aliases = aliases;
@@ -90,7 +90,7 @@ public ElasticsearchException getException() {
9090
/**
9191
* Return the requested aliases
9292
*/
93-
public Map<String, Set<AliasMetaData>> getAliases() {
93+
public Map<String, Set<AliasMetadata>> getAliases() {
9494
return aliases;
9595
}
9696

@@ -103,13 +103,13 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
103103
builder.field("status", status.getStatus());
104104
}
105105

106-
for (Map.Entry<String, Set<AliasMetaData>> entry : aliases.entrySet()) {
106+
for (Map.Entry<String, Set<AliasMetadata>> entry : aliases.entrySet()) {
107107
builder.startObject(entry.getKey());
108108
{
109109
builder.startObject("aliases");
110110
{
111-
for (final AliasMetaData alias : entry.getValue()) {
112-
AliasMetaData.Builder.toXContent(alias, builder, ToXContent.EMPTY_PARAMS);
111+
for (final AliasMetadata alias : entry.getValue()) {
112+
AliasMetadata.Builder.toXContent(alias, builder, ToXContent.EMPTY_PARAMS);
113113
}
114114
}
115115
builder.endObject();
@@ -129,7 +129,7 @@ public static GetAliasesResponse fromXContent(XContentParser parser) throws IOEx
129129
parser.nextToken();
130130
}
131131
ensureExpectedToken(Token.START_OBJECT, parser.currentToken(), parser::getTokenLocation);
132-
Map<String, Set<AliasMetaData>> aliases = new HashMap<>();
132+
Map<String, Set<AliasMetadata>> aliases = new HashMap<>();
133133

134134
String currentFieldName;
135135
Token token;
@@ -159,7 +159,7 @@ public static GetAliasesResponse fromXContent(XContentParser parser) throws IOEx
159159
} else {
160160
String indexName = parser.currentName();
161161
if (parser.nextToken() == Token.START_OBJECT) {
162-
Set<AliasMetaData> parseInside = parseAliases(parser);
162+
Set<AliasMetadata> parseInside = parseAliases(parser);
163163
aliases.put(indexName, parseInside);
164164
}
165165
}
@@ -173,8 +173,8 @@ public static GetAliasesResponse fromXContent(XContentParser parser) throws IOEx
173173
return new GetAliasesResponse(status, error, aliases);
174174
}
175175

176-
private static Set<AliasMetaData> parseAliases(XContentParser parser) throws IOException {
177-
Set<AliasMetaData> aliases = new HashSet<>();
176+
private static Set<AliasMetadata> parseAliases(XContentParser parser) throws IOException {
177+
Set<AliasMetadata> aliases = new HashSet<>();
178178
Token token;
179179
String currentFieldName = null;
180180
while ((token = parser.nextToken()) != Token.END_OBJECT) {
@@ -183,7 +183,7 @@ private static Set<AliasMetaData> parseAliases(XContentParser parser) throws IOE
183183
} else if (token == Token.START_OBJECT) {
184184
if ("aliases".equals(currentFieldName)) {
185185
while (parser.nextToken() != Token.END_OBJECT) {
186-
AliasMetaData fromXContent = AliasMetaData.Builder.fromXContent(parser);
186+
AliasMetadata fromXContent = AliasMetadata.Builder.fromXContent(parser);
187187
aliases.add(fromXContent);
188188
}
189189
} else {

client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesRequestConverters.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
import org.elasticsearch.client.indices.ResizeRequest;
5454
import org.elasticsearch.client.indices.UnfreezeIndexRequest;
5555
import org.elasticsearch.client.indices.rollover.RolloverRequest;
56-
import org.elasticsearch.cluster.metadata.IndexMetaData;
56+
import org.elasticsearch.cluster.metadata.IndexMetadata;
5757
import org.elasticsearch.common.Strings;
5858

5959
import java.io.IOException;
@@ -238,7 +238,7 @@ static Request existsAlias(GetAliasesRequest getAliasesRequest) {
238238
}
239239

240240
static Request split(ResizeRequest resizeRequest) throws IOException {
241-
if (IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.exists(resizeRequest.getSettings()) == false) {
241+
if (IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.exists(resizeRequest.getSettings()) == false) {
242242
throw new IllegalArgumentException("index.number_of_shards is required for split operations");
243243
}
244244
return resize(resizeRequest, ResizeType.SPLIT);

client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/StringStatsAggregationBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected ValuesSourceAggregatorFactory innerBuild(QueryShardContext queryShardC
101101
}
102102

103103
@Override
104-
protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map<String, Object> metaData) {
104+
protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map<String, Object> metadata) {
105105
throw new UnsupportedOperationException();
106106
}
107107

client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/TopMetricsAggregationBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ protected AggregatorFactory doBuild(QueryShardContext queryShardContext, Aggrega
106106
}
107107

108108
@Override
109-
protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map<String, Object> metaData) {
109+
protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map<String, Object> metadata) {
110110
throw new UnsupportedOperationException();
111111
}
112112
}

client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetFieldMappingsResponse.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,43 +43,43 @@ public class GetFieldMappingsResponse {
4343

4444
private static final ParseField MAPPINGS = new ParseField("mappings");
4545

46-
private static final ObjectParser<Map<String, FieldMappingMetaData>, String> PARSER =
46+
private static final ObjectParser<Map<String, FieldMappingMetadata>, String> PARSER =
4747
new ObjectParser<>(MAPPINGS.getPreferredName(), true, HashMap::new);
4848

4949
static {
5050
PARSER.declareField((p, fieldMappings, index) -> {
5151
p.nextToken();
5252
while (p.currentToken() == XContentParser.Token.FIELD_NAME) {
5353
final String fieldName = p.currentName();
54-
final FieldMappingMetaData fieldMappingMetaData = FieldMappingMetaData.fromXContent(p);
55-
fieldMappings.put(fieldName, fieldMappingMetaData);
54+
final FieldMappingMetadata fieldMappingMetadata = FieldMappingMetadata.fromXContent(p);
55+
fieldMappings.put(fieldName, fieldMappingMetadata);
5656
p.nextToken();
5757
}
5858
}, MAPPINGS, ObjectParser.ValueType.OBJECT);
5959
}
6060

61-
private Map<String, Map<String, FieldMappingMetaData>> mappings;
61+
private Map<String, Map<String, FieldMappingMetadata>> mappings;
6262

63-
GetFieldMappingsResponse(Map<String, Map<String, FieldMappingMetaData>> mappings) {
63+
GetFieldMappingsResponse(Map<String, Map<String, FieldMappingMetadata>> mappings) {
6464
this.mappings = mappings;
6565
}
6666

6767

6868
/**
6969
* Returns the fields mapping. The return map keys are indexes and fields (as specified in the request).
7070
*/
71-
public Map<String, Map<String, FieldMappingMetaData>> mappings() {
71+
public Map<String, Map<String, FieldMappingMetadata>> mappings() {
7272
return mappings;
7373
}
7474

7575
/**
7676
* Returns the mappings of a specific index and field.
7777
*
7878
* @param field field name as specified in the {@link GetFieldMappingsRequest}
79-
* @return FieldMappingMetaData for the requested field or null if not found.
79+
* @return FieldMappingMetadata for the requested field or null if not found.
8080
*/
81-
public FieldMappingMetaData fieldMappings(String index, String field) {
82-
Map<String, FieldMappingMetaData> indexMapping = mappings.get(index);
81+
public FieldMappingMetadata fieldMappings(String index, String field) {
82+
Map<String, FieldMappingMetadata> indexMapping = mappings.get(index);
8383
if (indexMapping == null) {
8484
return null;
8585
}
@@ -89,25 +89,25 @@ public FieldMappingMetaData fieldMappings(String index, String field) {
8989

9090
public static GetFieldMappingsResponse fromXContent(XContentParser parser) throws IOException {
9191
ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.nextToken(), parser::getTokenLocation);
92-
final Map<String, Map<String, FieldMappingMetaData>> mappings = new HashMap<>();
92+
final Map<String, Map<String, FieldMappingMetadata>> mappings = new HashMap<>();
9393
if (parser.nextToken() == XContentParser.Token.FIELD_NAME) {
9494
while (parser.currentToken() == XContentParser.Token.FIELD_NAME) {
9595
final String index = parser.currentName();
96-
final Map<String, FieldMappingMetaData> fieldMappings = PARSER.parse(parser, index);
96+
final Map<String, FieldMappingMetadata> fieldMappings = PARSER.parse(parser, index);
9797
mappings.put(index, fieldMappings);
9898
parser.nextToken();
9999
}
100100
}
101101
return new GetFieldMappingsResponse(mappings);
102102
}
103103

104-
public static class FieldMappingMetaData {
104+
public static class FieldMappingMetadata {
105105
private static final ParseField FULL_NAME = new ParseField("full_name");
106106
private static final ParseField MAPPING = new ParseField("mapping");
107107

108-
private static final ConstructingObjectParser<FieldMappingMetaData, String> PARSER =
108+
private static final ConstructingObjectParser<FieldMappingMetadata, String> PARSER =
109109
new ConstructingObjectParser<>("field_mapping_meta_data", true,
110-
a -> new FieldMappingMetaData((String)a[0], (BytesReference)a[1])
110+
a -> new FieldMappingMetadata((String)a[0], (BytesReference)a[1])
111111
);
112112

113113
static {
@@ -124,7 +124,7 @@ public static class FieldMappingMetaData {
124124
private String fullName;
125125
private BytesReference source;
126126

127-
public FieldMappingMetaData(String fullName, BytesReference source) {
127+
public FieldMappingMetadata(String fullName, BytesReference source) {
128128
this.fullName = fullName;
129129
this.source = source;
130130
}
@@ -145,20 +145,20 @@ BytesReference getSource() {
145145
return source;
146146
}
147147

148-
public static FieldMappingMetaData fromXContent(XContentParser parser) throws IOException {
148+
public static FieldMappingMetadata fromXContent(XContentParser parser) throws IOException {
149149
return PARSER.parse(parser, null);
150150
}
151151

152152
@Override
153153
public String toString() {
154-
return "FieldMappingMetaData{fullName='" + fullName + '\'' + ", source=" + source + '}';
154+
return "FieldMappingMetadata{fullName='" + fullName + '\'' + ", source=" + source + '}';
155155
}
156156

157157
@Override
158158
public boolean equals(Object o) {
159159
if (this == o) return true;
160-
if (!(o instanceof FieldMappingMetaData)) return false;
161-
FieldMappingMetaData that = (FieldMappingMetaData) o;
160+
if (!(o instanceof FieldMappingMetadata)) return false;
161+
FieldMappingMetadata that = (FieldMappingMetadata) o;
162162
return Objects.equals(fullName, that.fullName) && Objects.equals(source, that.source);
163163
}
164164

0 commit comments

Comments
 (0)