3

I was going through Query String Query https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html

How can i do geo location based search if i have latitude and longitude and range in KM?

4
  • Have you looked at the Geo queries documentation? Commented Jan 11, 2017 at 18:18
  • yah but i want use it as Query String Query Commented Jan 12, 2017 at 6:04
  • Uh, well, that's a shame. Fairly certain it doesn't support geo queries. Commented Jan 12, 2017 at 6:06
  • @manish did you get a solution for this? Can you please share? I am trying to implement something similar Commented Mar 21, 2017 at 9:56

1 Answer 1

1

After some experiments and some search on net. I achieved this with wrapping "query string" in bool query.

{
 "size": 0,
 "query": {
   "bool": {
     "must": {
       "query_string": {
         "query": "one:1 AND two:2"
       }
     },
     "filter": {
       "geo_distance": {
         "distance": "12km",
         "latLong": "16.48,80.61"
       }
     }
   }
 },
 "from": "0",
 "_source": [
   "user"
 ]
}

cheers.

Thank-you.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.