From db14ba57ccbed38e3a32cc4a12f67f234d39cbe6 Mon Sep 17 00:00:00 2001 From: missinglink Date: Tue, 18 Jun 2019 15:30:14 +0200 Subject: [PATCH] feat(auto_discover_type_mapping): update README --- README.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3c87de928..4c51f2fde 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,8 @@ The API recognizes the following properties under the top-level `api` key in you |---|---|---|---| |`services`|*no*||Service definitions for [point-in-polygon](https://github.com/pelias/pip-service), [libpostal](https://github.com/whosonfirst/go-whosonfirst-libpostal), [placeholder](https://github.com/pelias/placeholder), and [interpolation](https://github.com/pelias/interpolation) services. For a description of when different Pelias services are recommended or required, see our [services documentation](https://github.com/pelias/documentation/blob/master/services.md).| |`defaultParameters.focus.point.lon`
`defaultParameters.focus.point.lat`|no | |default coordinates for focus point -|`targets.layers_by_source`
`targets.source_aliases`
`targets.layer_aliases`|no | |custom values for which `sources` and `layers` the API accepts (See more info in the [Custom sources and layers](#custom-sources-and-layers) section below). +|`targets.auto_discover`|no|false|Should `sources` and `layers` be automatically discovered by querying elasticsearch at process startup. (See more info in the [Custom sources and layers](#custom-sources-and-layers) section below). +|`targets.layers_by_source`
`targets.source_aliases`
`targets.layer_aliases`|no | |custom values for which `sources` and `layers` the API accepts (See more info in the [Custom sources and layers](#custom-sources-and-layers) section below). We recommend using the `targets.auto_discover:true` configuration instead of setting these manually. |`customBoosts` | no | `{}` | Allows configuring boosts for specific sources and layers, in order to influence result order. See [Configurable Boosts](#custom-boosts) below for details | |`autocomplete.exclude_address_length` | no | 0 | As a performance optimization, this optional parameter allows excluding address results for queries below the configured length. Addresses are usually the bulk of the records in Elasticsearch, and searching across all of them for very short text inputs can be slow, with little benefit. Consider setting this to 1 or 2 if you have several million addresses in Pelias. | |`indexName`|*no*|*pelias*|name of the Elasticsearch index to be used when building queries| @@ -88,7 +89,22 @@ The `timeout` and `retry` values, as show in in the `pip` service section, are o ### Custom sources and layers -Pelias allows importing your own data with custom values for `source` and `layer`, however you MUST tell Pelias about them via `pelias.json` using the `targets.layers_by_source`, `targets.source_aliases` and `targets.layer_aliases` configuration parameters. +Pelias allows importing your own data with custom values for `source` and `layer`. + +Custom sources and layers are not automatically detected, you MUST set `targets.auto_discover` to `true` in your `pelias.json` to make Pelias aware of them. + +The `auto_discover` functionality sends a request to elasticsearch in order to automatically discover sources and layers from elasticsearch when the API server starts-up. + +Be aware that the query sent to elasticsearch can take several seconds to execute the first time against a large index, the query is cached in elasticsearch for subsequent requests. + +If you are importing custom layers and are running a city or small region sized build then the start-up delay will likely not affect you, you can safely use `targets.auto_discover:true`. + +For advanced users running a full-planet build with custom layers or sources, and also concerned about this start-up delay, you have two options: + +1. execute the `auto_discover` query once manually to prime the cache **or** +2. set `targets.auto_discover: false` and manually define the layers as documented below. + +> note: manually assigning targets is an advanced configuration which should be avoided where possible. #### `layers_by_source`