-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Enable the use of nested field type with index.mode=time_series #122224
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
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
59b2d57
Add REST test with nested field in time-series index
jordan-powers 412f12e
Enable nested fields in time-series mode indices
jordan-powers c6097c7
Update docs/changelog/122224.yaml
jordan-powers 3c669c0
Merge remote-tracking branch 'upstream/main' into fix_120874
jordan-powers ed6f965
Use nested query in nested field test
jordan-powers 40334db
Iter
jordan-powers 42a20f9
Add test for tsdb with multi-level nested fields
jordan-powers ab7935d
Update tests to support nested fields
jordan-powers 22c9ea3
Merge remote-tracking branch 'upstream/main' into fix_120874
jordan-powers d7acbe0
Add cluster feature
jordan-powers 117217c
Add cluster feature to 20_mapping tests
jordan-powers e181096
Merge remote-tracking branch 'upstream/main' into fix_120874
jordan-powers ff1a4ea
Fix yaml=tsdb/20_mapping/nested dimensions
jordan-powers 6907664
Merge remote-tracking branch 'upstream/main' into fix_120874
jordan-powers 07b7a57
Avoid use of LuceneDocument::getField
jordan-powers 84bd7dd
Remove redundant test {tsdb/20_mapping/nested fields}
jordan-powers b5f8642
Merge remote-tracking branch 'upstream/main' into fix_120874
jordan-powers 138759a
Merge remote-tracking branch 'upstream/main' into fix_120874
jordan-powers 905534f
Mute tsdb/20_mapping/nested fields
jordan-powers 7b4a860
Merge remote-tracking branch 'upstream/main' into fix_120874
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: 122224 | ||
summary: Enable the use of nested field type with index.mode=time_series | ||
area: Mapping | ||
type: enhancement | ||
issues: | ||
- 120874 |
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
233 changes: 233 additions & 0 deletions
233
rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/160_nested_fields.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,233 @@ | ||
setup: | ||
- requires: | ||
cluster_features: ["mapper.tsdb_nested_field_support"] | ||
reason: "tsdb index with nested field support enabled" | ||
|
||
--- | ||
"Create TSDB index with field of nested type": | ||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
mode: time_series | ||
number_of_replicas: 1 | ||
number_of_shards: 1 | ||
routing_path: [department] | ||
time_series: | ||
start_time: 2021-04-28T00:00:00Z | ||
end_time: 2021-04-29T00:00:00Z | ||
mappings: | ||
properties: | ||
"@timestamp": | ||
type: date | ||
department: | ||
type: keyword | ||
time_series_dimension: true | ||
staff: | ||
type: integer | ||
courses: | ||
type: nested | ||
properties: | ||
name: | ||
type: keyword | ||
credits: | ||
type: integer | ||
|
||
- do: | ||
index: | ||
index: test | ||
body: { "@timestamp": "2021-04-28T01:00:00Z", "department": "compsci", "staff": 12, "courses": [ { "name": "Object Oriented Programming", "credits": 3 }, { "name": "Theory of Computation", "credits": 4 } ] } | ||
|
||
- do: | ||
index: | ||
index: test | ||
body: { "@timestamp": "2021-04-28T02:00:00Z", "department": "math", "staff": 20, "courses": [ { "name": "Precalculus", "credits": 1 }, { "name": "Linear Algebra", "credits": 3 } ] } | ||
|
||
- do: | ||
indices.refresh: | ||
index: [ test ] | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
size: 0 | ||
query: | ||
nested: | ||
path: "courses" | ||
query: | ||
bool: | ||
must: | ||
- term: | ||
courses.name: Precalculus | ||
- term: | ||
courses.credits: 3 | ||
|
||
- match: { hits.total.value: 0 } | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
nested: | ||
path: "courses" | ||
query: | ||
bool: | ||
must: | ||
- term: | ||
courses.name: "Object Oriented Programming" | ||
- term: | ||
courses.credits: 3 | ||
|
||
- match: { hits.total.value: 1 } | ||
- match: { "hits.hits.0._source.@timestamp": "2021-04-28T01:00:00.000Z" } | ||
- match: { hits.hits.0._source.department: "compsci" } | ||
- match: { hits.hits.0._source.courses: [ { "name": "Object Oriented Programming", "credits": 3 }, { "name": "Theory of Computation", "credits": 4, } ] } | ||
|
||
--- | ||
|
||
"TSDB index with multi-level nested fields": | ||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
mode: time_series | ||
number_of_replicas: 1 | ||
number_of_shards: 1 | ||
routing_path: [department] | ||
time_series: | ||
start_time: 2021-04-28T00:00:00Z | ||
end_time: 2021-04-29T00:00:00Z | ||
mappings: | ||
properties: | ||
"@timestamp": | ||
type: date | ||
department: | ||
type: keyword | ||
time_series_dimension: true | ||
staff: | ||
type: integer | ||
courses: | ||
type: nested | ||
properties: | ||
name: | ||
type: keyword | ||
credits: | ||
type: integer | ||
students: | ||
type: nested | ||
properties: | ||
name: | ||
type: text | ||
major: | ||
type: keyword | ||
|
||
- do: | ||
index: | ||
index: test | ||
body: | ||
"@timestamp": "2021-04-28T01:00:00Z" | ||
department: "compsci" | ||
staff: 12 | ||
courses: | ||
- name: "Object Oriented Programming" | ||
credits: 3 | ||
students: | ||
- name: "Kimora Tanner" | ||
major: "Computer Science" | ||
- name: "Bruno Garrett" | ||
major: "Software Engineering" | ||
- name: "Theory of Computation" | ||
credits: 4 | ||
students: | ||
- name: "Elliott Booker" | ||
major: "Computer Engineering" | ||
- name: "Kimora Tanner" | ||
major: "Software Engineering" | ||
|
||
- do: | ||
index: | ||
index: test | ||
body: | ||
"@timestamp": "2021-04-28T02:00:00Z" | ||
department: "math" | ||
staff: 20 | ||
courses: | ||
- name: "Precalculus" | ||
credits: 4 | ||
students: | ||
- name: "Elliott Ayers" | ||
major: "Software Engineering" | ||
- name: "Sylvie Howe" | ||
major: "Computer Engineering" | ||
- name: "Linear Algebra" | ||
credits: 3 | ||
students: | ||
- name: "Kimora Tanner" | ||
major: "Computer Science" | ||
- name: "Bruno Garett" | ||
major: "Software Engineering" | ||
- name: "Amelia Booker" | ||
major: "Psychology" | ||
|
||
- do: | ||
index: | ||
index: test | ||
body: | ||
"@timestamp": "2021-04-28T03:00:00Z" | ||
department: "compsci" | ||
staff: 12 | ||
courses: | ||
- name: "Object Oriented Programming" | ||
credits: 3 | ||
students: | ||
- name: "Kimora Tanner" | ||
major: "Computer Science" | ||
- name: "Bruno Garrett" | ||
major: "Software Engineering" | ||
- name: "Elliott Booker" | ||
major: "Computer Engineering" | ||
- name: "Theory of Computation" | ||
credits: 4 | ||
students: | ||
- name: "Kimora Tanner" | ||
major: "Software Engineering" | ||
- name: "Elliott Ayers" | ||
major: "Software Engineering" | ||
- name: "Apollo Pittman" | ||
major: "Computer Engineering" | ||
|
||
- do: | ||
indices.refresh: | ||
index: [ test ] | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
nested: | ||
path: "courses" | ||
query: | ||
bool: | ||
must: | ||
- nested: | ||
path: "courses.students" | ||
query: | ||
bool: | ||
must: | ||
- match: | ||
courses.students.name: "Elliott" | ||
- term: | ||
courses.students.major: "Computer Engineering" | ||
- term: | ||
courses.name: "Theory of Computation" | ||
|
||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0._source.department: "compsci" } | ||
- match: { "hits.hits.0._source.@timestamp": "2021-04-28T01:00:00.000Z" } |
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
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 we should add an assert that
getRoutingFields()
doesn't return a reference toRoutingFields.Noop#INSTANCE
? Just to make sure we are able to collect dimension values in order to generate _tsid / _id at a later stage?