# Dec 7th, 2022: \[EN\] Map your distributed team in Kibana

**URL:** <https://discuss.elastic.co/t/dec-7th-2022-en-map-your-distributed-team-in-kibana/320438>\
**Category:** Advent Calendar\
**Created:** [December 7, 2022, 8:00am UTC](https://discuss.elastic.co/t/dec-7th-2022-en-map-your-distributed-team-in-kibana/320438 "2022-12-07T08:00:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xeraa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xeraa/32/48181_2.png) [@xeraa](https://discuss.elastic.co/u/xeraa)\
**Post date:** [December 7, 2022, 8:00am UTC](https://discuss.elastic.co/t/dec-7th-2022-en-map-your-distributed-team-in-kibana/320438/1 "2022-12-07T08:00:46Z")

</div>

![christmas](https://us1.discourse-cdn.com/elastic/original/3X/4/3/4320dabbe06d8ff8e82b5c7ac87a7ee3fab142cf.png)

Working in a distributed company like Elastic is great, but can sometimes be hard to grasp. Answering some seemingly simple questions can be surprisingly complicated, like:

- Show our team on a map, so I can explain our reach and structure.
- Let me find anyone in a certain area, so we know who is "local".
- Find someone with a specific skill close by.
- Show the team growth over time.
- Document region coverage, so anyone can look it up.

Luckily, Kibana can help here and the goal of this post is to create a map like this:

 ![Community team in Europe](https://us1.discourse-cdn.com/elastic/original/3X/1/0/101adca0657801d71187d37c6a6ad90737729010.jpeg)

## Mapping and Data in Elasticsearch

Before you can jump into the visualization, you need to [create the correct mapping](https://www.elastic.co/guide/en/elasticsearch/reference/8.5/explicit-mapping.html) (or schema&nbsp;— this isn't directly related to a map yet 😅). Run the following request in Kibana's Console to create the mapping:

```json
PUT team
{
  "mappings": {
    "dynamic": "strict",
    "properties": {
      "name": {
        "type": "keyword"
      },
      "team": {
        "type": "keyword"
      },
      "role": {
        "type": "keyword"
      },
      "start_date": {
        "type": "date"
      },
      "country_code": {
        "type": "keyword"
      },
      "city": {
        "type": "keyword"
      },
      "location": {
        "type": "geo_point"
      },
      "technology": {
        "type": "keyword"
      },
      "region": {
        "type": "keyword"
      },
      "picture": {
        "type": "keyword"
      }
    }
  }
}

```

Most important in the mapping is:

- [`geo_point`](https://www.elastic.co/guide/en/elasticsearch/reference/8.5/geo-point.html) is the most important data type to use on a map.
- The [`date`](https://www.elastic.co/guide/en/elasticsearch/reference/8.5/date.html) field is necessary to show the development over time.

To keep it simple, the sample data set used only includes the Community team in Europe:

```json
PUT team/_doc/david
{
  "name": "David Pilato",
  "team": "community",
  "role": "Developer 🥑",
  "start_date": "2013-01-10",
  "country_code": "fr",
  "city": "Cergy",
  "location": {
    "lat": 49.05,
    "lon": 2.04
  },
  "technology": ["java", "elasticsearch", "search"],
  "picture": "https://avatars.githubusercontent.com/u/274222"
}
PUT team/_doc/philipp
{
  "name": "Philipp Krenn",
  "team": "community",
  "role": "Developer 🥑 | EMEA Lead",
  "start_date": "2016-04-01",
  "country_code": "at",
  "city": "Vienna",
  "location": {
    "lat": 48.21,
    "lon": 16.37
  },
  "technology": ["java", "automation", "observability"],
  "picture": "https://avatars.githubusercontent.com/u/432211"
}
PUT team/_doc/adrienne
{
  "name": "Adrienne de Vries",
  "team": "community",
  "role": "Community Programs",
  "start_date": "2019-12-02",
  "country_code": "nl",
  "city": "Rotterdam",
  "location": {
    "lat": 51.92,
    "lon": 4.48
  },
  "region": ["FR", "ES", "PT", "IT", "GR", "TR", "CY", "NL", "BE", "DK", "LU", "NO", "SE", "FI", "IS", "EE", "LV", "LT", "MA", "TN", "DZ"],
  "picture": "https://ca.slack-edge.com/T0CUZ52US-UQQ55JABU-56457843fc81-512"
}
PUT team/_doc/naoise
{
  "name": "Naoise Rush",
  "team": "community",
  "role": "Community Programs",
  "start_date": "2022-02-28",
  "country_code": "gb",
  "city": "Belfast",
  "location": {
    "lat": 54.60,
    "lon": -5.93
  },
  "region": ["GB", "IE", "DE", "AT", "CH", "PL", "CZ", "SK", "SI", "HU", "RO", "BG", "MD", "UA", "HR", "RS", "BA", "AL", "XK", "ME", "MK", "IL", "SA", "EG", "AE", "JO", "LB", "KW", "QA", "OM", "BH"],
  "picture": "https://ca.slack-edge.com/T0CUZ52US-U033ZF1HPM3-3f8511dbc26f-512"
}
PUT team/_doc/carly
{
  "name": "Carly Richmond",
  "team": "community",
  "role": "Developer 🥑",
  "start_date": "2022-04-25",
  "country_code": "uk",
  "city": "London",
  "location": {
    "lat": 51.55,
    "lon": 0.16
  },
  "technology": ["javascript", "frontend", "observability"],
  "picture": "https://avatars.githubusercontent.com/u/74931905"
}

```

## Adding the Data in Kibana

Before you can use the data in Kibana, you need to add the indexed data to a [Data View](https://www.elastic.co/guide/en/kibana/8.5/data-views.html):

 ![Add the Data View](https://us1.discourse-cdn.com/elastic/original/3X/2/4/2421b1366f20a0859dd259a02bba7ada9aa26f96.png)

And to use the pictures, you need to customize the `picture` field to a `Url` of the type `Image` and set the URL template to `{{rawValue}}`:

 ![Customize the picture field](https://us1.discourse-cdn.com/elastic/original/3X/4/1/419536643e072272a09ed2542f6b953be4f737b4.jpeg)

Once set up, you can view the underlying documents in _Discover_ and change the timeframe to 10 years (from the default of 15 minutes):

 ![Documents in Discover](https://us1.discourse-cdn.com/elastic/original/3X/5/3/530a818ef8671eb8579091c74cc8b967ad7d3f0a.png)

## Adding the First Map — at Last

[Maps in Kibana](https://www.elastic.co/guide/en/kibana/8.5/maps.html) have a lot of features, but the example will keep it simple. Add a layer of the type _Documents_:

 ![Add a map based on documents](https://us1.discourse-cdn.com/elastic/original/3X/e/6/e6bbbff3247d27215da8df94e5270522ba26ceda.jpeg)

And in the `team` index, pick the only available geo-point `location`:

 ![Select the data source](https://us1.discourse-cdn.com/elastic/original/3X/4/7/47157e38d565788550f4ea70bcca9ba813aac67d.jpeg)

Add the most relevant tooltip fields:

 ![Customize the fields](https://us1.discourse-cdn.com/elastic/original/3X/1/7/172ccb1c8276da6b0a6dcfe0c4ae13e12d7762b7.png)

And adjust the color of each document by the `role`:

 ![Differentiate by color](https://us1.discourse-cdn.com/elastic/original/3X/2/1/21545360a1f8fe3151ca64f9ecf0bb0f5e26e678.png)

And that's all we need to get the team on the map. If you don't see anything, double-check that you have picked the past 10 years and not just 15 minutes again. Hovering over one of them reveals their profile and based on the color you can tell their role:

 ![Showing the result](https://us1.discourse-cdn.com/elastic/original/3X/1/0/101adca0657801d71187d37c6a6ad90737729010.jpeg)

## Mapping Time

Based on the `start_date` field for each team member, you can show how it developed over time or even autoplay it year by year:

 ![Development over time](https://us1.discourse-cdn.com/elastic/original/3X/9/6/96c4c24d2673e382a2ea6846718e03ba923fdab1.jpeg)

## Putting Search on the Map

Search is core to what we do. So if you want to figure out who on our team could help you out with all things "frontend", you could also find that on the map:

 ![Searching for skills and showing the results on the map](https://us1.discourse-cdn.com/elastic/original/3X/2/e/2ef18b618e216d11f791a802e9a56f9dade0d676.jpeg)

## Mapping Regions

Our team also has the concept of owning certain regions. Time to add another layer to the map — this time it's the _Choropleth_. The `region` array of the Elasticsearch documents maps to the _ISO 3166-1 alpha-2 code_ of countries. And we can limit it to the role of "Community Programs", since only they own regions:

 ![Mapping regions to the team for ownership](https://us1.discourse-cdn.com/elastic/original/3X/8/8/88a642f133d44343db772e135aed4b51aee1e7cb.jpeg)

Sprinkling a bit of color on top by name:

 ![Coloring by name](https://us1.discourse-cdn.com/elastic/original/3X/0/8/08d46a2873d5e230b39e6852fcb39017344d8d08.jpeg)

And we have neatly mapped out the ownership of the entire region:

 ![Ownership in the region](https://us1.discourse-cdn.com/elastic/original/3X/c/a/ca9b38b7cb449445d4152d9dffc3604000c09db3.jpeg)

## Helping Santa Find the Team

To add something more Christmas related, let's help Santa find the team. This information should go in a new index with the simple mapping for `source` and `destination` geo-points in one document:

```json
PUT santa
{
  "mappings": {
    "dynamic": "strict",
    "properties": {
      "@timestamp": {
        "type": "date"
      },
      "source": {
        "type": "geo_point"
      },
      "destination": {
        "type": "geo_point"
      }
    }
  }
}

```

And these are the documents for the actual travel route:

```json
POST santa/_doc
{
  "@timestamp": "2022-12-24T19:30Z",
  "source": {
    "lat": 48.21,
    "lon": 100
  },
  "destination": {
    "lat": 48.21,
    "lon": 16.37
  }
}
POST santa/_doc
{
  "@timestamp": "2022-12-24T19:40Z",
  "source": {
    "lat": 48.21,
    "lon": 16.37
  },
  "destination": {
    "lat": 49.05,
    "lon": 2.04
  }
}
POST santa/_doc
{
  "@timestamp": "2022-12-24T19:50Z",
  "source": {
    "lat": 49.05,
    "lon": 2.04
  },
  "destination": {
    "lat": 51.92,
    "lon": 4.48
  }
}
POST santa/_doc
{
  "@timestamp": "2022-12-24T20:00Z",
  "source": {
    "lat": 51.92,
    "lon": 4.48
  },
  "destination": {
    "lat": 51.55,
    "lon": 0.16
  }
}
POST santa/_doc
{
  "@timestamp": "2022-12-24T20:10Z",
  "source": {
    "lat": 51.55,
    "lon": 0.16
  },
  "destination": {
    "lat": 54.60,
    "lon": -5.93
  }
}
POST santa/_doc
{
  "@timestamp": "2022-12-24T20:20Z",
  "source": {
    "lat": 54.60,
    "lon": -5.93
  },
  "destination": {
    "lat": 54.60,
    "lon": -20.00
  }
}

```

Add one more layer, this time with _Point to point_. In which you map `source` and `destination`:

 ![Mapping source and destination in a point-to-point map](https://us1.discourse-cdn.com/elastic/original/3X/0/6/06d323c334584c440ad4efe9e77b57b34ef65f05.jpeg)

And with some minor customization, you can show Santa the way to everyone on the team. Picking the right timeframe, you could even follow along as the reindeers are traversing every segment on the route:

 ![Following Santa](https://us1.discourse-cdn.com/elastic/original/3X/0/3/0334f601126bc188b780d20731d6d06f3f78dcf6.jpeg)

## Conclusion

We hope that this gave you some ideas on how to put distributed teams on the map. Kibana can still do a lot more — the [documentation for maps](https://www.elastic.co/guide/en/kibana/8.5/maps.html) is a great starting point there.

---

<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 4, 2023, 8:01am UTC](https://discuss.elastic.co/t/dec-7th-2022-en-map-your-distributed-team-in-kibana/320438/2 "2023-01-04T08:01:20Z")

</div>

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