Indicia-Team / warehouse

GNU General Public License v3.0
5 stars 3 forks source link

Does our elastic search have a locations index? #470

Closed kazlauskis closed 1 year ago

kazlauskis commented 1 year ago

Looking at the current REST endpoints, it doesn't look like it exists, so maybe it would be worth adding it. Please close the ticket if the below is the recommended solution.

Our use case is to filter es-occurrences based on pre-indexed shapes, e.g. county or some specific area. Looking at how some reports were implemented, it seems that filtering es-occurrences with location.higher_geography.id is what we can use too. Does that mean adding new locations to the warehouse automatically updates all occurrences' location.higher_geography fields? Does it work with non-public locations too?

johnvanbreda commented 1 year ago

@kazlauskis there is no locations index on Elasticsearch currently, though it could be added.

We have 2 types of locations in the system. Standardised locations that are useful for many projects such as countries, counties or other administrative areas are pre-indexed and their details stored in location.higher_geography. Adding a location to one of these layers does automatically update location.higher_geography. Other locations which are project specific or personal to a recorder are not pre-indexed so if you want to filter to the contained occurrences we do a geoshape query in Elasticsearch, providing the co-ordinates of the boundary.

kazlauskis commented 1 year ago

Thanks. Linking the standardised administrative areas to location.higher_geography and for everything else, using geoshape filters sounds like a good approach.

We can't find some administrative boundaries in the warehouse yet, but I'll create a separate ticket later. Closing now.