# Not getting my geo\_point

**URL:** <https://discuss.elastic.co/t/not-getting-my-geo-point/170525>\
**Category:** Elasticsearch\
**Created:** [March 1, 2019, 3:17pm UTC](https://discuss.elastic.co/t/not-getting-my-geo-point/170525 "2019-03-01T15:17:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![BouchardClaude](https://avatars.discourse-cdn.com/v4/letter/b/e495f1/32.png) [@BouchardClaude](https://discuss.elastic.co/u/BouchardClaude)\
**Post date:** [March 1, 2019, 3:17pm UTC](https://discuss.elastic.co/t/not-getting-my-geo-point/170525/1 "2019-03-01T15:17:31Z")

</div>

Hi ! (Previously opened this issue in kibana forum, but I found it look more like ES problem after couple of debugging steps. [Kibana not plotting my Geo\_point](https://discuss.elastic.co/t/kibana-not-plotting-my-geo-point/170224))

so here is my mapping for my index

```auto
    "mappings": {
      "geoip": {
        "properties": {
          "geoip": {
            "properties": {
              "location": {
                "type": "geo_point"
              }
            }
          }
        }
      }
    }, 

```

I'm getting data (from geoip logstash plugin) and it look like the are good:  
 ![Capture](https://us1.discourse-cdn.com/elastic/original/3X/3/d/3d4e3f9c42aa07edf3d7e636e2150658d06b8e0b.png)

the Es query look good to me

```auto
    {
      "aggs": {
        "filter_agg": {
          "filter": {
            "geo_bounding_box": {
              "ignore_unmapped": true,
              "geoip.location": {
                "top_left": {
                  "lat": 90,
                  "lon": -180
                },
                "bottom_right": {
                  "lat": -90,
                  "lon": 180
                }
              }
            }
          },
          "aggs": {
            "2": {
              "geohash_grid": {
                "field": "geoip.location",
                "precision": 2
              },
              "aggs": {
                "3": {
                  "geo_centroid": {
                    "field": "geoip.location"
                  }
                }
              }
            }
          }
        }
      },
      "size": 0,
      "_source": {
        "excludes": []
      },
      "stored_fields": [
        "*"
      ],
      "script_fields": {},
      "docvalue_fields": [
        {
          "field": "@timestamp",
          "format": "date_time"
        }
      ],
      "query": {
        "bool": {
          "must": [
            {
              "range": {
                "@timestamp": {
                  "gte": 1551452442418,
                  "lte": 1551453342418,
                  "format": "epoch_millis"
                }
              }
            }
          ],
          "filter": [
            {
              "match_all": {}
            },
            {
              "match_all": {}
            }
          ],
          "should": [],
          "must_not": []
        }
      }
    }

```

but it return not result ( i checked that I had data in the time period)

```auto
{
  "took": 10,
  "timed_out": false,
  "_shards": {
    "total": 10,
    "successful": 10,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 351,
    "max_score": 0,
    "hits": []
  },
  "aggregations": {
    "filter_agg": {
      "2": {
        "buckets": []
      },
      "doc_count": 0
    }
  },
  "status": 200
}

```

I'm I missing something / any idea on what next I can do to troubleshoot this ?

many thanks

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 1, 2019, 4:37pm UTC](https://discuss.elastic.co/t/not-getting-my-geo-point/170525/2 "2019-03-01T16:37:55Z")

</div>

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

This is the icon to use if you are not using markdown format:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7e6e239431ec2d71cbf1beef741f2e93e7cc762c.jpg)

There's a live preview panel for exactly this reasons.

Could you provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

---

<div class="post-metadata">

**Author:** ![BouchardClaude](https://avatars.discourse-cdn.com/v4/letter/b/e495f1/32.png) [@BouchardClaude](https://discuss.elastic.co/u/BouchardClaude)\
**Post date:** [March 4, 2019, 4:15pm UTC](https://discuss.elastic.co/t/not-getting-my-geo-point/170525/3 "2019-03-04T16:15:43Z")

</div>

Hi dadoonet, thx for the info, I updated the initial post with proper formatting.  
As for the script, im not sure what to provide else then the mapping used to create the index and the ES seach query and answer. Any other step would help?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 4, 2019, 4:42pm UTC](https://discuss.elastic.co/t/not-getting-my-geo-point/170525/4 "2019-03-04T16:42:46Z")

</div>

> As for the script, im not sure what to provide else then the mapping used to create the index and the ES seach query and answer. Any other step would help?

What would help is a script that:

- delete the index
- create the index with mapping
- index a document
- run a search

This script can be then just copied and paste in Kibana dev console so we can just run it and see. Exactly what is described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21)

---

<div class="post-metadata">

**Author:** ![BouchardClaude](https://avatars.discourse-cdn.com/v4/letter/b/e495f1/32.png) [@BouchardClaude](https://discuss.elastic.co/u/BouchardClaude)\
**Post date:** [March 5, 2019, 2:36pm UTC](https://discuss.elastic.co/t/not-getting-my-geo-point/170525/5 "2019-03-05T14:36:17Z")

</div>

Here a script with all the steps:

- delete the index

```auto
DELETE syslo

```

- create the index with mapping

```auto
    PUT syslo
    {
        "mappings": {
          "geoip": {
            "properties": {
              "geoip": {
                "properties": {
                  "location": {
                    "type": "geo_point"
                  }
                }
              }
            }
          }
        }
    }

```

- index a document

```auto
    PUT syslo/geoip/1
    {
    "geoip": {
          "city_name": "Québec",
          "country_name": "Canada",
          "longitude": -71.2453,
          "ip": "52.111.11.111",
          "continent_code": "NA",
          "latitude": 46.7933,
          "country_code2": "CA",
          "location": {
            "lat": 46.7933,
            "lon": -71.2453
          }
      }
      
    }

```

- run a search

```auto
    GET syslo/_search
    {
      "aggs": {
        "filter_agg": {
          "filter": {
            "geo_bounding_box": {
              "ignore_unmapped": true,
              "geoip.location": {
                "top_left": {
                  "lat": 90,
                  "lon": -180
                },
                "bottom_right": {
                  "lat": -90,
                  "lon": 180
                }
              }
            }
          },
          "aggs": {
            "2": {
              "geohash_grid": {
                "field": "geoip.location",
                "precision": 2
              },
              "aggs": {
                "3": {
                  "geo_centroid": {
                    "field": "geoip.location"
                  }
                }
              }
            }
          }
        }
      },
      "size": 0,
      "_source": {
        "excludes": []
      },
      "stored_fields": [
        "*"
      ],
      "script_fields": {},
      "docvalue_fields": [
        {
          "field": "@timestamp",
          "format": "date_time"
        }
      ],
      "query": {
        "bool": {
          "must": [
            {
              "range": {
                "@timestamp": {
                  "gte": 1551794528266,
                  "lte": 1551796328266,
                  "format": "epoch_millis"
                }
              }
            }
          ],
          "filter": [
            {
              "match_all": {}
            },
            {
              "match_all": {}
            }
          ],
          "should": [],
          "must_not": []
        }
      }
    }

```

please let me know if something seems wrong in my script

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 5, 2019, 4:59pm UTC](https://discuss.elastic.co/t/not-getting-my-geo-point/170525/6 "2019-03-05T16:59:04Z")

</div>

That is not matching any date:

```auto
      "must": [
        {
          "range": {
            "@timestamp": {
              "gte": 1551794528266,
              "lte": 1551796328266,
              "format": "epoch_millis"
            }
          }
        }
      ],

```

Then running that:

```auto
GET syslo/_search
{
  "aggs": {
    "filter_agg": {
      "filter": {
        "geo_bounding_box": {
          "ignore_unmapped": true,
          "geoip.location": {
            "top_left": {
              "lat": 90,
              "lon": -180
            },
            "bottom_right": {
              "lat": -90,
              "lon": 180
            }
          }
        }
      },
      "aggs": {
        "2": {
          "geohash_grid": {
            "field": "geoip.location",
            "precision": 2
          },
          "aggs": {
            "3": {
              "geo_centroid": {
                "field": "geoip.location"
              }
            }
          }
        }
      }
    }
  }
}

```

Is giving some result:

```auto
{
  "took" : 21,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "syslo",
        "_type" : "geoip",
        "_id" : "1",
        "_score" : 1.0,
        "_source" : {
          "geoip" : {
            "city_name" : "Québec",
            "country_name" : "Canada",
            "longitude" : -71.2453,
            "ip" : "52.111.11.111",
            "continent_code" : "NA",
            "latitude" : 46.7933,
            "country_code2" : "CA",
            "location" : {
              "lat" : 46.7933,
              "lon" : -71.2453
            }
          }
        }
      }
    ]
  },
  "aggregations" : {
    "filter_agg" : {
      "doc_count" : 1,
      "2" : {
        "buckets" : [
          {
            "key" : "f2",
            "doc_count" : 1,
            "3" : {
              "location" : {
                "lat" : 46.79329996928573,
                "lon" : -71.2453000433743
              },
              "count" : 1
            }
          }
        ]
      }
    }
  }
}

```

Not sure if this is what you meant.

---

<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 2, 2019, 5:08pm UTC](https://discuss.elastic.co/t/not-getting-my-geo-point/170525/7 "2019-04-02T17:08:10Z")

</div>

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