Elastic search geo_distance query results not accurate


(Shantanu Deshmukh) #1

I am running a geo_distance query on an index containing about 20k documents. Mapping for this index has a geo_point type field. Results are coming out inaccurate. When I put distance as 1Km I am getting documents which are 4km away. What is wrong here? Please help.
Query:
GET branch-master-v2/_search?size=500
{
"query": {
"bool": {
"must": {
"match_all" : {}
},

            "filter": {
                "geo_distance": {
                    "distance": "1km",
                    "distance_type": "arc", 
                    "LOCATION": {
                        "lat": 72.8365072,
                        "lon": 19.0577397
                    },
                    "unit": "km"
                }
            }
        }
    },
    "script_fields":{
        "distance" : {
                "script":"doc['LOCATION'].arcDistance(72.7967221,19.1020398)"
        }
    }
}

Output

"hits": [
      {
        "_index": "branch-master-v2",
        "_type": "master",
        "_id": "4447",
        "_score": 1,
        "fields": {
          "distance": [
            4602.10747146603
          ]
        }
      },
      {
        "_index": "branch-master-v2",
        "_type": "master",
        "_id": "544",
        "_score": 1,
        "fields": {
          "distance": [
            4645.636614519423
          ]
        }
      },
      {
        "_index": "branch-master-v2",
        "_type": "master",
        "_id": "5081",
        "_score": 1,
        "fields": {
          "distance": [
            4623.3935976666435
          ]
        }
      },
      {
        "_index": "branch-master-v2",
        "_type": "master",
        "_id": "15172",
        "_score": 1,
        "fields": {
          "distance": [
            5170.873376615598
          ]
        }
      },
      {
        "_index": "branch-master-v2",
        "_type": "master",
        "_id": "1179",
        "_score": 1,
        "fields": {
          "distance": [
            4518.371061139671
          ]
        }
      },
      {
        "_index": "branch-master-v2",
        "_type": "master",
        "_id": "3758",
        "_score": 1,
        "fields": {
          "distance": [
            5485.6415697650555
          ]
        }
      }
    ]

P.s: ElasticSearch version is 5.1.2


(system) #2

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