Skip to content

Commit f9338e4

Browse files
committed
Add node feature
1 parent 5cbadf5 commit f9338e4

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/index/100_field_name_length_limit.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
setup:
2+
- requires:
3+
cluster_features: ["mapper.ignore_dynamic_field_names_beyond_limit"]
4+
reason: "setting must be present to be tested"
5+
6+
---
7+
18
"Test field name length limit":
29
- do:
310
indices.create:
@@ -111,3 +118,25 @@
111118
- match:
112119
_source:
113120
test_really_long_field_name_that_will_be_ignored: foo
121+
122+
---
123+
124+
"Test field name length limit with static mapping":
125+
- do:
126+
catch: /illegal_argument_exception/
127+
indices.create:
128+
index: test_index
129+
body:
130+
settings:
131+
index:
132+
mapping:
133+
field_name_length:
134+
ignore_dynamic_beyond_limit: true
135+
limit: 45
136+
mappings:
137+
dynamic: false
138+
properties:
139+
test_really_long_field_name_that_will_be_ignored:
140+
type: text
141+
142+
- match: {error.reason: "Field name [test_really_long_field_name_that_will_be_ignored] is longer than the limit of [45] characters"}

server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ public class MapperFeatures implements FeatureSpecification {
5252
static final NodeFeature IGNORED_SOURCE_FIELDS_PER_ENTRY = new NodeFeature("mapper.ignored_source_fields_per_entry");
5353
public static final NodeFeature MULTI_FIELD_UNICODE_OPTIMISATION_FIX = new NodeFeature("mapper.multi_field.unicode_optimisation_fix");
5454
static final NodeFeature PATTERN_TEXT_RENAME = new NodeFeature("mapper.pattern_text_rename");
55+
static final NodeFeature INDEX_MAPPING_IGNORE_DYNAMIC_BEYOND_FIELD_NAME_LIMIT = new NodeFeature(
56+
"mapper.ignore_dynamic_field_names_beyond_limit"
57+
);
5558

5659
@Override
5760
public Set<NodeFeature> getTestFeatures() {
@@ -89,7 +92,8 @@ public Set<NodeFeature> getTestFeatures() {
8992
IGNORED_SOURCE_FIELDS_PER_ENTRY,
9093
MULTI_FIELD_UNICODE_OPTIMISATION_FIX,
9194
MATCH_ONLY_TEXT_BLOCK_LOADER_FIX,
92-
PATTERN_TEXT_RENAME
95+
PATTERN_TEXT_RENAME,
96+
INDEX_MAPPING_IGNORE_DYNAMIC_BEYOND_FIELD_NAME_LIMIT
9397
);
9498
}
9599
}

0 commit comments

Comments
 (0)