How to relate fields of two chilld index into a pattern index

Hi, i have two index, in one i have an inventory, in the other i have infections per host. In the inventory i have all the hosts with the department it belows for example, and in the other i have all infections and the host which are they. I want to do a graphic with the percentage of infections per department, but i dont know how to count all the times a host was infected relate with the department it belows and get the percentage. i dont know if i explain it well..

It sounds like you essentially want to do a join on the host between the two indices. Unfortunately Elasticsearch doesn't support joins, but you still have options.

The easiest and most common way to handle this scenario is to denormalize your data. You could index documents with host, infection, and department data all bundled together. This way, elasticsearch could easily bucket the documents based on department, and Kibana could visualize it.

Kibi can do this,see