Question

In GeoDistance Elastic Search Query, I created a mapping with "geo_point" to map to one index. When I query with latitude as x , longitude as y, and radius as z, I get some rows (for eg. a,b,c). When I query again to the same index with same latitude as x, longitude as y and radius as (z+100), I get different rows(for eg.d,e,f)

How is this possible, if some rows appear in z, then same must appear in z+100 along with additional rows if available ?

My mapping is :

'{
  "type_name": {
    "properties": {
      "pin": {
        "properties": {
          "location": {
            "type": "geo_point"
          }
        }
      }
    }
  }
}’

My query using java API is

GeoDistanceFilterBuilder fil = FilterBuilders
    .geoDistanceFilter("pin.location")
    .point(lat, lng)
    .distance(radius, DistanceUnit.KILOMETERS)
    .optimizeBbox("memory")
    .geoDistance(GeoDistance.ARC).cache(true);

I m getting when same is queried using terminal "curl" cmd.

Can someone plz help me , what is wrong I m doing here ?

Thanks in advance.

Was it helpful?

Solution

Are you only getting 3 results back for each query? Or more than 10?

If more than 10, then your results a, b and c are probably still in the resultset, just further down. Elasticsearch only returns the first 10 results by default. You could try sorting by geo-distance or adjusting the from/size parameters.

Failing that, use the explain API on result a to figure out why it isn't being returned.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top