Query geo_distance with distance variable

(Jorge) #1

Hi everybody

I have an index where every document has a field whit an integer that represent a radio value. Now I need to do a geo_distance query where the parameter "distance" will be variable and depend of the value of the field "radio" in the document.
With an example perhaps is easier to explain:
"_source": {
"customer_id": 1,
"geolocation": "49.8523,8.6386",
"radio": 10,

"_source": {
"customer_id": 2,
"geolocation": "50.0042,12.0881",
"radio": 100,

GET cm_customers/_search
"query": {
"filtered": {
"filter": {
"geo_distance": {
"distance": radio >= distance between fix point in query and geolocation in document
"geolocation": {
"lat": 51.16547,
"lon": 10.4322

The query should select all the documents where the radio field in document >= distance between the fixpoint in query("51.16547, 10.4322") and the geolocation of the document("50.0042,12.0881"). ==> this values for the first document.

Is posible to configure a query like this?

In advance thanks a lot for your help!!

Best regards

Jorge von Rudno

(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.