Geo_distance_range filter applied to a facet returns values outside the range


(Raul, Jr. Martinez) #1

Hello!

I have a list of documents that contains geoloc field which is a geo_point
type as seen in the mapping below (some fields has been stripped).

{
"schools": {
"properties": {
....
"geoloc": {
"store": "yes",
"type": "geo_point"
},
"country": {
"index": "not_analyzed",
"store": "yes",
"type": "string"
},
"username": {
"index": "not_analyzed",
"type": "string"
}
....
....
}
}
}

The default facet attached to the query is a geo_distance facet using
to/from to define range as seen below (again some range were stripped to
shorten this post).

"facets": {
"geoloc": {
"geo_distance": {
"ranges": [
….
….
{
"from": "7001",
"to": "8000"
},
{
"from": "8001",
"to": "9000"
},
{
"from": "9001",
"to": "10000"
},
{
"from": "10001",
"to": "50000"
}
],
"geoloc": {
"lat": 51.5128,
"lon": -0.0918
},
"unit": "miles"
}
}
}

The above facet query returns the following response.
"facets": {
"geoloc": {
"_type": "geo_distance",
"ranges": [
....
....
{
"from": 6001,
"to": 7000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 7001,
"to": 8000,
"min": 7971.960904721318,
"max": 7971.960904721318,
"total_count": 4,
"total": 31887.843618885272,
"mean": 7971.960904721318
},
{
"from": 8001,
"to": 9000,
"min": 8127.135465210893,
"max": 8876.39022791625,
"total_count": 8,
"total": 67474.56494917188,
"mean": 8434.320618646485
},
{
"from": 9001,
"to": 10000,
"min": 9094.99960175981,
"max": 9998.014376489728,
"total_count": 1533,
"total": 14749196.606093463,
"mean": 9621.132815455618
},
{
"from": 10001,
"to": 50000,
"min": 10107.137498621609,
"max": 11991.886489810546,
"total_count": 1241,
"total": 12977180.049243744,
"mean": 10457.034689156926
}
]
}
}

Effective Range with counts

7,001 - 8,000 miles (4)

8,001 - 9,000 miles (8)

9,001 - 10,000 miles (1,531)

More than 10,000 miles (1,239)

In my application, I selected 7001 to 8000 miles with (4) expected records
within this range. The following filters are applied to the new
Request/Query:

Query Filter:

"filter": {

"and": [
  {
    "geo_distance_range": {
      "from": "7001 mi",
      "to": "8000 mi",
      "geoloc": {
        "lat": 51.5128,
        "lon": -0.0918
      }
    }
  }
]

}

Facet Filter (geoloc):

"facets": {
"geoloc": {
"facet_filter": {
"and": [
{
"geo_distance_range": {
"from": "7001 mi",
"to": "8000 mi",
"geoloc": {
"lat": 51.5128,
"lon": -0.0918
}
}

      }
    ]
  },
  "geo_distance": {
    "ranges": [
      {
        "from": "7001",
        "to": "8000"
      },
      {
        "from": "8001",
        "to": "9000"
      },
      {
        "from": "9001",
        "to": "10000"
      },
      {
        "from": "10001",
        "to": "50000"
      }
    ],
    "geoloc": {
      "lat": 51.5128,
      "lon": -0.0918
    },

    "unit": "miles"
  }
}

The Response contains the following facet values:

"facets": {
"geoloc": {
"_type": "geo_distance",
"ranges": [

...
{
"from": 6001,
"to": 7000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 7001,
"to": 8000,
"min": 7971.960904721318,
"max": 7971.960904721318,
"total_count": 4,
"total": 31887.843618885272,
"mean": 7971.960904721318
},
{
"from": 8001,
"to": 9000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 9001,
"to": 10000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 10001,
"to": 50000,
"min": 10214.110601712535,
"max": 10214.110601712535,
"total_count": 4,
"total": 40856.44240685014,
"mean": 10214.110601712535
}
]
}
}

*Range with values: *

  • 7001 - 8000 (4 records)
  • 10001 - 50000 (4 records)

*Other observations: *

  • Sending 7001 to 8000 range returns four records
  • Sending 10001 to 50000 range returns greater than four records.

ElasticSearch version Used:

  • 0.19.3
  • 0.17.6

Has anyone experience this kind of behavior? It looks like
geo_distance_range is not working correctly for me or I maybe I am missing
something.

Thank you!

Raul


(Shay Banon) #2

By default, the geo distance range filter includes both from and to values.
You get back 7001-8000, and then do 7000-8000 (inclusive), maybe thats the
problem? If not, can you please gist a sample repro indexing some sample
data and showing it? it will be fastest to check.

On Sun, May 6, 2012 at 4:37 AM, Raul, Jr. Martinez juneym@gmail.com wrote:

Hello!

I have a list of documents that contains geoloc field which is a geo_point
type as seen in the mapping below (some fields has been stripped).

{
"schools": {
"properties": {
....
"geoloc": {
"store": "yes",
"type": "geo_point"
},
"country": {
"index": "not_analyzed",
"store": "yes",
"type": "string"
},
"username": {
"index": "not_analyzed",
"type": "string"
}
....
....
}
}
}

The default facet attached to the query is a geo_distance facet using
to/from to define range as seen below (again some range were stripped to
shorten this post).

"facets": {
"geoloc": {
"geo_distance": {
"ranges": [
….
….
{
"from": "7001",
"to": "8000"
},
{
"from": "8001",
"to": "9000"
},
{
"from": "9001",
"to": "10000"
},
{
"from": "10001",
"to": "50000"
}
],
"geoloc": {
"lat": 51.5128,
"lon": -0.0918
},
"unit": "miles"
}
}
}

The above facet query returns the following response.
"facets": {
"geoloc": {
"_type": "geo_distance",
"ranges": [
....
....
{
"from": 6001,
"to": 7000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 7001,
"to": 8000,
"min": 7971.960904721318,
"max": 7971.960904721318,
"total_count": 4,
"total": 31887.843618885272,
"mean": 7971.960904721318
},
{
"from": 8001,
"to": 9000,
"min": 8127.135465210893,
"max": 8876.39022791625,
"total_count": 8,
"total": 67474.56494917188,
"mean": 8434.320618646485
},
{
"from": 9001,
"to": 10000,
"min": 9094.99960175981,
"max": 9998.014376489728,
"total_count": 1533,
"total": 14749196.606093463,
"mean": 9621.132815455618
},
{
"from": 10001,
"to": 50000,
"min": 10107.137498621609,
"max": 11991.886489810546,
"total_count": 1241,
"total": 12977180.049243744,
"mean": 10457.034689156926
}
]
}
}

Effective Range with counts

7,001 - 8,000 miles (4)

8,001 - 9,000 miles (8)

9,001 - 10,000 miles (1,531)

More than 10,000 miles (1,239)

In my application, I selected 7001 to 8000 miles with (4) expected records
within this range. The following filters are applied to the new
Request/Query:

Query Filter:

"filter": {

"and": [
  {
    "geo_distance_range": {
      "from": "7001 mi",
      "to": "8000 mi",
      "geoloc": {
        "lat": 51.5128,
        "lon": -0.0918
      }
    }
  }
]

}

Facet Filter (geoloc):

"facets": {
"geoloc": {
"facet_filter": {
"and": [
{
"geo_distance_range": {
"from": "7001 mi",
"to": "8000 mi",
"geoloc": {
"lat": 51.5128,
"lon": -0.0918
}
}

      }
    ]
  },
  "geo_distance": {
    "ranges": [
      {
        "from": "7001",
        "to": "8000"
      },
      {
        "from": "8001",
        "to": "9000"
      },
      {
        "from": "9001",
        "to": "10000"
      },
      {
        "from": "10001",
        "to": "50000"
      }
    ],
    "geoloc": {
      "lat": 51.5128,
      "lon": -0.0918
    },

    "unit": "miles"
  }
}

The Response contains the following facet values:

"facets": {
"geoloc": {
"_type": "geo_distance",
"ranges": [

...
{
"from": 6001,
"to": 7000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 7001,
"to": 8000,
"min": 7971.960904721318,
"max": 7971.960904721318,
"total_count": 4,
"total": 31887.843618885272,
"mean": 7971.960904721318
},
{
"from": 8001,
"to": 9000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 9001,
"to": 10000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 10001,
"to": 50000,
"min": 10214.110601712535,
"max": 10214.110601712535,
"total_count": 4,
"total": 40856.44240685014,
"mean": 10214.110601712535
}
]
}
}

*Range with values: *

  • 7001 - 8000 (4 records)
  • 10001 - 50000 (4 records)

*Other observations: *

  • Sending 7001 to 8000 range returns four records
  • Sending 10001 to 50000 range returns greater than four records.

ElasticSearch version Used:

  • 0.19.3
  • 0.17.6

Has anyone experience this kind of behavior? It looks like
geo_distance_range is not working correctly for me or I maybe I am missing
something.

Thank you!

Raul


(Shay Banon) #3

One more thing, the geo distance facet is inclusive of the lower end, and
exclusive of the upper end, so you should have ranges like this: 7000-8000,
8000-9000, and then, the geo_distance_filter range should be from: 7000,
to: 8000, include_upper: false.

On Wed, May 9, 2012 at 11:43 AM, Shay Banon kimchy@gmail.com wrote:

By default, the geo distance range filter includes both from and to
values. You get back 7001-8000, and then do 7000-8000 (inclusive), maybe
thats the problem? If not, can you please gist a sample repro indexing some
sample data and showing it? it will be fastest to check.

On Sun, May 6, 2012 at 4:37 AM, Raul, Jr. Martinez juneym@gmail.comwrote:

Hello!

I have a list of documents that contains geoloc field which is a
geo_point type as seen in the mapping below (some fields has been stripped).

{
"schools": {
"properties": {
....
"geoloc": {
"store": "yes",
"type": "geo_point"
},
"country": {
"index": "not_analyzed",
"store": "yes",
"type": "string"
},
"username": {
"index": "not_analyzed",
"type": "string"
}
....
....
}
}
}

The default facet attached to the query is a geo_distance facet using
to/from to define range as seen below (again some range were stripped to
shorten this post).

"facets": {
"geoloc": {
"geo_distance": {
"ranges": [
….
….
{
"from": "7001",
"to": "8000"
},
{
"from": "8001",
"to": "9000"
},
{
"from": "9001",
"to": "10000"
},
{
"from": "10001",
"to": "50000"
}
],
"geoloc": {
"lat": 51.5128,
"lon": -0.0918
},
"unit": "miles"
}
}
}

The above facet query returns the following response.
"facets": {
"geoloc": {
"_type": "geo_distance",
"ranges": [
....
....
{
"from": 6001,
"to": 7000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 7001,
"to": 8000,
"min": 7971.960904721318,
"max": 7971.960904721318,
"total_count": 4,
"total": 31887.843618885272,
"mean": 7971.960904721318
},
{
"from": 8001,
"to": 9000,
"min": 8127.135465210893,
"max": 8876.39022791625,
"total_count": 8,
"total": 67474.56494917188,
"mean": 8434.320618646485
},
{
"from": 9001,
"to": 10000,
"min": 9094.99960175981,
"max": 9998.014376489728,
"total_count": 1533,
"total": 14749196.606093463,
"mean": 9621.132815455618
},
{
"from": 10001,
"to": 50000,
"min": 10107.137498621609,
"max": 11991.886489810546,
"total_count": 1241,
"total": 12977180.049243744,
"mean": 10457.034689156926
}
]
}
}

Effective Range with counts

7,001 - 8,000 miles (4)

8,001 - 9,000 miles (8)

9,001 - 10,000 miles (1,531)

More than 10,000 miles (1,239)

In my application, I selected 7001 to 8000 miles with (4) expected
records within this range. The following filters are applied to the new
Request/Query:

Query Filter:

"filter": {

"and": [
  {
    "geo_distance_range": {
      "from": "7001 mi",
      "to": "8000 mi",
      "geoloc": {
        "lat": 51.5128,
        "lon": -0.0918
      }
    }
  }
]

}

Facet Filter (geoloc):

"facets": {
"geoloc": {
"facet_filter": {
"and": [
{
"geo_distance_range": {
"from": "7001 mi",
"to": "8000 mi",
"geoloc": {
"lat": 51.5128,
"lon": -0.0918
}
}

      }
    ]
  },
  "geo_distance": {
    "ranges": [
      {
        "from": "7001",
        "to": "8000"
      },
      {
        "from": "8001",
        "to": "9000"
      },
      {
        "from": "9001",
        "to": "10000"
      },
      {
        "from": "10001",
        "to": "50000"
      }
    ],
    "geoloc": {
      "lat": 51.5128,
      "lon": -0.0918
    },

    "unit": "miles"
  }
}

The Response contains the following facet values:

"facets": {
"geoloc": {
"_type": "geo_distance",
"ranges": [

...
{
"from": 6001,
"to": 7000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 7001,
"to": 8000,
"min": 7971.960904721318,
"max": 7971.960904721318,
"total_count": 4,
"total": 31887.843618885272,
"mean": 7971.960904721318
},
{
"from": 8001,
"to": 9000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 9001,
"to": 10000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 10001,
"to": 50000,
"min": 10214.110601712535,
"max": 10214.110601712535,
"total_count": 4,
"total": 40856.44240685014,
"mean": 10214.110601712535
}
]
}
}

*Range with values: *

  • 7001 - 8000 (4 records)
  • 10001 - 50000 (4 records)

*Other observations: *

  • Sending 7001 to 8000 range returns four records
  • Sending 10001 to 50000 range returns greater than four records.

ElasticSearch version Used:

  • 0.19.3
  • 0.17.6

Has anyone experience this kind of behavior? It looks like
geo_distance_range is not working correctly for me or I maybe I am missing
something.

Thank you!

Raul


(Raul, Jr. Martinez) #4

Hello Shay,

Apologies for the delayed response. I finally figured out the problem.

 - my data has a dirty geo point values. I reviewed my pipeline to 

ensure that values that gets into "geoloc" field is an array of values
[long/lat]
- I was trying to use "distance_units" option for geo_distance_range
filter. This is causing an inconsistent results. Some selected range
returns empty results while other range values returns some values. I fixed
the problem by concatening "mi" (miles) unit when setting the "to" and
"from" fields.

Everything is working in 0.17.6 but I'm going to be upgrading to the latest
release as soon as possible.

Thanks!
Raul

On Wednesday, May 9, 2012 4:52:05 PM UTC+8, kimchy wrote:

One more thing, the geo distance facet is inclusive of the lower end, and
exclusive of the upper end, so you should have ranges like this: 7000-8000,
8000-9000, and then, the geo_distance_filter range should be from: 7000,
to: 8000, include_upper: false.

On Wed, May 9, 2012 at 11:43 AM, Shay Banon wrote:

By default, the geo distance range filter includes both from and to
values. You get back 7001-8000, and then do 7000-8000 (inclusive), maybe
thats the problem? If not, can you please gist a sample repro indexing some
sample data and showing it? it will be fastest to check.

On Sun, May 6, 2012 at 4:37 AM, Raul, Jr. Martinez wrote:

Hello!

I have a list of documents that contains geoloc field which is a
geo_point type as seen in the mapping below (some fields has been stripped).

{
"schools": {
"properties": {
....
"geoloc": {
"store": "yes",
"type": "geo_point"
},
"country": {
"index": "not_analyzed",
"store": "yes",
"type": "string"
},
"username": {
"index": "not_analyzed",
"type": "string"
}
....
....
}
}
}

The default facet attached to the query is a geo_distance facet using
to/from to define range as seen below (again some range were stripped to
shorten this post).

"facets": {
"geoloc": {
"geo_distance": {
"ranges": [
….
….
{
"from": "7001",
"to": "8000"
},
{
"from": "8001",
"to": "9000"
},
{
"from": "9001",
"to": "10000"
},
{
"from": "10001",
"to": "50000"
}
],
"geoloc": {
"lat": 51.5128,
"lon": -0.0918
},
"unit": "miles"
}
}
}

The above facet query returns the following response.
"facets": {
"geoloc": {
"_type": "geo_distance",
"ranges": [
....
....
{
"from": 6001,
"to": 7000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 7001,
"to": 8000,
"min": 7971.960904721318,
"max": 7971.960904721318,
"total_count": 4,
"total": 31887.843618885272,
"mean": 7971.960904721318
},
{
"from": 8001,
"to": 9000,
"min": 8127.135465210893,
"max": 8876.39022791625,
"total_count": 8,
"total": 67474.56494917188,
"mean": 8434.320618646485
},
{
"from": 9001,
"to": 10000,
"min": 9094.99960175981,
"max": 9998.014376489728,
"total_count": 1533,
"total": 14749196.606093463,
"mean": 9621.132815455618
},
{
"from": 10001,
"to": 50000,
"min": 10107.137498621609,
"max": 11991.886489810546,
"total_count": 1241,
"total": 12977180.049243744,
"mean": 10457.034689156926
}
]
}
}

Effective Range with counts

7,001 - 8,000 miles (4)

8,001 - 9,000 miles (8)

9,001 - 10,000 miles (1,531)

More than 10,000 miles (1,239)

In my application, I selected 7001 to 8000 miles with (4) expected
records within this range. The following filters are applied to the new
Request/Query:

Query Filter:

"filter": {

"and": [
  {
    "geo_distance_range": {
      "from": "7001 mi",
      "to": "8000 mi",
      "geoloc": {
        "lat": 51.5128,
        "lon": -0.0918
      }
    }
  }
]

}

Facet Filter (geoloc):

"facets": {
"geoloc": {
"facet_filter": {
"and": [
{
"geo_distance_range": {
"from": "7001 mi",
"to": "8000 mi",
"geoloc": {
"lat": 51.5128,
"lon": -0.0918
}
}

      }
    ]
  },
  "geo_distance": {
    "ranges": [
      {
        "from": "7001",
        "to": "8000"
      },
      {
        "from": "8001",
        "to": "9000"
      },
      {
        "from": "9001",
        "to": "10000"
      },
      {
        "from": "10001",
        "to": "50000"
      }
    ],
    "geoloc": {
      "lat": 51.5128,
      "lon": -0.0918
    },

    "unit": "miles"
  }
}

The Response contains the following facet values:

"facets": {
"geoloc": {
"_type": "geo_distance",
"ranges": [

...
{
"from": 6001,
"to": 7000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 7001,
"to": 8000,
"min": 7971.960904721318,
"max": 7971.960904721318,
"total_count": 4,
"total": 31887.843618885272,
"mean": 7971.960904721318
},
{
"from": 8001,
"to": 9000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 9001,
"to": 10000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 10001,
"to": 50000,
"min": 10214.110601712535,
"max": 10214.110601712535,
"total_count": 4,
"total": 40856.44240685014,
"mean": 10214.110601712535
}
]
}
}

*Range with values: *

  • 7001 - 8000 (4 records)
  • 10001 - 50000 (4 records)

*Other observations: *

  • Sending 7001 to 8000 range returns four records
  • Sending 10001 to 50000 range returns greater than four records.

ElasticSearch version Used:

  • 0.19.3
  • 0.17.6

Has anyone experience this kind of behavior? It looks like
geo_distance_range is not working correctly for me or I maybe I am missing
something.

Thank you!

Raul

On Wednesday, May 9, 2012 4:52:05 PM UTC+8, kimchy wrote:

One more thing, the geo distance facet is inclusive of the lower end, and
exclusive of the upper end, so you should have ranges like this: 7000-8000,
8000-9000, and then, the geo_distance_filter range should be from: 7000,
to: 8000, include_upper: false.

On Wed, May 9, 2012 at 11:43 AM, Shay Banon wrote:

By default, the geo distance range filter includes both from and to
values. You get back 7001-8000, and then do 7000-8000 (inclusive), maybe
thats the problem? If not, can you please gist a sample repro indexing some
sample data and showing it? it will be fastest to check.

On Sun, May 6, 2012 at 4:37 AM, Raul, Jr. Martinez wrote:

Hello!

I have a list of documents that contains geoloc field which is a
geo_point type as seen in the mapping below (some fields has been stripped).

{
"schools": {
"properties": {
....
"geoloc": {
"store": "yes",
"type": "geo_point"
},
"country": {
"index": "not_analyzed",
"store": "yes",
"type": "string"
},
"username": {
"index": "not_analyzed",
"type": "string"
}
....
....
}
}
}

The default facet attached to the query is a geo_distance facet using
to/from to define range as seen below (again some range were stripped to
shorten this post).

"facets": {
"geoloc": {
"geo_distance": {
"ranges": [
….
….
{
"from": "7001",
"to": "8000"
},
{
"from": "8001",
"to": "9000"
},
{
"from": "9001",
"to": "10000"
},
{
"from": "10001",
"to": "50000"
}
],
"geoloc": {
"lat": 51.5128,
"lon": -0.0918
},
"unit": "miles"
}
}
}

The above facet query returns the following response.
"facets": {
"geoloc": {
"_type": "geo_distance",
"ranges": [
....
....
{
"from": 6001,
"to": 7000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 7001,
"to": 8000,
"min": 7971.960904721318,
"max": 7971.960904721318,
"total_count": 4,
"total": 31887.843618885272,
"mean": 7971.960904721318
},
{
"from": 8001,
"to": 9000,
"min": 8127.135465210893,
"max": 8876.39022791625,
"total_count": 8,
"total": 67474.56494917188,
"mean": 8434.320618646485
},
{
"from": 9001,
"to": 10000,
"min": 9094.99960175981,
"max": 9998.014376489728,
"total_count": 1533,
"total": 14749196.606093463,
"mean": 9621.132815455618
},
{
"from": 10001,
"to": 50000,
"min": 10107.137498621609,
"max": 11991.886489810546,
"total_count": 1241,
"total": 12977180.049243744,
"mean": 10457.034689156926
}
]
}
}

Effective Range with counts

7,001 - 8,000 miles (4)

8,001 - 9,000 miles (8)

9,001 - 10,000 miles (1,531)

More than 10,000 miles (1,239)

In my application, I selected 7001 to 8000 miles with (4) expected
records within this range. The following filters are applied to the new
Request/Query:

Query Filter:

"filter": {

"and": [
  {
    "geo_distance_range": {
      "from": "7001 mi",
      "to": "8000 mi",
      "geoloc": {
        "lat": 51.5128,
        "lon": -0.0918
      }
    }
  }
]

}

Facet Filter (geoloc):

"facets": {
"geoloc": {
"facet_filter": {
"and": [
{
"geo_distance_range": {
"from": "7001 mi",
"to": "8000 mi",
"geoloc": {
"lat": 51.5128,
"lon": -0.0918
}
}

      }
    ]
  },
  "geo_distance": {
    "ranges": [
      {
        "from": "7001",
        "to": "8000"
      },
      {
        "from": "8001",
        "to": "9000"
      },
      {
        "from": "9001",
        "to": "10000"
      },
      {
        "from": "10001",
        "to": "50000"
      }
    ],
    "geoloc": {
      "lat": 51.5128,
      "lon": -0.0918
    },

    "unit": "miles"
  }
}

The Response contains the following facet values:

"facets": {
"geoloc": {
"_type": "geo_distance",
"ranges": [

...
{
"from": 6001,
"to": 7000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 7001,
"to": 8000,
"min": 7971.960904721318,
"max": 7971.960904721318,
"total_count": 4,
"total": 31887.843618885272,
"mean": 7971.960904721318
},
{
"from": 8001,
"to": 9000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 9001,
"to": 10000,
"min": "Infinity",
"max": "-Infinity",
"total_count": 0,
"total": 0,
"mean": "NaN"
},
{
"from": 10001,
"to": 50000,
"min": 10214.110601712535,
"max": 10214.110601712535,
"total_count": 4,
"total": 40856.44240685014,
"mean": 10214.110601712535
}
]
}
}

*Range with values: *

  • 7001 - 8000 (4 records)
  • 10001 - 50000 (4 records)

*Other observations: *

  • Sending 7001 to 8000 range returns four records
  • Sending 10001 to 50000 range returns greater than four records.

ElasticSearch version Used:

  • 0.19.3
  • 0.17.6

Has anyone experience this kind of behavior? It looks like
geo_distance_range is not working correctly for me or I maybe I am missing
something.

Thank you!

Raul


(system) #5