Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

GeoPoint return [0,0] when input is string #1064

Open
penghuo opened this issue Mar 2, 2021 · 1 comment
Open

GeoPoint return [0,0] when input is string #1064

penghuo opened this issue Mar 2, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@penghuo
Copy link
Contributor

penghuo commented Mar 2, 2021

Description of the issue

When select the doc2, the result is 0.

PUT my-index-000001
{
  "mappings": {
    "properties": {
      "location": {
        "type": "geo_point"
      }
    }
  }
}

PUT my-index-000001/_doc/1
{
  "text": "Geo-point as an object",
  "location": { 
    "lat": 41.12,
    "lon": -71.34
  }
}

PUT my-index-000001/_doc/2
{
  "text": "Geo-point as an object",
  "location": { 
    "lat": "42.12",
    "lon": "-72.34"
  }
}

POST _opendistro/_sql
{
  "query": """
    SELECT location FROM my-index-000001
  """
}

{
  "schema": [
    {
      "name": "location",
      "type": "object"
    }
  ],
  "datarows": [
    [
      {
        "lon": -71.34,
        "lat": 41.12
      }
    ],
    [
      {
        "lon": 0.0,
        "lat": 0.0
      }
    ]
  ],
  "total": 2,
  "size": 2,
  "status": 200
}

Expectation

Return the non zero expected value

@penghuo penghuo added the enhancement New feature or request label Mar 2, 2021
@penghuo
Copy link
Contributor Author

penghuo commented Mar 2, 2021

Root Cause

Elasticsearch support ingest geo-point in five ways. Currently, the query engine use Source filtering to retrieve the field value, the parser can only parse the numeric value.

Solution 1

Considering other methods to retrieve the field value, e.g. Fields

Solution 2

Enhance the ElasticsearchJsonContent to support more format.

@penghuo penghuo changed the title [BUG] GeoPoint return [0,0] when input is string GeoPoint return [0,0] when input is string Mar 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant