It turns out the _type parameter to the Elasticsearch
[multiget](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html)
API does not allow an array of possible values. We were depending on its
ability to search multiple types to allow searching for OSM nodes and
ways.
But, since this doesn't work we essentially have to do it ourselves.
There is also the problem that OSM nodes and ways share an ID space. So
a gid such as `osm:venue:5` could in theory correspond to 2 records.
It seems like the only nice thing to do in that case is return both
results.
This PR "unrolls" such queries. For example, in the case of
`osm:venue:5`, the sanitisers will return the following array of objects
to be turned into multiget queries:
```
[{
id: 5,
types: ["osmway", "osmnode"]
}]
```
Before, this would turn into a multiget query with only one entry, like
this:
```
{
"docs": [
{
"_index": "pelias",
"_type": [
" osmnode",
"osmway"
],
"_id": 5
}
]
}
```
now it would look like this:
{
"docs": [
{
"_index": "pelias",
"_type": "osmnode",
"_id": 5
},
{
"_index": "pelias",
"_type": "osmnode",
"_id": 5
}
]
}
TLDR you might get back more records from /place than the number of ids
you specified, but at least you will definitely get back what you are
looking for.
The API ships with several convenience commands (runnable via npm):
npm start: start the server
npm test: run unit tests
npm run ciao: run functional tests (this requires that the server be running)
npm run docs: generate API documentation
npm run coverage: generate code coverage reports
pelias-config
The API recognizes the following properties under the top-level api key in your pelias.json config file:
accessLog: (optional) The name of the format to use for access logs; may be any one of the
predefined values in the morgan package. Defaults to
"common"; if set to false, or an otherwise falsy value, disables access-logging entirely.
Contributing
Please fork and pull request against upstream master on a feature branch. Pretty please; provide unit tests and script
fixtures in the test directory.