Geo-distance ranges

(Csanád Vereckei) #1


I'm somewhat new to Elastic and however I can now use the geo-distance queries and geo filters, I would like to ask if there is any way to get distance between areas.

What I mean is, say I have a person at X:Y and have a maximum range of 50kms, that this person is willing to travel. Now I have another one at X1:Y1, who says his range is 10kms. Lets say that the two points are exactly 55kms away from each other.

Now I know it sounds weird, but can I find the mentioned user as a viable result for the other one? Like if we had two venn diagrams and since they have an intersection, we have a match.

Thank you for any answers in advance!

(Igor Motov) #2

How about combining two geo-distance queries in one bool query?

(Csanád Vereckei) #3

Thanks for the quick reply and the idea. We'll try it and see if it fits our needs, but seems promising.

(Csanád Vereckei) #4

Not sure, if you ment to combine two (or more) geo_distance filters, but doing so within a "must" array did the trick. So if anyone tries to achieve something similar, I can confirm this works.

Thank you very much, again, for the quick help!

(Igor Motov) #5

If you want intersection, then you have to, indeed, put both queries into the must array.