Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Problems with using geocentroid for multi-valued geo_points #50799

Closed
EmilBode opened this issue Nov 15, 2019 · 2 comments · Fixed by #54389
Closed

[Docs] Problems with using geocentroid for multi-valued geo_points #50799

EmilBode opened this issue Nov 15, 2019 · 2 comments · Fixed by #54389
Assignees
Labels
[Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation Team:Docs

Comments

@EmilBode
Copy link

EmilBode commented Nov 15, 2019

Some elastic behaviour bit me, I think a warning in the documentation would be fair:

When making a geohash, elastic aggregates different documents into buckets, not the individual geo_points
This means that a bucket can contain a document with points both inside and outside this bucket. Now when calculating the gecentroid, all points are considered, also those outside of the bucket boundary.

Consider this example:

PUT temp
{
  "mappings": {
    "properties": {
      "places": {
        "type": "geo_point"
      }
    }
  }
}

PUT temp/_doc/1
{
  "places": [
    [0,0],
    [90,0]
    ]
}

GET temp/_search
{
  "aggs": {
    "2": {
      "geohash_grid": {
        "field": "places",
        "precision": 2
      },
      "aggs": {
        "3": {
          "geo_centroid": {
            "field": "places"
          }
        }
      }
    }
  }
}

The result gives us 2 buckets, both with the same geo_centroid at longitude 45.

The same happens when making a coordinate map in Kibana, although luckily Kibana is smart enough to not allow the point to be drawn outside of the box. However, it's clearly visible that our (0,0) point is drawn eastwards and our (0, 90) points dragged westwards.

The very best solution would obviously be to have the geo_centroid only consider those point that are actually inside the bucket, but I don't think that's feasible.

But for now, I think the documentation about this could be clearer.
My suggestion: ong https://www.elastic.co/guide/en/kibana/7.4/tilemap.html (and those for other versions) has under the "buckets" header the following text, and I propose to add the text with italics:

The place markers off grid (use geocentroid) box is checked by default. When this box is checked, the markers are placed in the center of all the documents in that bucket. When unchecked, the markers are placed in the center of the geohash grid cell. Leaving this checked generally results in a more accurate visualization. However, it may lead to decreased accuracy when you have multiple values in your specified geo_point, as this makes it impossible to calculate the right geo_centroid.

Kibana version:: 7.3.1

Elasticsearch version:: 7.3.1

Server OS version: Windows 10

Browser version: Chrome (latest)

Browser OS version: Windows 10

Original install method (e.g. download page, yum, from source, etc.): Downloaded

And I think this issue could both be improved in Kibana-docs and the documentation in Elasticsearch, so I'm filing an issue there as well (elastic/elasticsearch#49189).

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-gis (Team:Geo)

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-docs (Team:Docs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation Team:Docs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants