|
1 |
| -# rp-indexer |
2 |
| -Simple service for indexing RapidPro contacts into ElasticSearch |
| 1 | +# RapidPro Indexer |
| 2 | + |
| 3 | +Simple service for indexing RapidPro contacts into ElasticSearch. |
| 4 | + |
| 5 | +This service can run in two modes: |
| 6 | + |
| 7 | +1) the default mode, which simply queries the ElasticSearch database, finds the most recently |
| 8 | +modified contact, then on a schedule queries the `contacts_contact` table on the RapidPro |
| 9 | +database for contacts to add or delete. You should run this as a long running service which |
| 10 | +constantly keeps ElasticSearch in sync with your RapidPro contacts. |
| 11 | + |
| 12 | +2) a rebuild mode, started with `--rebuild`. This builds a brand new index from nothing, querying |
| 13 | +all contacts on RapidPro. Once complete, this switches out the alias for the contact index |
| 14 | +with the newly build index. This can be run on a cron (in parallel with the mode above) to rebuild |
| 15 | +your index occasionally to get rid of bloat. |
| 16 | + |
| 17 | +## Usage |
| 18 | + |
| 19 | +It is recommended to run the service with two environment variables set: |
| 20 | + |
| 21 | + * `INDEXER_DB`: a URL connection string for your RapidPro database |
| 22 | + * `INDEXER_ELASTIC_URL`: the URL for your ElasticSearch endpoint |
| 23 | + |
| 24 | +``` |
| 25 | +Indexes RapidPro contacts to ElasticSearch |
| 26 | +
|
| 27 | +Usage of indexer: |
| 28 | + -db string |
| 29 | + the connection string for our database (default "postgres://localhost/rapidpro") |
| 30 | + -debug-conf |
| 31 | + print where config values are coming from |
| 32 | + -elastic-url string |
| 33 | + the url for our elastic search instance (default "http://localhost:9200") |
| 34 | + -help |
| 35 | + print usage information |
| 36 | + -index string |
| 37 | + the alias for our contact index (default "contacts") |
| 38 | + -poll int |
| 39 | + the number of seconds to wait between checking for updated contacts (default 5) |
| 40 | + -rebuild |
| 41 | + whether to rebuild the index, swapping it when complete, then exiting (default false) |
| 42 | +
|
| 43 | +Environment variables: |
| 44 | + INDEXER_DB - string |
| 45 | + INDEXER_ELASTIC_URL - string |
| 46 | + INDEXER_INDEX - string |
| 47 | + INDEXER_POLL - int |
| 48 | + INDEXER_REBUILD - bool |
| 49 | +``` |
0 commit comments