# Host.os is missing in generated template when host is expected in a custom schema using ECS Tooling 1.6 and 1.7

**URL:** <https://discuss.elastic.co/t/host-os-is-missing-in-generated-template-when-host-is-expected-in-a-custom-schema-using-ecs-tooling-1-6-and-1-7/258786>\
**Category:** Elasticsearch\
**Tags:** ecs-elastic-common-schema\
**Created:** [December 15, 2020, 10:07pm UTC](https://discuss.elastic.co/t/host-os-is-missing-in-generated-template-when-host-is-expected-in-a-custom-schema-using-ecs-tooling-1-6-and-1-7/258786 "2020-12-15T22:07:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mxu](https://avatars.discourse-cdn.com/v4/letter/m/90ced4/32.png) [@mxu](https://discuss.elastic.co/u/mxu)\
**Post date:** [December 15, 2020, 10:07pm UTC](https://discuss.elastic.co/t/host-os-is-missing-in-generated-template-when-host-is-expected-in-a-custom-schema-using-ecs-tooling-1-6-and-1-7/258786/1 "2020-12-15T22:07:18Z")

</div>

Hi, I am using ECS Tooling (1.6 and 1.7) to generate template, adding "host" to a custom schema "Link". Added host.yml as following. In the resulted template.json, while host.geo exists, host.os is missing.

After I changed os.yml file (in buildin "schemas" dir) name to be o.yml, or bo.yml, host.os presents in template.

This happens for both 1.6 and 1.7.

## host.yml (in custom-schema dir)

- name: host  
title: Host  
.....  
type: group  
reusable:  
top\_level: true  
expected:  
- Link

## ========= Link.yml (in custom-schema dir)

- name: Link  
title: Link  
group: 2  
description: \>  
Link....  
type: group

I also tested changing geo.yml to o.yml, geo will be missing.

Is this config error in my part of something in the Tool?

Any help is very much appreciated.

---

<div class="post-metadata">

**Author:** ![ebeahan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebeahan/32/78989_2.png) [@ebeahan](https://discuss.elastic.co/u/ebeahan)\
**Post date:** [December 16, 2020, 10:27pm UTC](https://discuss.elastic.co/t/host-os-is-missing-in-generated-template-when-host-is-expected-in-a-custom-schema-using-ecs-tooling-1-6-and-1-7/258786/2 "2020-12-16T22:27:22Z")

</div>

Welcome to the community @mxu!

I was able to replicate your issue. This issue is happening because `Link.*` is reusing `host.*` at the same phase in which `host.*` is populating its reuses. When `Link` nests `hosts`, `hosts` hasn't had all its reuses added yet. I'm continuing to dig into this a bit further.

As a workaround, you can add the `reusable.order` attribute to your custom `host.yml` definitions and set it to `3`:

```auto
---
- name: host
  title: Host
  type: group
  reusable:
    order: 3
    top_level: true
    expected:
    - Link

```

The default value is `2`, and using `3` will ensure that nestings expected `Link` will come after the `host.*` nestings.

---

<div class="post-metadata">

**Author:** ![mxu](https://avatars.discourse-cdn.com/v4/letter/m/90ced4/32.png) [@mxu](https://discuss.elastic.co/u/mxu)\
**Post date:** [December 17, 2020, 2:35pm UTC](https://discuss.elastic.co/t/host-os-is-missing-in-generated-template-when-host-is-expected-in-a-custom-schema-using-ecs-tooling-1-6-and-1-7/258786/3 "2020-12-17T14:35:25Z")

</div>

Thank you, Eric. I will try reusable: order: 3.  
It seems related to the alphabetical order of schema file names . geo.yml is before host.yml, it does not have this problem. After changing os.yml to \_os.yml or bs.yml (whatever before host), it would work fine.  
Thanks again!

---

<div class="post-metadata">

**Author:** ![mxu](https://avatars.discourse-cdn.com/v4/letter/m/90ced4/32.png) [@mxu](https://discuss.elastic.co/u/mxu)\
**Post date:** [December 17, 2020, 2:48pm UTC](https://discuss.elastic.co/t/host-os-is-missing-in-generated-template-when-host-is-expected-in-a-custom-schema-using-ecs-tooling-1-6-and-1-7/258786/4 "2020-12-17T14:48:34Z")

</div>

> [@ebeahan](#):
>
> ` order: 3`

Eric, After adding order: 3, the template was generated correctly. Thanks for your help.  
It may be worthy to add that to README?  
And please note that "geo" was correctly added to Link....host without "order: 3"

---

<div class="post-metadata">

**Author:** ![ebeahan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebeahan/32/78989_2.png) [@ebeahan](https://discuss.elastic.co/u/ebeahan)\
**Post date:** [December 18, 2020, 11:46pm UTC](https://discuss.elastic.co/t/host-os-is-missing-in-generated-template-when-host-is-expected-in-a-custom-schema-using-ecs-tooling-1-6-and-1-7/258786/5 "2020-12-18T23:46:18Z")

</div>

Thanks, @mxu!

You're correct about the alphabetical ordering; each group is sorted alphabetically while the reuses are populated.

I've opened an [issue](https://github.com/elastic/ecs/issues/1207) to document `reusable.order` and note its usage in this type of situation, and I'll open a PR to address.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 15, 2021, 11:46pm UTC](https://discuss.elastic.co/t/host-os-is-missing-in-generated-template-when-host-is-expected-in-a-custom-schema-using-ecs-tooling-1-6-and-1-7/258786/6 "2021-01-15T23:46:39Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
