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
Fleet: add support for subobjects: false #171826
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
78169c0
to
93a4249
Compare
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.
Looks mostly good to me. We should confirm first how this is going to be supported in package-spec, to know what cases should be supported.
Lets continue with elastic/package-spec#573 in parallel.
const objectFieldWithPropertyReversedLiteralYml = ` | ||
- name: a.labels | ||
type: object | ||
subobjects: false |
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.
I think that this mapping is not allowed in the package spec. It would not define a mapping for the sub fields of a.labels
.
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.
Yep, I agree.
I kept this case around if we found a compelling use case to resurrect it. There isn't one.
So, since it is not allowed in package-spec v3, I will drop this mapping from the PR.
const mappings = generateMappings(processedFields); | ||
expect(mappings).toEqual(objectFieldWithPropertyReversedMapping); | ||
}); | ||
|
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 add a test case where subobjects
is used in an object without dynamic mappings? Something like this.
- name: a
type: object
subobjects: false
fields:
- name: b.c
type: keyword
- name: x.y
type: keyword
For completeness, more than because I have some use case in mind 🙂
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.
Makes sense!
I added the test case in the template.test.ts
file:
- name: a
type: object
subobjects: false
fields:
- name: b.c
type: keyword
- name: x.y
type: keyword
And I am getting the following result:
{
properties: {
a: {
type: 'object',
subobjects: false,
},
},
}
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.
The result is weird, but I think it's because to have fields
, the type
should be group
, right?
I tried to add this to the good_v3
test package, and it complains about the type
value:
type must be one of the following: "group", "nested"
Since the type is not group
the content of fields
is probably ignored.
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.
Ah yes, you are right, it should be type: group
, not object
, can you try to change it? Or well, maybe we don't need to support this use case, at least by now.
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.
Yeah, looking to what we will likely do in the spec we don't need to support the case of the object with subfields.
x-pack/plugins/fleet/server/services/epm/elasticsearch/template/template.ts
Show resolved
Hide resolved
Pinging @elastic/fleet (Team:Fleet) |
93a4249
to
aa0c9b6
Compare
@jsoriano, do you think we're close to the finish line, or does this PR need more work? It would be great to have it in 8.12, if ready. |
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.
I am sorry it won't probably reach 8.12. Lets get this in and in the package spec so we can start testing with actual packages.
expect(mappings).toEqual(objectFieldWithPropertyReversedMapping); | ||
}); | ||
|
||
it('tests processing object field with subobjects without dynamic mappings', () => { |
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.
This test can be probably removed as this won't be supported by the spec, as very well noticed in https://github.com/elastic/kibana/pull/171826/files#r1411644741
@elasticmachine merge upstream |
1 similar comment
@elasticmachine merge upstream |
Add support for the basic case: - name: b.labels.* type: object object_type: keyword subjects: false that `_generateMappings()` should map to: { "properties": { "a": { "properties": { "labels": { "type": "object", "subobjects": false } } } } }
We consider case C invalid and we'll not support it.
Use case A is non allowed in package-spec v3.
We decided [^1] this is not a supported use case, dropping it. [^1]: elastic#171826 (comment)
4cfd6c5
to
522baa5
Compare
💛 Build succeeded, but was flaky
Failed CI Steps
Metrics [docs]
History
To update your PR or re-run it, just comment with: cc @zmoog |
Summary
Update the Fleet plugin to support the subobjects setting on the
object
type mapping.This PR supports the
subobjects
setting on a per-field basis. We will add support forsubobjects
setting at the data stream level when Elasticsearch will automatically flatten the mappings in elastic/elasticsearch#99860.The PR add deals with the following user cases found in the integration packages and add support for a few of them.
Case AThe use case A is invalid on package-spec v3 and it's not supported.
Case B
that
_generateMappings()
should map to:Case CThe use case C is considered invalid and it's not supported.
Case D
that
_generateMappings()
should map to:Checklist
Delete any items that are not applicable to this PR.
[ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support[ ] Any UI touched in this PR is usable by keyboard only (learn more about keyboard accessibility)[ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: FF, Chrome)[ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list[ ] This renders correctly on smaller devices using a responsive layout. (You can test this in your browser)[ ] This was checked for cross-browser compatibilityRisk Matrix
Delete this section if it is not applicable to this PR.
Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.
When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:
For maintainers