-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Introduce an ignore_above
index-level setting
#113121
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
Changes from 38 commits
b7e8480
86d9320
b4d6ba5
bfa4c78
8e081d4
d1362dc
db3e5a9
dfe87f3
05166ba
4fcbb9f
adbd742
40629b8
fdae006
ac5cd94
97f0a13
c2fbbc1
639e417
651dae7
44bd264
63f6f44
8205fc2
7145301
e4beb91
f88c36e
a90ac4e
8f84e26
4e09c71
95e1d3b
3d7c712
3ea3b9b
e52e868
f0a439d
46609ea
736a05d
1496798
0cf78c5
8d3ee09
5e952a1
a886f2b
38ac0f4
127b519
f8b23e1
3cc33f3
b2b4015
9603ddb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
--- | ||
ignore_above mapping level setting: | ||
- requires: | ||
cluster_features: [ "mapper.ignore_above_index_level_setting" ] | ||
reason: introduce ignore_above index level setting | ||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
mapping: | ||
ignore_above: 10 | ||
mappings: | ||
properties: | ||
keyword: | ||
type: keyword | ||
flattened: | ||
type: flattened | ||
|
||
- do: | ||
index: | ||
index: test | ||
refresh: true | ||
id: "1" | ||
body: { "keyword": "foo bar", "flattened": { "value": "the quick brown fox" } } | ||
|
||
- do: | ||
search: | ||
body: | ||
fields: | ||
- keyword | ||
- flattened | ||
query: | ||
match_all: {} | ||
|
||
- length: { hits.hits: 1 } | ||
- match: { hits.hits.0._source.keyword: "foo bar" } | ||
- match: { hits.hits.0._source.flattened.value: "the quick brown fox" } | ||
- match: { hits.hits.0.fields.keyword.0: "foo bar" } | ||
- match: { hits.hits.0.fields.flattened: null } | ||
|
||
--- | ||
ignore_above mapping level setting on arrays: | ||
- requires: | ||
cluster_features: [ "mapper.ignore_above_index_level_setting" ] | ||
reason: introduce ignore_above index level setting | ||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
mapping: | ||
ignore_above: 10 | ||
mappings: | ||
properties: | ||
keyword: | ||
type: keyword | ||
flattened: | ||
type: flattened | ||
|
||
- do: | ||
index: | ||
index: test | ||
refresh: true | ||
id: "1" | ||
body: { "keyword": ["foo bar", "the quick brown fox"], "flattened": { "value": ["the quick brown fox", "jumps over"] } } | ||
|
||
- do: | ||
search: | ||
body: | ||
fields: | ||
- keyword | ||
- flattened | ||
query: | ||
match_all: {} | ||
|
||
- length: { hits.hits: 1 } | ||
- match: { hits.hits.0._source.keyword: ["foo bar", "the quick brown fox"] } | ||
- match: { hits.hits.0._source.flattened.value: ["the quick brown fox", "jumps over"] } | ||
- match: { hits.hits.0.fields.keyword.0: "foo bar" } | ||
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. Assert that length is 1? 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. If length is not 1 this
or
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. Moreover if I assert the length before asserting the match a test would fail with something like
while I think is a bit better to actually see the field values in the error message. We would need to re-run the test removing the length assertion to see which value is returned. |
||
- match: { hits.hits.0.fields.flattened.0.value: "jumps over" } | ||
|
||
--- | ||
ignore_above mapping overrides setting: | ||
- requires: | ||
cluster_features: [ "mapper.ignore_above_index_level_setting" ] | ||
reason: introduce ignore_above index level setting | ||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
mapping: | ||
ignore_above: 10 | ||
mappings: | ||
properties: | ||
keyword: | ||
type: keyword | ||
ignore_above: 100 | ||
flattened: | ||
type: flattened | ||
ignore_above: 100 | ||
|
||
- do: | ||
index: | ||
index: test | ||
refresh: true | ||
id: "1" | ||
body: { "keyword": "foo bar baz foo bar baz", "flattened": { "value": "the quick brown fox" } } | ||
|
||
- do: | ||
search: | ||
body: | ||
fields: | ||
- keyword | ||
- flattened | ||
query: | ||
match_all: { } | ||
|
||
- length: { hits.hits: 1 } | ||
- match: { hits.hits.0._source.keyword: "foo bar baz foo bar baz" } | ||
- match: { hits.hits.0._source.flattened.value: "the quick brown fox" } | ||
- match: { hits.hits.0.fields.keyword.0: "foo bar baz foo bar baz" } | ||
- match: { hits.hits.0.fields.flattened.0.value: "the quick brown fox" } | ||
|
||
--- | ||
ignore_above mapping overrides setting on arrays: | ||
- requires: | ||
cluster_features: [ "mapper.ignore_above_index_level_setting" ] | ||
reason: introduce ignore_above index level setting | ||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
mapping: | ||
ignore_above: 10 | ||
mappings: | ||
properties: | ||
keyword: | ||
type: keyword | ||
ignore_above: 100 | ||
flattened: | ||
type: flattened | ||
ignore_above: 100 | ||
|
||
- do: | ||
index: | ||
index: test | ||
refresh: true | ||
id: "1" | ||
body: { "keyword": ["foo bar baz foo bar baz", "the quick brown fox jumps over"], "flattened": { "value": ["the quick brown fox", "jumps over the lazy dog"] } } | ||
|
||
- do: | ||
search: | ||
body: | ||
fields: | ||
- keyword | ||
- flattened | ||
query: | ||
match_all: { } | ||
|
||
- length: { hits.hits: 1 } | ||
- match: { hits.hits.0._source.keyword: ["foo bar baz foo bar baz", "the quick brown fox jumps over"] } | ||
- match: { hits.hits.0._source.flattened.value: ["the quick brown fox", "jumps over the lazy dog"] } | ||
- match: { hits.hits.0.fields.keyword: ["foo bar baz foo bar baz", "the quick brown fox jumps over"] } | ||
- match: { hits.hits.0.fields.flattened.0.value: ["the quick brown fox", "jumps over the lazy dog"] } | ||
|
||
--- | ||
date ignore_above index level setting: | ||
- requires: | ||
cluster_features: [ "mapper.ignore_above_index_level_setting" ] | ||
reason: introduce ignore_above index level setting | ||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
mapping: | ||
ignore_above: 10 | ||
mappings: | ||
properties: | ||
keyword: | ||
type: keyword | ||
date: | ||
type: date | ||
format: "yyyy-MM-dd'T'HH:mm:ss" | ||
|
||
- do: | ||
index: | ||
index: test | ||
refresh: true | ||
id: "1" | ||
body: { "keyword": ["2023-09-17T15:30:00", "2023-09-17T15:31:00"], "date": ["2023-09-17T15:30:00", "2023-09-17T15:31:00"] } | ||
|
||
- do: | ||
search: | ||
body: | ||
fields: | ||
- keyword | ||
- date | ||
query: | ||
match_all: {} | ||
|
||
- length: { hits.hits: 1 } | ||
- match: { hits.hits.0._source.keyword: ["2023-09-17T15:30:00", "2023-09-17T15:31:00"] } | ||
- match: { hits.hits.0._source.date: ["2023-09-17T15:30:00", "2023-09-17T15:31:00"] } | ||
- match: { hits.hits.0.fields.keyword: null } | ||
- match: { hits.hits.0.fields.date: ["2023-09-17T15:30:00","2023-09-17T15:31:00"] } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
--- | ||
ignore_above mapping level setting: | ||
- requires: | ||
cluster_features: [ "mapper.ignore_above_index_level_setting" ] | ||
reason: introduce ignore_above index level setting | ||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
mapping: | ||
ignore_above: 10 | ||
mappings: | ||
_source: | ||
mode: synthetic | ||
properties: | ||
keyword: | ||
type: keyword | ||
flattened: | ||
type: flattened | ||
|
||
- do: | ||
index: | ||
index: test | ||
refresh: true | ||
id: "1" | ||
body: { "keyword": "foo bar", "flattened": { "value": "the quick brown fox" } } | ||
|
||
- do: | ||
search: | ||
body: | ||
fields: | ||
- keyword | ||
- flattened | ||
query: | ||
match_all: {} | ||
|
||
- length: { hits.hits: 1 } | ||
- match: { hits.hits.0._source.keyword: "foo bar" } | ||
- match: { hits.hits.0._source.flattened.value: "the quick brown fox" } | ||
- match: { hits.hits.0.fields.keyword.0: "foo bar" } | ||
|
||
--- | ||
ignore_above mapping level setting on arrays: | ||
- requires: | ||
cluster_features: [ "mapper.ignore_above_index_level_setting" ] | ||
reason: introduce ignore_above index level setting | ||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
mapping: | ||
ignore_above: 10 | ||
mappings: | ||
_source: | ||
mode: synthetic | ||
properties: | ||
keyword: | ||
type: keyword | ||
flattened: | ||
type: flattened | ||
|
||
- do: | ||
index: | ||
index: test | ||
refresh: true | ||
id: "1" | ||
body: { "keyword": ["foo bar", "the quick brown fox"], "flattened": { "value": ["the quick brown fox", "jumps over"] } } | ||
|
||
- do: | ||
search: | ||
body: | ||
fields: | ||
- keyword | ||
- flattened | ||
query: | ||
match_all: {} | ||
|
||
- length: { hits.hits: 1 } | ||
#TODO: synthetic source field reconstruction bug (TBD: add link to the issue here) | ||
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. I could not reproduce the issue using only a |
||
#- match: { hits.hits.0._source.keyword: ["foo bar", "the quick brown fox"] } | ||
- match: { hits.hits.0._source.flattened.value: ["the quick brown fox", "jumps over"] } | ||
- match: { hits.hits.0.fields.keyword.0: "foo bar" } | ||
- match: { hits.hits.0.fields.flattened.0.value: "jumps over" } | ||
|
||
--- | ||
ignore_above mapping overrides setting: | ||
- requires: | ||
cluster_features: [ "mapper.ignore_above_index_level_setting" ] | ||
reason: introduce ignore_above index level setting | ||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
mapping: | ||
ignore_above: 10 | ||
mappings: | ||
_source: | ||
mode: synthetic | ||
properties: | ||
keyword: | ||
type: keyword | ||
ignore_above: 100 | ||
flattened: | ||
type: flattened | ||
ignore_above: 100 | ||
|
||
- do: | ||
index: | ||
index: test | ||
refresh: true | ||
id: "1" | ||
body: { "keyword": "foo bar baz foo bar baz", "flattened": { "value": "the quick brown fox" } } | ||
|
||
- do: | ||
search: | ||
body: | ||
fields: | ||
- keyword | ||
- flattened | ||
query: | ||
match_all: { } | ||
|
||
- length: { hits.hits: 1 } | ||
- match: { hits.hits.0._source.keyword: "foo bar baz foo bar baz" } | ||
- match: { hits.hits.0._source.flattened.value: "the quick brown fox" } | ||
- match: { hits.hits.0.fields.keyword.0: "foo bar baz foo bar baz" } | ||
- match: { hits.hits.0.fields.flattened.0.value: "the quick brown fox" } | ||
|
||
--- | ||
ignore_above mapping overrides setting on arrays: | ||
- requires: | ||
cluster_features: [ "mapper.ignore_above_index_level_setting" ] | ||
reason: introduce ignore_above index level setting | ||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
mapping: | ||
ignore_above: 10 | ||
mappings: | ||
_source: | ||
mode: synthetic | ||
properties: | ||
keyword: | ||
type: keyword | ||
ignore_above: 100 | ||
flattened: | ||
type: flattened | ||
ignore_above: 100 | ||
|
||
- do: | ||
index: | ||
index: test | ||
refresh: true | ||
id: "1" | ||
body: { "keyword": ["foo bar baz foo bar baz", "the quick brown fox jumps over"], "flattened": { "value": ["the quick brown fox", "jumps over the lazy dog"] } } | ||
|
||
- do: | ||
search: | ||
body: | ||
fields: | ||
- keyword | ||
- flattened | ||
query: | ||
match_all: { } | ||
|
||
- length: { hits.hits: 1 } | ||
- match: { hits.hits.0._source.keyword: ["foo bar baz foo bar baz", "the quick brown fox jumps over"] } | ||
- match: { hits.hits.0._source.flattened.value: ["jumps over the lazy dog", "the quick brown fox"] } | ||
- match: { hits.hits.0.fields.keyword: ["foo bar baz foo bar baz", "the quick brown fox jumps over"] } | ||
- match: { hits.hits.0.fields.flattened.0.value: ["jumps over the lazy dog", "the quick brown fox"] } |
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.
Should we assert that flattened is null?