Skip to main content
Version: 0.12

Search backend

Marmot searches with PostgreSQL out of the box. Add Elasticsearch for fuzzy matching across every field of a record, including metadata, descriptions, documentation and schemas.

Connect Elasticsearch​

search:
elasticsearch:
enabled: true
addresses:
- "http://localhost:9200"
index: "marmot"

Or with environment variables:

MARMOT_SEARCH_ELASTICSEARCH_ENABLED=true
MARMOT_SEARCH_ELASTICSEARCH_ADDRESSES=http://localhost:9200
MARMOT_SEARCH_ELASTICSEARCH_INDEX=marmot

Options​

Each key has an environment variable: MARMOT_ followed by the key in capitals with dots as underscores, such as MARMOT_SEARCH_ELASTICSEARCH_ADDRESSES.

KeyDescriptionDefault
search.elasticsearch.enabledEnable Elasticsearch for text searchfalse
search.elasticsearch.addressesList of Elasticsearch node URLs-
search.elasticsearch.usernameHTTP Basic Auth username-
search.elasticsearch.passwordHTTP Basic Auth password-
search.elasticsearch.indexName of the Elasticsearch indexmarmot
search.elasticsearch.bulk_sizeNumber of documents per bulk indexing batch500
search.elasticsearch.flush_intervalInterval between bulk flushes in milliseconds1000
search.elasticsearch.reindex_on_startRun a full reindex from PostgreSQL to Elasticsearch on startupfalse
search.elasticsearch.shardsNumber of primary shards for the indexcluster default
search.elasticsearch.replicasNumber of replicas for the indexcluster default

TLS​

Connect to a cluster over TLS with a CA certificate, and optionally a client certificate:

search:
elasticsearch:
enabled: true
addresses:
- "https://es.example.com:9200"
tls:
ca_cert_path: "/etc/ssl/certs/es-ca.pem"
cert_path: "/etc/ssl/certs/es-client.pem"
key_path: "/etc/ssl/private/es-client-key.pem"
KeyDescriptionDefault
search.elasticsearch.tls.ca_cert_pathPath to CA certificate for verifying the ES server-
search.elasticsearch.tls.cert_pathPath to client certificate for mutual TLS-
search.elasticsearch.tls.key_pathPath to client private key for mutual TLS-
search.elasticsearch.tls.insecure_skip_verifySkip server certificate verification; development onlyfalse

If Elasticsearch is down at startup​

Marmot checks Elasticsearch once, when it starts. If the cluster isn't reachable, it logs an error and searches with PostgreSQL only until you restart it.

Shards and replicas​

Marmot uses the cluster's shard and replica counts unless you set them for its index:

search:
elasticsearch:
enabled: true
addresses:
- "http://localhost:9200"
shards: 3
replicas: 1

They only apply when Marmot creates the index. To change them later, delete the index and let Marmot recreate it, or use the Elasticsearch split and shrink APIs.

Index existing data​

When you add Elasticsearch to an instance that already has data, set reindex_on_start to fill the index when Marmot starts:

search:
elasticsearch:
enabled: true
addresses:
- "http://localhost:9200"
reindex_on_start: true

Or open Settings → System and, under Search index, select Reindex search.

Next steps​