search icon
TravelTime API
Overview
Developer Tools
Database Plugins
TravelTime API
SDK
TravelTime API
Isochrone API
JSON
Distance Map API
TravelTime API
Travel Time Matrix API
JSON
Travel Time Matrix API
Protocol Buffers
TravelTime API
Routes API
JSON
Geocoding API
Additional API Reference
Error Handling
TravelTime API
ArcGIS plugin
QGIS plugin
Alteryx plugin
TravelTime.comchevronDocs

Elasticsearchanchor icon

Travel Time Matrix API can be used on Elasticsearch using our plugin. Plugin supports the fastest version of Travel Time Matrix endpoint which uses Protocol Buffers for communication. You can find more details about available versions on our endpoint comparison page.

Authenticationanchor icon

For access to the Protobuf endpoint, please contact support@traveltime.com for credentials. Having a TravelTime Account is not enough, not having correct access will produce an authorization error.

Sourceanchor icon

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

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.

Installation and configurationanchor icon

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

Alpha-2 code of the country that the origin is in. Must be set either in the query or as a default in the config.
Information about supported countries on protobuf endpoint

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
              }
            }
          }
        ]
      }
    }
  }
}