Add multiple filters based on geo distance on same index

Hello ,

I have a single index containing starbucks location data , a data view is based on an index from Elasticsearch

I wish to display results on kibana visualization based on the distance with different color coding

example
color 1 for stores in 5 mile radius
color 2 for stores in 10 mile radius etc

I have currently tried using a discover -> apply Query DSL filter with 5 miles and create a visualization , which is yielding all the values based on the initial geo distance filter

next , i wish to get the locations that are in 10 mile radius with a different color , but unable to add this.

can you please help me understand how this can be done ?

sample record ingested into index

{
        "Unnamed: 0": 4403,
        "storeNumber": "11031-95816",
        "countryCode": "US",
        "ownershipTypeCode": "CO",
        "schedule": "[{'dayName': 'Today', 'hours': '4:30 AM to 11:00 PM', 'open': True, 'holiday': ''}, {'dayName': 'Tomorrow', 'hours': '4:30 AM to 11:00 PM', 'open': True, 'holiday': ''}, {'dayName': 'Thursday', 'hours': '4:30 AM to 11:00 PM', 'open': True, 'holiday': ''}, {'dayName': 'Friday', 'hours': '4:30 AM to 11:00 PM', 'open': True, 'holiday': ''}, {'dayName': 'Saturday', 'hours': '4:30 AM to 11:00 PM', 'open': True, 'holiday': ''}, {'dayName': 'Sunday', 'hours': '5:30 AM to 11:00 PM', 'open': True, 'holiday': ''}, {'dayName': 'Monday', 'hours': '4:30 AM to 11:00 PM', 'open': True, 'holiday': ''}]",
        "slug": "barranca-i-10-west-covina-101-n-barranca-west-covina-ca-917911629-us",
        "latitude": 34.072436,
        "longitude": -117.881852,
        "streetAddressLine1": "101 N. Barranca",
        "streetAddressLine2": null,
        "streetAddressLine3": null,
        "city": "West Covina",
        "countrySubdivisionCode": "CA",
        "zipcode": "917911629",
        "currentTimeOffset": -420,
        "windowsTimeZoneId": "Pacific Standard Time",
        "olsonTimeZoneId": "GMT-08:00 America/Los_Angeles"
    }

query DSL sample

{
  "bool": {
    "filter": {
      "geo_distance": {
        "distance": "10mi",
        "point_location": [
          -121.92274393179278,
          37.37703823893055
        ]
      }
    },
    "must": {
      "match_all": {}
    }
  }
}

thaank you

Hi @Vamsi. I do not think this is currently possible on a single map. The filters you are using apply to every layer on a map. It is possible for a single layer to have its own Filters, but currently you can only write those filters in KQL or Lucene syntax which does not support geo_distance queries.

One workaround would be showing two maps on a dashboard. Each map can specify a different distance filter.

Alternatively, you might be able to use a Vega map to show multiple layers with different filters. But Vega has a substantial learning curve. I'd only recommend that if you are 1) familiar with Vega; or 2) very ambitious. :slightly_smiling_face:

Also, there is a new feature in 8.9 that supports Spatial joins. This allows you to show results from one index that are within a distance of features in another index. So if you have an index of residential homes. You could configure a spatial join on that index to only show homes within a 5 mile distance of Starbucks in your other index. Then you could add another homes layer with a spatial join distance of 10 miles.

More information in this pull request.

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