On-Premise Search services
Search services allow searching and retrieving information on various objects such as organizations, buildings, public places, etc.
This article describes how to deploy and configure the Search services in your environment. To learn how to use the RESTful API provided by the Search services, see the documentation for the individual APIs (found in the top menu under "Search").
Architecture

Search services architecture consists of two services: Catalog API and Search API.
Catalog API provides a RESTful API for applications.
Search API is a search engine that processes requests made by Catalog API.
Requirements
Detailed requirements for each service are listed in the Overview document. Additional information can be found in the Deployment considerations section of this document.
Search API
Shared infrastructure:
- S3-compatible storage for storing the search indexes (Deployment Artifacts Storage)
Catalog API
Services:
- Search API service
Shared infrastructure:
- PostgreSQL data storage for storing object data. These extensions should be installed: PostGIS 2.5+, PLV8 3.0.0+, JsQuery.
Installing
Note:
The Ingress configuration in configuration files is sample and for reference only. Adapt this configuration to your needs and Ingress installation.
Do the following:
-
Do the common deployment steps.
Note:
Do not forget to write down the path to a manifest file, it will be required to deploy the services.
Search API
-
Create the
values-search.yaml
configuration file:values-search.yaml
dgctlDockerRegistry: <Docker Registry hostname and port>/2gis-on-premise dgctlStorage: host: <Deployment Artifacts Storage endpoint> bucket: <Deployment Artifacts Storage bucket> accessKey: <The bucket access key> secretKey: <The bucket secret key> manifest: <Path to the manifest file> api: resources: limits: cpu: 1 memory: 3G requests: cpu: 100m memory: 1G nginx: resources: limits: cpu: 1 memory: 1G requests: cpu: 100m memory: 200Mi ingress: enabled: true className: nginx hosts: - host: search-api.ingress.domain paths: - path: '/' pathType: Prefix
Where:
-
dgctlDockerRegistry
: your Docker Registry endpoint where On-Premise services' images reside. -
dgctlStorage
: Deployment Artifacts Storage settings.- Fill in the common settings to access the storage: endpoint, bucket, and access credentials.
manifest
: fill in the path to the manifest file in themanifests/1640661259.json
format. This file contains the description of pieces of data that the service requires to operate.
-
api.resources
: computational resources settings for the API backend service. See the minimal requirements table for the actual information about recommended values. -
nginx.resources
: computational resources settings for the NGINX backend service. See the minimal requirements table for the actual information about recommended values. -
ingress
: sample configuration of the Ingress resource. Adapt it to your Ingress installation. This URL should be accessible from the outside of your Kubernetes cluster, so that users in the private network can browse the URL.
-
-
Deploy the service with Helm using the created
values-search.yaml
configuration file.helm upgrade --install --version=1.0.3 --atomic --values ./values-search.yaml search-api 2gis-on-premise/search-api
Catalog API
-
Configure the PostgreSQL data storage:
-
Log in to the PostgreSQL as a superuser.
-
Create the
catalog
user for this database:create user catalog password '<password for the user>';
-
Create the
catalog
database for use with Catalog API service:create database catalog owner catalog; \c catalog CREATE EXTENSION plv8 WITH SCHEMA pg_catalog; CREATE EXTENSION postgis WITH SCHEMA public; CREATE EXTENSION jsquery WITH SCHEMA public;
-
-
Create the
values-catalog.yaml
configuration file:values-catalog.yaml
dgctlDockerRegistry: <Docker Registry hostname and port>/2gis-on-premise db: host: localhost port: 5432 name: catalog username: catalog password: secret search: url: http://localhost:80 keys: endpoint: https://keys-api.host serviceKeys: places: '' geocoder: '' suggest: '' categories: '' regions: ''
Where:
-
dgctlDockerRegistry
: your Docker Registry endpoint where On-Premise services' images reside. -
db
: the PostgreSQL database access settings. Use the values you configured in the PostgreSQL on the previous step.host
: host name of the serverport
: port of the servername
: database nameusername
: user namepassword
: user password
-
search
: the Search API service access settings.url
: URL of the service. This URL should be accessible from all the pods within your Kubernetes cluster.
-
keys
: the API Keys service settings.endpoint
: URL of the service. This URL should be accessible from all the pods within your Kubernetes cluster.serviceKeys
: service API keys for sharing usage statistics with the API Keys service (see Fetching the service API keys).
-
-
Deploy the service with Helm using the created
values-catalog.yaml
configuration file.helm upgrade --install --version=1.0.3 --atomic --values ./values-catalog.yaml catalog-api 2gis-on-premise/catalog-api
Updating
Search API
To update the Search API service, execute the following command:
helm upgrade --version=1.0.3 --atomic --values ./values-search.yaml search-api 2gis-on-premise/search-api
Catalog API
To update the Catalog API service, execute the following command:
helm upgrade --version=1.0.3 --atomic --values ./values-catalog.yaml catalog-api 2gis-on-premise/catalog-api
Testing the deployment
Search API
To test that the Search API service is working, you can make a GET request to the status
endpoint:
curl SEARCH_API_HOST/v2/status?f=common
Catalog API
To test that the Catalog API service is working, you can do the following:
-
Using API Keys Admin, create an API key that has access to Places API.
-
Make the following GET request, replacing
API_KEY
with the created key:curl CATALOG_API_HOST/3.0/items?key=API_KEY&q=east®ion_id=220
This request will test the operability of Catalog API, Search API, and the PostgreSQL database.