# Coordinate Map - No Data

**URL:** https://discuss.elastic.co/t/coordinate-map-no-data/222570
**Category:** Kibana
**Created:** [March 7, 2020, 5:52pm UTC](https://discuss.elastic.co/t/coordinate-map-no-data/222570 "2020-03-07T17:52:39Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![ads](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@ads](https://discuss.elastic.co/u/ads)
#### Post date: [March 7, 2020, 5:52pm UTC](https://discuss.elastic.co/t/coordinate-map-no-data/222570/1 "2020-03-07T17:52:40Z")

</div>

Hi, I am trying to create a coordinate map based off a geo\_point. However, no locations are being shown on my map. To get to this point I first created an index with a mapping:

```
PUT cm_delivery_locations
{
  "settings" : {
    "index" : {
      "number_of_shards" : 1,
      "number_of_replicas" : 0
    }
  },
  "mappings" : {
    "properties" : {
      "delivery_postcode": { "type": "text" },
      "delivery_date": { "type": "date" },
      "delivery_location" : {
        "dynamic" : true,
        "properties" : {
          "location" : { "type" : "geo_point" },
          "latitude" : { "type" : "half_float" },
          "longitude" : { "type" : "half_float" }
        }
      }
    }
  },
  "aliases": { ".cm" : {} }
}

```

Then using Logstash I input the data. Here is a snippet of the log stash config

```
filter { 
    mutate {
      add_field => { "[delivery_location][latitude]" => "%{[latlong][0]}" }
      add_field => { "[delivery_location][lonitude]" => "%{[latlong][1]}" }
     }

    mutate {
      convert => { "[delivery_location][latitude]" => "float" }
      convert => { "[delivery_location][longitude]" => "float" }
    }
  }
}

```

Here is what Logstash puts into ES:

```
{
    "delivery_date" => 2018-09-16T23:00:00.000Z,
    "delivery_postcode" => "XXX XXX",
    "delivery_location" => {
        "lat" => XX.XXXXXXXXXXX,
        "lon" => -X.XXXXXXXXXXX
}

```

And the Logstash output:

```
output {
  elasticsearch {
    hosts => ["localhost:9200"]
    index => "cm_delivery_locations"
    manage_template => true
    template => "/etc/elasticsearch/templates/cm_delivery_locations.json"
    template_name => "cm_delivery_locations"
    template_overwrite => "true"
  }
  stdout { codec => rubydebug }
}

```

In Kibana I have created an index pattern, which shows 'delivery\_location.location' as type geo\_point. Discover shows the correct lat/long coordinates on search. Under visualisations, when I add a new visualisation, I am able to select 'delivery\_location.location' as a Geohash (aggregation). However, when clicking the play button nothing shows on the map. Is there a way to see what is in the geo\_point location field? Or have I missed something obvious?

Thanks,

Adam

---

<div class="post-metadata">

### Author: ![Rahul\_Kumar4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_kumar4/32/67369_2.png) [@Rahul\_Kumar4](https://discuss.elastic.co/u/Rahul_Kumar4)
#### Post date: [March 7, 2020, 8:58pm UTC](https://discuss.elastic.co/t/coordinate-map-no-data/222570/2 "2020-03-07T20:58:22Z")

</div>

@ads. Can you click on the `inspect` tab on the map and see what it shows there? It should show you some data points in a tabular format. If it does not, there is a `request` tab that gives a snapshot of the query that ran and if there were any errors.

![Screen Shot 2020-03-07 at 3.52.36 PM](https://us1.discourse-cdn.com/elastic/original/3X/0/2/0253c22fc8b77a803a479cccaf1a72eac8b7f43c.png)

![Screen Shot 2020-03-07 at 3.52.56 PM](https://us1.discourse-cdn.com/elastic/original/3X/4/3/43c93caf9c33981316c5356f70e456f258664eaa.png)

---

<div class="post-metadata">

### Author: ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)
#### Post date: [March 7, 2020, 10:26pm UTC](https://discuss.elastic.co/t/coordinate-map-no-data/222570/3 "2020-03-07T22:26:01Z")

</div>

When setting up your Kibana index pattern, did you set the `Time Filter field name`? What field did you specify? What time range is displayed in Kibana? Is the time filter excluding all documents? From the sample document provided, it looks like your timestamp is from 2018-09-16T23:00:00.000Z. Kibana defaults to last 15 minutes so I would suspect this may be the case of there not being any data displayed.

Also, why are using coordinate map? Have you tried the new maps application, [https://www.elastic.co/guide/en/kibana/7.6/maps.html](https://www.elastic.co/guide/en/kibana/7.6/maps.html)

---

<div class="post-metadata">

### Author: ![ads](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@ads](https://discuss.elastic.co/u/ads)
#### Post date: [March 8, 2020, 11:09am UTC](https://discuss.elastic.co/t/coordinate-map-no-data/222570/4 "2020-03-08T11:09:09Z")

</div>

Great, thats helpful. The request is:

```
{
  "aggs": {
    "filter_agg": {
      "filter": {
        "geo_bounding_box": {
          "ignore_unmapped": true,
          "delivery_location.location": {
            "top_left": {
              "lat": 56.719829999999995,
              "lon": -12.293700000000001
            },
            "bottom_right": {
              "lat": 46.438790000000004,
              "lon": 10.77759
            }
          }
        }
      },
      "aggs": {
        "2": {
          "geohash_grid": {
            "field": "delivery_location.location",
            "precision": 4
          },
          "aggs": {
            "3": {
              "geo_centroid": {
                "field": "delivery_location.location"
              }
            }
          }
        }
      }
    }
  },
  "size": 0,
  "stored_fields": [
    "*"
  ],
  "script_fields": {},
  "docvalue_fields": [
    {
      "field": "@timestamp",
      "format": "date_time"
    },
    {
      "field": "delivery_date",
      "format": "date_time"
    }
  ],
  "_source": {
    "excludes": []
  },
  "query": {
    "bool": {
      "must": [],
      "filter": [
        {
          "match_all": {}
        },
        {
          "match_all": {}
        },
        {
          "range": {
            "delivery_date": {
              "gte": "2017-01-01T00:00:00.000Z",
              "lte": "2019-12-31T23:30:00.000Z",
              "format": "strict_date_optional_time"
            }
          }
        }
      ],
      "should": [],
      "must_not": []
    }
  }
}

```

And the response is:

```
{
  "took": 2,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 772,
    "max_score": null,
    "hits": []
  },
  "aggregations": {
    "filter_agg": {
      "2": {
        "buckets": []
      },
      "doc_count": 0
    }
  }
}

```

If I'm interpreting this correctly, its saying that there were 772 matches but no data in them?

I did try using the maps application, with the same results when adding a Grid Aggregation layer. Looking at it again, using inspect, my hits total is returning 0. The other thing is, the non-geoip examples I found online use coordinate maps, so I thought I would try that approach. Happy to take troubleshooting steps using the maps application instead.

Thanks,

---

<div class="post-metadata">

### Author: ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)
#### Post date: [March 10, 2020, 1:11am UTC](https://discuss.elastic.co/t/coordinate-map-no-data/222570/5 "2020-03-10T01:11:18Z")

</div>

What examples are you following online? Curious what resources are out there.

What does your elasticsearch mapping look like? Can you provide a sample document?  
Can you try a document layer in the maps application? Do those show up?

---

<div class="post-metadata">

### Author: ![ads](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@ads](https://discuss.elastic.co/u/ads)
#### Post date: [March 10, 2020, 5:39pm UTC](https://discuss.elastic.co/t/coordinate-map-no-data/222570/6 "2020-03-10T17:39:57Z")

</div>

I've used a range of resources to try and figure this out. The most useful has been:

- A great guide but the commands don't work with version 7.x: [http://www.sanjeevnandam.com/blog/logstash-convert-zipcodepostal-code-to-geo\_point-latitudelongitude](http://www.sanjeevnandam.com/blog/logstash-convert-zipcodepostal-code-to-geo_point-latitudelongitude)
- Also a great blog. The solution uses GeoIP, an approach I tried to take initially but couldn't get it to work: [https://www.elastic.co/blog/geoip-in-the-elastic-stack](https://www.elastic.co/blog/geoip-in-the-elastic-stack)
- I have used a number of the elastic command references, such as [https://www.elastic.co/guide/en/logstash/7.6/plugins-filters-geoip.html](https://www.elastic.co/guide/en/logstash/7.6/plugins-filters-geoip.html) etc.
- I've read so many discussion posts I've not kept track of, some of which were really useful i.e: [ELK 5.2.1 - still can't get geoip working](https://discuss.elastic.co/t/elk-5-2-1-still-cant-get-geoip-working/76420). Many of the issues, as far as I can tell, are related to GeoIP rather than generic geo (lat/long) issues.
- Some sites showed me what was possible but without providing step-by-step guides: [https://medium.com/@andrea.reon/elasticsearch-why-and-how-c79a43288a4b](https://medium.com/@andrea.reon/elasticsearch-why-and-how-c79a43288a4b)
- Other blogs looked like they were going to be really useful but are addressing a slightly different problem: [http://www.tapsw.com/software-development-elasticsearch-uk-postcodes.php](http://www.tapsw.com/software-development-elasticsearch-uk-postcodes.php)

I've not managed to find an example of someone creating a mapping for ES 7.x. The resources above mostly show mappings that use types and the `_default_` parameter, which are now obsolete. It likely that my google-fu is rusty, so apologies if anyone reading this has written an article using 7.x, I've just not managed to find it yet.

I have spent a long time looking at Logstash as I thought this is where the problem lay. Now that the latitude/longitude data is available in discover, I wonder whether the issue is related to the index mapping or my understanding of how to generate a geo\_point from Logstash.

My Elasticsearch mapping, if I've understood correctly what a mapping is, is as per my first post:

```
{
  "settings" : {
    "index" : {
      "number_of_shards" : "1",
      "refresh_interval" : "5s"
    }
  },
  "index_patterns": ["cm_delivery_locations"],
  "mappings" : {
    "properties" : {
      "delivery_postcode": { "type": "text" },
      "delivery_date": { "type": "date" },
      "delivery_location" : {
        "dynamic" : true,
        "properties" : {
          "location" : { "type" : "geo_point" },
          "latitude" : { "type" : "half_float" },        
          "longitude" : { "type" : "half_float" }
        }
      }
    }
  }
}

```

If I perform a document layer in Maps, Inspect shows the following request:

```
{
  "docvalue_fields": [
    "delivery_location.location"
  ],
  "size": 10000,
  "_source": false,
  "stored_fields": [
    "delivery_location.location"
  ],
  "script_fields": {},
  "query": {
    "bool": {
      "must": [],
      "filter": [
        {
          "match_all": {}
        },
        {
          "range": {
            "delivery_date": {
              "gte": "2017-01-01T00:00:00.000Z",
              "lte": "2019-12-31T23:30:00.000Z",
              "format": "strict_date_optional_time"
            }
          }
        }
      ],
      "should": [],
      "must_not": []
    }
  }
}

```

And this response:

```
{
  "took": 38,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 772,
    "max_score": 0,
    "hits": [
      {
        "_index": "cm_delivery_locations",
        "_type": "_doc",
        "_id": "WeDtuXABDb_U0HpUp96o",
        "_score": 0
      },
      {
        "_index": "cm_delivery_locations",
        "_type": "_doc",
        "_id": "SODtuXABDb_U0HpUp96o",
        "_score": 0
      },
      {

... cut data ...

      }
    ]
  }
}

```

There are no dots shown on the roadmap. Does this mean that the geo\_point coordinates are not being returned correctly? Should I expect to see Lat/Long data in the hits array?

Thanks,

---

<div class="post-metadata">

### Author: ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)
#### Post date: [March 10, 2020, 9:13pm UTC](https://discuss.elastic.co/t/coordinate-map-no-data/222570/7 "2020-03-10T21:13:54Z")

</div>

Looks like your documents are not populating delivery\_location.location. Can you run the following command in Kibana dev tools. What do your documents look like?

```auto
GET cm_delivery_locations/_search
{
 "size": 10
}

```

---

<div class="post-metadata">

### Author: ![ads](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@ads](https://discuss.elastic.co/u/ads)
#### Post date: [March 10, 2020, 9:29pm UTC](https://discuss.elastic.co/t/coordinate-map-no-data/222570/8 "2020-03-10T21:29:02Z")

</div>

I get the following:

```
{
  "took" : 0,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1056,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "cm_delivery_locations",
        "_type" : "_doc",
        "_id" : "WODtuXABDb_U0HpUSNqT",
        "_score" : 1.0,
        "_source" : {
          "delivery_postcode" : "xxx xxx",
          "delivery_date" : "2017-03-29T23:00:00.000Z",
          "delivery_location" : {
            "longitude" : -1.xxxxxxxxxxxxxx,
            "latitude" : 52.xxxxxxxxxxxxxx
          }
        }
      },
      {
        "_index" : "cm_delivery_locations",
        "_type" : "_doc",
        "_id" : "WeDtuXABDb_U0HpUSNqT",
        "_score" : 1.0,
        "_source" : {
          "delivery_postcode" : "xxx xx",
          "delivery_date" : "2016-03-29T23:00:00.000Z",
          "delivery_location" : {
            "longitude" : -1.xxxxxxxxxxxxxx,
            "latitude" : 51.xxxxxxxxxxxxxx
          }
        }
      },

... cut other 8 results ...

      }
    ]
  }
}
```

---

<div class="post-metadata">

### Author: ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)
#### Post date: [March 10, 2020, 9:46pm UTC](https://discuss.elastic.co/t/coordinate-map-no-data/222570/9 "2020-03-10T21:46:50Z")

</div>

I see the problem in your data.

`delivery_location.location` is not populated so there is nothing to map. You need to update your ingest process to ensure delivery\_location.location is set.

---

<div class="post-metadata">

### Author: ![ads](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@ads](https://discuss.elastic.co/u/ads)
#### Post date: [March 10, 2020, 10:03pm UTC](https://discuss.elastic.co/t/coordinate-map-no-data/222570/10 "2020-03-10T22:03:50Z")

</div>

How do I do that? Is it to do with the configuration in Logstash? Are there some docs you can point me at? Thanks

---

<div class="post-metadata">

### Author: ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)
#### Post date: [March 10, 2020, 10:28pm UTC](https://discuss.elastic.co/t/coordinate-map-no-data/222570/11 "2020-03-10T22:28:25Z")

</div>

Where is the data coming from? Have you tried the logstash [stdout plugin](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-stdout.html) to view the documents before they get inserted into Elasticsearch. This is a great way to see what the documents look like and debug why they are different then expected.

---

<div class="post-metadata">

### Author: ![ads](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@ads](https://discuss.elastic.co/u/ads)
#### Post date: [March 10, 2020, 10:52pm UTC](https://discuss.elastic.co/t/coordinate-map-no-data/222570/12 "2020-03-10T22:52:01Z")

</div>

That's what I'm using and it shows this as its output:

```
{
    "delivery_date" => 2018-09-16T23:00:00.000Z,
    "delivery_postcode" => "XXX XXX",
    "delivery_location" => {
        "lat" => 51.XXXXXXXXXXX,
        "lon" => -1.XXXXXXXXXXX
}

```

I guess I had assumed from this that the location geo\_point would be auto populated. However, that doesn't seem to be the case, I'm just not sure what I'm missing.

---

<div class="post-metadata">

### Author: ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)
#### Post date: [March 10, 2020, 11:11pm UTC](https://discuss.elastic.co/t/coordinate-map-no-data/222570/13 "2020-03-10T23:11:49Z")

</div>

You need to update your filter expression to set location. Try something like the below

```auto
filter { 
    mutate {
      add_field => { "[delivery_location][latitude]" => "%{[latlong][0]}" }
      add_field => { "[delivery_location][lonitude]" => "%{[latlong][1]}" }
     }

    mutate {
      convert => { "[delivery_location][latitude]" => "float" }
      convert => { "[delivery_location][longitude]" => "float" }
    }

    mutate {
      add_field => { "[delivery_location][location][lat]" => "%{[delivery_location][latitude]}" }
      add_field => { "[delivery_location][location][lon]" => "%{[delivery_location][longitude]}" }
     }
  }
}

```

---

<div class="post-metadata">

### Author: ![ads](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@ads](https://discuss.elastic.co/u/ads)
#### Post date: [March 11, 2020, 10:48pm UTC](https://discuss.elastic.co/t/coordinate-map-no-data/222570/14 "2020-03-11T22:48:59Z")

</div>

Thank you Nathan, that was it!!

If I am interpreting this correctly, LAT/LON has to be a nested indicie within 'location', which is a specific ES construct?

---

<div class="post-metadata">

### Author: ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)
#### Post date: [March 12, 2020, 12:42am UTC](https://discuss.elastic.co/t/coordinate-map-no-data/222570/15 "2020-03-12T00:42:12Z")

</div>

> If I am interpreting this correctly, LAT/LON has to be a nested indicie within 'location', which is a specific ES construct?

There are several ways to define lat and lon for geo\_points. One way is an object with `lat` and `lon` properties. Others are listed at [Geopoint field type | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html)

---

<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: [April 9, 2020, 12:42am UTC](https://discuss.elastic.co/t/coordinate-map-no-data/222570/16 "2020-04-09T00:42:13Z")

</div>

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