Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discover sources & layers by querying elasticsearch #1316

Merged
merged 2 commits into from
Jun 18, 2019

Conversation

missinglink
Copy link
Member

@missinglink missinglink commented Jun 17, 2019

This is a feature I started a while back but never quite finished.
It allows users to set api.targets.auto_discover to true in order to query a list of sources and layers from elasticsearch when the api starts up.

It works by sending an aggregation to elasticsearch, this query can take some time (up to several seconds for a full planet build) and so isn't recommended for a production build. (which is why it's disabled by default).

It is, however, very useful for clients who use a lot of custom layer names and forget to update the list manually.
I caught an example of this today from a client, combined with the address_layer_filter can cause these custom layers to be excluded from search results when we were only intending to filter address documents.

It's probably worth enabling this for all docker projects by default and explicitly disabling it in production environments where either the mapping is well known ahead of time, or where startup performance is sensitive.

@missinglink missinglink requested a review from orangejulius June 17, 2019 17:05
Copy link
Member

@orangejulius orangejulius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this will be really helpful, as we've seen from issues such as pelias/csv-importer#26 and pelias/csv-importer#36 that updating the list of layers is a decent challenge and easy to forget, creating a poor experience.

helper/type_mapping_discovery.js Outdated Show resolved Hide resolved
@missinglink missinglink merged commit 287f8f0 into master Jun 18, 2019
@missinglink missinglink deleted the auto_discover_type_mapping branch June 18, 2019 12:58
orangejulius added a commit to pelias/dashboard that referenced this pull request Jul 3, 2019
This project previously depended on Elasticsearch types in order to
provide a count of the number of records in each layer.

Elasticsearch types will be going away in Elasticsearch 6, and are
already deprecated in ES5.

Instead of relying on types, the count of records per layer is now
created using a [terms aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html)
similar to the source and layers [autodetection
code](pelias/api#1316) recently added to
pelias/api.

This is one of the last few roadblocks for dropping Pelias's use of
types completely and merging PRs like
pelias/schema#293 that will drastically simplify
our schema.

Connects pelias/pelias#461
Connects pelias/pelias#719
orangejulius added a commit to pelias/dashboard that referenced this pull request Jul 3, 2019
This project previously depended on Elasticsearch types in order to
provide a count of the number of records in each layer.

Elasticsearch types will be going away in Elasticsearch 6, and are
already deprecated in ES5.

Instead of relying on types, the count of records per layer is now
created using a [terms aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html)
similar to the source and layers [autodetection
code](pelias/api#1316) recently added to
pelias/api.

This is one of the last few roadblocks for dropping Pelias's use of
types completely and merging PRs like
pelias/schema#293 that will drastically simplify
our schema.

Connects pelias/pelias#461
Connects pelias/pelias#719
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants