-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Optionally ignore field when indexed field name exceeds length limit #136143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jordan-powers
merged 15 commits into
elastic:main
from
jordan-powers:field-name-length-limit
Oct 13, 2025
+289
−2
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
02aaef7
Add test
jordan-powers 5cbadf5
Initial implementation
jordan-powers f9338e4
Add node feature
jordan-powers df2239a
Merge remote-tracking branch 'upstream/main' into field-name-length-l…
jordan-powers 640e38b
Update docs/changelog/136143.yaml
jordan-powers 640c797
Move setting definition
jordan-powers 2414eea
Update docs
jordan-powers 19e05fa
Add new setting to replicatedSettings
jordan-powers ede5d15
Merge remote-tracking branch 'upstream/main' into field-name-length-l…
jordan-powers f6c0487
Update tests
jordan-powers 5784382
Fix array logic
jordan-powers 84517ac
Merge remote-tracking branch 'upstream/main' into field-name-length-l…
jordan-powers 1ebb281
Merge remote-tracking branch 'upstream/main' into field-name-length-l…
jordan-powers 407bde5
Merge remote-tracking branch 'upstream/main' into field-name-length-l…
jordan-powers fac9d8f
Add non-ignored field to 100_field_name_length_limit.yml
jordan-powers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pr: 136143 | ||
summary: Optionally ignore field when indexed field name exceeds length limit | ||
area: Mapping | ||
type: enhancement | ||
issues: | ||
- 135700 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
213 changes: 213 additions & 0 deletions
213
...-spec/src/yamlRestTest/resources/rest-api-spec/test/index/100_field_name_length_limit.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
setup: | ||
- requires: | ||
cluster_features: ["mapper.ignore_dynamic_field_names_beyond_limit"] | ||
reason: "setting must be present to be tested" | ||
|
||
--- | ||
|
||
"Test field name length limit": | ||
- do: | ||
indices.create: | ||
index: test_index | ||
body: | ||
settings: | ||
index: | ||
mapping: | ||
field_name_length: | ||
ignore_dynamic_beyond_limit: true | ||
limit: 45 | ||
mappings: | ||
dynamic: true | ||
|
||
- do: | ||
index: | ||
index: test_index | ||
id: 1 | ||
refresh: true | ||
body: | ||
foo: | ||
test_really_long_field_name_that_will_be_ignored: foo | ||
field_name_not_ignored: 10 | ||
|
||
- do: | ||
indices.get_mapping: | ||
index: test_index | ||
|
||
- match: { test_index.mappings.properties.foo.properties.test_really_long_field_name_that_will_be_ignored: null } | ||
- match: { test_index.mappings.properties.foo.properties.field_name_not_ignored.type: long } | ||
|
||
- do: | ||
get: | ||
index: test_index | ||
id: 1 | ||
_source: true | ||
stored_fields: [_ignored] | ||
- match: | ||
_source: | ||
foo: | ||
test_really_long_field_name_that_will_be_ignored: foo | ||
field_name_not_ignored: 10 | ||
- match: { _ignored: [ "foo.test_really_long_field_name_that_will_be_ignored" ] } | ||
|
||
--- | ||
|
||
"Test field name length limit array": | ||
- do: | ||
indices.create: | ||
index: test_index | ||
body: | ||
settings: | ||
index: | ||
mapping: | ||
field_name_length: | ||
ignore_dynamic_beyond_limit: true | ||
limit: 45 | ||
mappings: | ||
dynamic: true | ||
|
||
- do: | ||
index: | ||
index: test_index | ||
id: 1 | ||
refresh: true | ||
body: | ||
foo: | ||
test_really_long_field_name_that_will_be_ignored: [ foo, bar, baz ] | ||
field_name_not_ignored: [ 10, 20, 30 ] | ||
|
||
- do: | ||
indices.get_mapping: | ||
index: test_index | ||
|
||
- match: { test_index.mappings.properties.foo.properties.test_really_long_field_name_that_will_be_ignored: null } | ||
- match: { test_index.mappings.properties.foo.properties.field_name_not_ignored.type: long } | ||
|
||
- do: | ||
get: | ||
index: test_index | ||
id: 1 | ||
_source: true | ||
stored_fields: [ _ignored ] | ||
|
||
- match: | ||
_source: | ||
foo: | ||
test_really_long_field_name_that_will_be_ignored: [ foo, bar, baz ] | ||
field_name_not_ignored: [ 10, 20, 30 ] | ||
- match: {_ignored:["foo.test_really_long_field_name_that_will_be_ignored"]} | ||
|
||
--- | ||
|
||
"Test field name length limit synthetic source": | ||
- do: | ||
indices.create: | ||
index: test_index | ||
body: | ||
settings: | ||
index: | ||
mapping: | ||
source.mode: synthetic | ||
field_name_length: | ||
ignore_dynamic_beyond_limit: true | ||
limit: 45 | ||
mappings: | ||
dynamic: true | ||
|
||
- do: | ||
index: | ||
index: test_index | ||
id: 1 | ||
refresh: true | ||
body: | ||
foo: | ||
test_really_long_field_name_that_will_be_ignored: foo | ||
field_name_not_ignored: 10 | ||
|
||
- do: | ||
indices.get_mapping: | ||
index: test_index | ||
|
||
- match: { test_index.mappings.properties.foo.properties.test_really_long_field_name_that_will_be_ignored: null } | ||
- match: { test_index.mappings.properties.foo.properties.field_name_not_ignored.type: long } | ||
|
||
- do: | ||
get: | ||
index: test_index | ||
id: 1 | ||
_source: true | ||
stored_fields: [ _ignored ] | ||
- match: | ||
_source: | ||
foo: | ||
test_really_long_field_name_that_will_be_ignored: foo | ||
field_name_not_ignored: 10 | ||
- match: {_ignored:["foo.test_really_long_field_name_that_will_be_ignored"]} | ||
|
||
--- | ||
|
||
"Test field name length limit array synthetic source": | ||
- do: | ||
indices.create: | ||
index: test_index | ||
body: | ||
settings: | ||
index: | ||
mapping: | ||
source.mode: synthetic | ||
field_name_length: | ||
ignore_dynamic_beyond_limit: true | ||
limit: 45 | ||
mappings: | ||
dynamic: true | ||
|
||
- do: | ||
index: | ||
index: test_index | ||
id: 1 | ||
refresh: true | ||
body: | ||
foo: | ||
test_really_long_field_name_that_will_be_ignored: [ foo, bar, baz ] | ||
field_name_not_ignored: [ 10, 20, 30 ] | ||
|
||
- do: | ||
indices.get_mapping: | ||
index: test_index | ||
|
||
- match: { test_index.mappings.properties.foo.properties.test_really_long_field_name_that_will_be_ignored: null } | ||
- match: { test_index.mappings.properties.foo.properties.field_name_not_ignored.type: long } | ||
|
||
- do: | ||
get: | ||
index: test_index | ||
id: 1 | ||
_source: true | ||
stored_fields: [ _ignored ] | ||
- match: | ||
_source: | ||
foo: | ||
test_really_long_field_name_that_will_be_ignored: [ foo, bar, baz ] | ||
field_name_not_ignored: [ 10, 20, 30 ] | ||
- match: {_ignored:["foo.test_really_long_field_name_that_will_be_ignored"]} | ||
|
||
--- | ||
|
||
"Test field name length limit with static mapping": | ||
- do: | ||
catch: /illegal_argument_exception/ | ||
indices.create: | ||
index: test_index | ||
body: | ||
settings: | ||
index: | ||
mapping: | ||
field_name_length: | ||
ignore_dynamic_beyond_limit: true | ||
limit: 45 | ||
mappings: | ||
dynamic: false | ||
properties: | ||
test_really_long_field_name_that_will_be_ignored: | ||
type: text | ||
|
||
- match: {error.reason: "Field name [test_really_long_field_name_that_will_be_ignored] is longer than the limit of [45] characters"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,6 +157,12 @@ public boolean isAutoUpdate() { | |
Property.Dynamic, | ||
Property.IndexScope | ||
); | ||
public static final Setting<Boolean> INDEX_MAPPING_IGNORE_DYNAMIC_BEYOND_FIELD_NAME_LENGTH_SETTING = Setting.boolSetting( | ||
"index.mapping.field_name_length.ignore_dynamic_beyond_limit", | ||
false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe in a follow up change we can consider defaulting to true in case of logsdb and tsdb? |
||
Property.Dynamic, | ||
Property.IndexScope | ||
); | ||
public static final Setting<Long> INDEX_MAPPING_DIMENSION_FIELDS_LIMIT_SETTING = Setting.longSetting( | ||
"index.mapping.dimension_fields.limit", | ||
32_768, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also add a test where the field will not be ignored? Or update these tests to add two fields, one field that would be ignored because field name length is exceeded and one field just under this limit?