Ecs: Generating a schema with the subset and include options together means that include is not used

Created on 11 May 2020  路  4Comments  路  Source: elastic/ecs

Using both --subset and --include together fails to include the custom fields. Using one or the other of those options seems to work fine though.

scripts/generator.py \
        --subset ../../config/ecs/subset.yml \
        --include ../../config/ecs/custom \
        --out generated_custom

Specifying a single custom file with --include produces the following output with no custom YAML files listed:

Running generator. ECS version 1.6.0-dev
Loading default schemas
Loading user defined schemas: []

Specifying a directory containing one or more custom files with --include produces the following output with the correct custom YAML files listed:

Running generator. ECS version 1.6.0-dev
Loading default schemas
Loading user defined schemas: ['../../config/ecs/custom/search_metrics.yml', '../../config/ecs/custom/search_metrics_simulation.yml']
bug review

Most helpful comment

If we use the principle of least surprise, I guess I would expect a failure message. The "docs" also say it can take a file so we should at least fix that comment.

The --help output indeed says it supports directories of YAML files.

All 4 comments

As per the "documentation", this is expected if the custom fields are not in the subset file:

Note that if you use --subset and --include together, your subset file should list the custom fields you're importing via --include. Otherwise --subset will filter them out right away :-)

It seems however that there is still a bug around including a single file vs directory.

--include doesn't support providing a single file name, it expects a directory and always grabs all yaml files from that directory.

If we use the principle of least surprise, I guess I would expect a failure message. The "docs" also say it can take a file so we should at least fix that comment.

The --help output indeed says it supports directories of YAML files.

The former unofficial "docs" from #746 have been deprecated in favor of proper documentation introduced in #893. The currents docs note how --include expects a directory today.

Created a new issue to improve consistency of the two arguments in #899.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ebeahan picture ebeahan  路  7Comments

MikePaquette picture MikePaquette  路  3Comments

willemdh picture willemdh  路  5Comments

vbohata picture vbohata  路  5Comments

vbohata picture vbohata  路  5Comments