Skip to content

Conversation

andrewkroh
Copy link
Member

@andrewkroh andrewkroh commented Jun 22, 2021

For the constant_keyword field type Elasticsearch allows for the value to be specified in the mapping.
If the value is not specified in the mapping then the value is set based on the first document that is
indexed. This adds support for specifying a constant_keyword "value" in a field definition.

Package data streams will be able to explicitly declare a constant_keyword value and will not have to
include the field with every document sent. It can be used optimize storage for an integration since
you could omit the constant_keyword field entirely an event's _source.

Depends on: elastic/package-spec#194 (this requires a spec update)

package-spec update: elastic/package-spec@b358e97

For the constant_keyword field type Elasticsearch allows for the value to be specified in the mapping. If the value is not specified in the mapping then the value is set based on the first document that is indexed. This adds support for specifying a constant_keyword "value" in a field definition. https://www.elastic.co/guide/en/elasticsearch//reference/7.12/keyword.html#constant-keyword-params Package data streams will be able to explicitly declare a constant_keyword value and will not have to include the field with every document sent. This gives packages more control over constant_keyword field values. It can be used optimize storage for an integration since you could omit the constant_keyword field entirely an event's _source. Relates: elastic/package-spec#194
@andrewkroh andrewkroh added the enhancement New feature or request label Jun 22, 2021
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jun 22, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #386 updated

  • Start Time: 2021-06-28T14:25:46.559+0000

  • Duration: 23 min 8 sec

  • Commit: cb873b3

Test stats 🧪

Test Results
Failed 0
Passed 315
Skipped 2
Total 317

Trends 🧪

Image of Build Times

Image of Tests

@fearful-symmetry fearful-symmetry requested a review from mtojek June 22, 2021 23:09
Copy link
Contributor

@mtojek mtojek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are more changes required than this as we enabled fields dependency management.

It's related to the use case I mentioned in https://github.com/elastic/package-spec/pull/194/files#r656795658 (import field definition and override some properties). If we want to enable properties overriding. We have to modify the logic calling fdm.ImportFields (see:

func (dm *DependencyManager) ImportField(schemaName, fieldPath string) (FieldDefinition, error) {
) to not only import a field, but also override properties. I think there are 3 places in the codebase using it (docs, builder, fields validator). The simplest way to find them would adding a sample field definition in some test package (e.g. https://github.com/elastic/elastic-package/blob/master/test/packages/nginx/data_stream/access/fields/ecs.yml#L6).

@andrewkroh
Copy link
Member Author

Good point, I'll look over the places you mention and start adding support for overriding. I can see a use-case for a field like data_stream.dataset where you want to import from ECS, but also add value: aws.vpcflow.

@mtojek
Copy link
Contributor

mtojek commented Jun 28, 2021

@andrewkroh Do you plan to finalize this PR or split into multiple chunks? If it's ready for review, please unmark the draft mode.

@andrewkroh
Copy link
Member Author

andrewkroh commented Jun 28, 2021

I will implement the ability to set attributes for external fields in a separate PR. The issue to track this feature is #392.

@andrewkroh andrewkroh marked this pull request as ready for review June 28, 2021 14:30
Copy link
Contributor

@mtojek mtojek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it! Please also update the dependency in the elastic/integrations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

3 participants