# Re: GeoDistanceQuery?

**URL:** https://discuss.elastic.co/t/re-geodistancequery/4374
**Category:** Elasticsearch
**Created:** [May 9, 2011, 7:59pm UTC](https://discuss.elastic.co/t/re-geodistancequery/4374 "2011-05-09T19:59:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [May 9, 2011, 7:59pm UTC](https://discuss.elastic.co/t/re-geodistancequery/4374/1 "2011-05-09T19:59:48Z")

</div>

Hi Ben

> I am an ES beginner possibly migrating from Solr and I am trying to  
> apply a geo distance query term to my ES query, but I cant seem to  
> figure out how to do that. In my particular case I want the geo  
> radial bounding box to apply to all my facets and it appears that  
> adding the geoDistanceFilter() via setFilter() does not apply to  
> facets (which I think is normal). I was looking for something like  
> QueryBuilders.geoDistanceQuery() in the javaApi, but that doesnât seem  
> to exist.

I suggest you gist an example of the query that you're using, so we can  
figure out where you're going wrong. See

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

My guess is that you're using a "top-level" filter  
([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/filter.html) )  
instead of a filtered query  
([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/filtered-query.html) )

clint

---

<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: [May 9, 2011, 8:10pm UTC](https://discuss.elastic.co/t/re-geodistancequery/4374/2 "2011-05-09T20:10:35Z")

</div>

If you want to apply filters just for specific facets, then you can set a filter on the relevant facets. In Java, each facet has a facetFitler method that accepts a filter (can be a geo bounding box filter).  
On Monday, May 9, 2011 at 10:59 PM, Clinton Gormley wrote:

> Hi Ben
> 
> > I am an ES beginner possibly migrating from Solr and I am trying to  
> > apply a geo distance query term to my ES query, but I cant seem to  
> > figure out how to do that. In my particular case I want the geo  
> > radial bounding box to apply to all my facets and it appears that  
> > adding the geoDistanceFilter() via setFilter() does not apply to  
> > facets (which I think is normal). I was looking for something like  
> > QueryBuilders.geoDistanceQuery() in the javaApi, but that doesnât seem  
> > to exist.
> 
> I suggest you gist an example of the query that you're using, so we can  
> figure out where you're going wrong. See  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help)
> 
> My guess is that you're using a "top-level" filter  
> ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/filter.html) )  
> instead of a filtered query  
> ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/filtered-query.html) )
> 
> clint

---

<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, 4:06am UTC](https://discuss.elastic.co/t/re-geodistancequery/4374/3 "2017-07-06T04:06:36Z")

</div>


