-
Notifications
You must be signed in to change notification settings - Fork 3
Scoped Search Views
Pavel Kiselev edited this page Mar 21, 2017
·
4 revisions
-
Create search view table in database
- Dates must be of
json_timestamp
type; - You can convert data from
timestamp
tojson_timestamp
usingto_json_timestamp(field)
orto_char(field, 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"')
functions; - Table must have scope field of
ltree
type;
- Dates must be of
-
Create triggers for
create
,update
,delete
operations, that will copy data from tables (which are used to store data) into search view table- One of the most convenient ways to check and debug triggers is using of
explain analyze verbose
modifier for sql queries;
- One of the most convenient ways to check and debug triggers is using of
-
Create index mapping in GreenRiver
- Be careful, ElasticSearch index cannot have fields with same name but different types in mappings;
-
Wire index with Kafka topic
- This is achieved by modifing 2 files:
-
application.conf
in GreenRiver by adding serach view table name tokafka.scoped.indices
property; -
consumers.Workers
object: mapping of kafka topic to search view class must be added totopicTransformers
method;
-
- This is achieved by modifing 2 files:
-
Configure scope application th the requests in nginx
- The template for nginx configuration can be found in
ansible/roles/dev/balancer/templates/nginx.conf.j2
file. - You have to add
search_view_name = 1
toscoped_views
array ininit_by_lua
function.
- The template for nginx configuration can be found in
- Rebuild GreenRiver docker container
- Change nginx configuration file
- Stop bottledwater service and services that are connected to the source database
- Migrate databases
- Start bottlewater service and services that are connected to the source database
- Deploy new image of greenriver to Mesos cluster