# Solr SpatialSearch equivalent for elastic search

**URL:** <https://discuss.elastic.co/t/solr-spatialsearch-equivalent-for-elastic-search/13917>\
**Category:** Elasticsearch\
**Created:** [October 11, 2013, 8:57am UTC](https://discuss.elastic.co/t/solr-spatialsearch-equivalent-for-elastic-search/13917 "2013-10-11T08:57:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karan\_Verma](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@Karan\_Verma](https://discuss.elastic.co/u/Karan_Verma)\
**Post date:** [October 11, 2013, 8:57am UTC](https://discuss.elastic.co/t/solr-spatialsearch-equivalent-for-elastic-search/13917/1 "2013-10-11T08:57:14Z")

</div>

Hi

Is there an equivalent for SpatialSearch  
([http://wiki.apache.org/solr/SpatialSearch](http://wiki.apache.org/solr/SpatialSearch)) on Elastic Search.

I'm already using:  
filter :geo\_distance, location:  
[params[:latitude],params[:longitude]].join(","), distance:  
"#{distance\_from\_user}km"  
&  
filter :geo\_bounding\_box, location: {top\_left:  
[params[:sw\_latitude],params[:sw\_longitude]].join(","), bottom\_right:  
[params[:ne\_latitude],params[:ne\_longitude]].join(",")}

But I'm unable to find an equivalent for this solr query. More specifically  
:pt and :sfield fields.

if latitude.present? && longitude.present?  
p[:pt] = "#{latitude},#{longitude}"  
p[:sfield] = :expert\_location

Karan

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![chilling](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@chilling](https://discuss.elastic.co/u/chilling)\
**Post date:** [October 11, 2013, 10:31am UTC](https://discuss.elastic.co/t/solr-spatialsearch-equivalent-for-elastic-search/13917/2 "2013-10-11T10:31:27Z")

</div>

Hi Karan,

I'm not very familiar with solr. So I'm not sure, what your requested  
filter should handle. But it seems like you want to handle geohashes  
(:sfield). These can be enabled in the mapping of the geo\_point. By turning  
on the geohash option you'll be able to get the geohash of a field  
[location] by adressing location.geohash.

I hope this helps. Otherwise, please ask.

--Florian

On Friday, October 11, 2013 10:57:14 AM UTC+2, Karan Verma wrote:

> Hi
> 
> Is there an equivalent for SpatialSearch (  
> [SpatialSearch - Solr - Apache Software Foundation](http://wiki.apache.org/solr/SpatialSearch)) on Elastic Search.
> 
> I'm already using:  
> filter :geo\_distance, location:  
> [params[:latitude],params[:longitude]].join(","), distance:  
> "#{distance\_from\_user}km"  
> &  
> filter :geo\_bounding\_box, location: {top\_left:  
> [params[:sw\_latitude],params[:sw\_longitude]].join(","), bottom\_right:  
> [params[:ne\_latitude],params[:ne\_longitude]].join(",")}
> 
> But I'm unable to find an equivalent for this solr query. More  
> specifically :pt and :sfield fields.
> 
> if latitude.present? && longitude.present?  
> p[:pt] = "#{latitude},#{longitude}"  
> p[:sfield] = :expert\_location
> 
> Karan

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Karan\_Verma](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@Karan\_Verma](https://discuss.elastic.co/u/Karan_Verma)\
**Post date:** [October 15, 2013, 1:15am UTC](https://discuss.elastic.co/t/solr-spatialsearch-equivalent-for-elastic-search/13917/3 "2013-10-15T01:15:57Z")

</div>

Thanks Florian, it worked out.

On Fri, Oct 11, 2013 at 3:31 AM, Florian Schilling \<  
[florian.schilling@elasticsearch.com](mailto:florian.schilling@elasticsearch.com)\> wrote:

> Hi Karan,
> 
> I'm not very familiar with solr. So I'm not sure, what your requested  
> filter should handle. But it seems like you want to handle geohashes  
> (:sfield). These can be enabled in the mapping of the geo\_point. By turning  
> on the geohash option you'll be able to get the geohash of a field  
> [location] by adressing location.geohash.
> 
> I hope this helps. Otherwise, please ask.
> 
> --Florian
> 
> On Friday, October 11, 2013 10:57:14 AM UTC+2, Karan Verma wrote:
> 
> > Hi
> > 
> > Is there an equivalent for SpatialSearch ([Apache Solr Wiki - Solr - Apache Software Foundation](http://wiki.apache.org/solr/)\*\*  
> > SpatialSearch [http://wiki.apache.org/solr/SpatialSearch](http://wiki.apache.org/solr/SpatialSearch)) on Elastic  
> > Search.
> > 
> > I'm already using:  
> > filter :geo\_distance, location: [params[:latitude],params[:\*\*longitude]].join(","),  
> > distance: "#{distance\_from\_user}km"  
> > &  
> > filter :geo\_bounding\_box, location: {top\_left:  
> > [params[:sw\_latitude],params[:\*\*sw\_longitude]].join(","), bottom\_right:  
> > [params[:ne\_latitude],params[:\*\*ne\_longitude]].join(",")}
> > 
> > But I'm unable to find an equivalent for this solr query. More  
> > specifically :pt and :sfield fields.
> > 
> > if latitude.present? && longitude.present?  
> > p[:pt] = "#{latitude},#{longitude}"  
> > p[:sfield] = :expert\_location
> > 
> > Karan
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/Xr8YoU\_SyBc/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Xr8YoU_SyBc/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
Best,  
Karan

Life saving Ninja & Software Engineer

Karan pronounced Ka ([http://tiny.cc/0lu61w](http://tiny.cc/0lu61w)) + Run

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:12am UTC](https://discuss.elastic.co/t/solr-spatialsearch-equivalent-for-elastic-search/13917/4 "2017-07-06T02:12:28Z")

</div>


