TravelTime Docs logo
TravelTime API
ArcGIS plugin
QGIS plugin
Alteryx plugin

Elastisearchanchor icon

TravelTime API can be used on Elasticsearch using our plugin

The source code for the plugin is available on our GitHub.

Installation and configurationanchor icon

To find the latest version of the plugin for your Elasticsearch version visit releases repository. Correct version of the plugin must be used for specific Elasticsearch version. If there is no version of the plugin for your Elasticseach version, please contact us.

To install plugin version v.0.2.28 for Elasticsearch version 8.1.1 it is enough to run a command on the nodes running Elasticsearch:

elasticsearch-plugin install https://github.com/traveltime-dev/traveltime-elasticsearch-plugin/releases/download/v0.2.28/traveltime-elasticsearch-plugin_v0.2.28_8.1.1.zip

To use the plugin TravelTime API authentication keys must be specified in elasticsearch.yaml file:

  • traveltime.app.id: this is you API app id.
  • traveltime.api.key: this is the api key that corresponds to the app id.

You may additionally specify the following configuration options:

  • traveltime.default.mode: the default transportation mode that will be used if none is specified in the query.
  • traveltime.default.country: the default country that will be used if none is specified in the query.

On Elasticsearch version 7.10 and above you can control cache that enables returning travel times in the response:

  • traveltime.cache.size: how many requests to cache (default: 50).
  • traveltime.cache.expiry: how long the travel times will be stored in the cache, in seconds (default: 60).
  • traveltime.cache.cleanup.interval: how often a background cleanup task will be run, in seconds (default: 120).

Querying data

anchor icon

object

The traveltime query may only be used with fields that are indexed as geo_point.

Hide child attributes
Hide child attributes

Point from which travel time will be measured, accepted formats are:

  • Object with lon and lat properties,
  • [lon, lat] array,
  • "lat,lon" string,
  • geohash.
Show child attributes

Document field that will be used as the destination in the Traveltime query.

Travel time limit in seconds.
Maximum value is 7200 (2 hours) Must be non-negative.

string | optional

Transportation mode used in the search. Transportation modes available: pt, walking+ferry, cycling+ferry, driving+ferry.
Must be set either in the query or in as a default in the config.

string | optional

Country that the origin is in. Currently may only be one of: uk, nl, at, be, de, fr, ie, lt.
Must be set either in the query or in as a default in the config.

object | optional

Arbitrary Elasticsearch query that will be used to limit which points are sent to the API.

object | optional

Name of the field that will hold the travel times in the response.
Available for Elasticsearch 7.10 and above.

Examplesanchor icon

Example 1

{
  "query": {
    "traveltime": {
      "limit": 900,
      "field": "coords",
      "origin": {
        "lat": 51.509865,
        "lon": -0.118092
      }
    }
  }
}

Example 2

{
  "traveltime": {
    "limit": 7200,
    "field": "coords",
    "origin": "gcpvj3448qb1",
    "mode": "pt",
    "country": "uk",
    "prefilter": {
      "bool": {
        "filter": [
          {
            "range": {
              "bedrooms": {
                "gte": 3
              }
            }
          }
        ]
      }
    }
  }
}