# Geodistance filter, optimize\_bbox, indexed

**URL:** https://discuss.elastic.co/t/geodistance-filter-optimize-bbox-indexed/8205
**Category:** Elasticsearch
**Created:** [June 24, 2012, 12:13am UTC](https://discuss.elastic.co/t/geodistance-filter-optimize-bbox-indexed/8205 "2012-06-24T00:13:00Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Pierre\_Durand](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierre_durand/32/1895_2.png) [@Pierre\_Durand](https://discuss.elastic.co/u/Pierre_Durand)
#### Post date: [June 24, 2012, 12:13am UTC](https://discuss.elastic.co/t/geodistance-filter-optimize-bbox-indexed/8205/1 "2012-06-24T00:13:00Z")

</div>

Hi,

What is the use of the "indexed" value for the "optimize\_bbox" in the  
"geodistance" filter?  
It is slower than the "memory" value!

Do you have an explanation?

Thank you

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [June 25, 2012, 12:18pm UTC](https://discuss.elastic.co/t/geodistance-filter-optimize-bbox-indexed/8205/2 "2012-06-25T12:18:59Z")

</div>

When doing geo distance calculation, the actual distance forumla is  
expensive. In order to speed it up, a bounding box is built around the  
distance, and a check is made first to see if we really need to compute the  
distance.

The check by default is done using in memory checks, which is 95% of the  
time the way you would want to do it. The indexed option simply uses the  
indexed lat and lon to build numeric range filters against them, using the  
index to do the bounding box calcs.

On Sun, Jun 24, 2012 at 2:13 AM, Pierre Durand [pierredurand@gmail.com](mailto:pierredurand@gmail.com)wrote:

> Hi,
> 
> What is the use of the "indexed" value for the "optimize\_bbox" in the  
> "geodistance" filter?  
> It is slower than the "memory" value!
> 
> Do you have an explanation?
> 
> Thank you

---

<div class="post-metadata">

### Author: ![Pierre\_Durand](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierre_durand/32/1895_2.png) [@Pierre\_Durand](https://discuss.elastic.co/u/Pierre_Durand)
#### Post date: [June 25, 2012, 12:49pm UTC](https://discuss.elastic.co/t/geodistance-filter-optimize-bbox-indexed/8205/3 "2012-06-25T12:49:05Z")

</div>

Ok, thank you 🙂

On Monday, June 25, 2012 2:18:59 PM UTC+2, kimchy wrote:

> When doing geo distance calculation, the actual distance forumla is  
> expensive. In order to speed it up, a bounding box is built around the  
> distance, and a check is made first to see if we really need to compute the  
> distance.
> 
> The check by default is done using in memory checks, which is 95% of the  
> time the way you would want to do it. The indexed option simply uses the  
> indexed lat and lon to build numeric range filters against them, using the  
> index to do the bounding box calcs.
> 
> On Sun, Jun 24, 2012 at 2:13 AM, Pierre Durand [pierredurand@gmail.com](mailto:pierredurand@gmail.com)wrote:
> 
> > Hi,
> > 
> > What is the use of the "indexed" value for the "optimize\_bbox" in the  
> > "geodistance" filter?  
> > It is slower than the "memory" value!
> > 
> > Do you have an explanation?
> > 
> > Thank you

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 3:22am UTC](https://discuss.elastic.co/t/geodistance-filter-optimize-bbox-indexed/8205/4 "2017-07-06T03:22:41Z")

</div>


