Skip to main content

Elasticsearch

Marmot can optionally use Elasticsearch to enhance search with deep fuzzy matching across all record fields including metadata, descriptions, documentation and schemas.

Configuration

YAML

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

Environment Variables

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

Options

OptionDescriptionDefaultEnvironment Variable
search.elasticsearch.enabledEnable Elasticsearch for text searchfalseMARMOT_SEARCH_ELASTICSEARCH_ENABLED
search.elasticsearch.addressesList of Elasticsearch node URLs-MARMOT_SEARCH_ELASTICSEARCH_ADDRESSES
search.elasticsearch.usernameHTTP Basic Auth username-MARMOT_SEARCH_ELASTICSEARCH_USERNAME
search.elasticsearch.passwordHTTP Basic Auth password-MARMOT_SEARCH_ELASTICSEARCH_PASSWORD
search.elasticsearch.indexName of the Elasticsearch indexmarmotMARMOT_SEARCH_ELASTICSEARCH_INDEX
search.elasticsearch.bulk_sizeNumber of documents per bulk indexing batch500MARMOT_SEARCH_ELASTICSEARCH_BULK_SIZE
search.elasticsearch.flush_intervalInterval between bulk flushes in milliseconds1000MARMOT_SEARCH_ELASTICSEARCH_FLUSH_INTERVAL
search.elasticsearch.reindex_on_startRun a full reindex from PostgreSQL to Elasticsearch on startupfalseMARMOT_SEARCH_ELASTICSEARCH_REINDEX_ON_START
search.elasticsearch.shardsNumber of primary shards for the indexcluster defaultMARMOT_SEARCH_ELASTICSEARCH_SHARDS
search.elasticsearch.replicasNumber of replicas for the indexcluster defaultMARMOT_SEARCH_ELASTICSEARCH_REPLICAS

TLS

To connect to an Elasticsearch cluster over TLS:

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"
OptionDescriptionDefaultEnvironment Variable
search.elasticsearch.tls.ca_cert_pathPath to CA certificate for verifying the ES server-MARMOT_SEARCH_ELASTICSEARCH_TLS_CA_CERT_PATH
search.elasticsearch.tls.cert_pathPath to client certificate for mutual TLS-MARMOT_SEARCH_ELASTICSEARCH_TLS_CERT_PATH
search.elasticsearch.tls.key_pathPath to client private key for mutual TLS-MARMOT_SEARCH_ELASTICSEARCH_TLS_KEY_PATH
search.elasticsearch.tls.insecure_skip_verifySkip server certificate verification (not recommended)falseMARMOT_SEARCH_ELASTICSEARCH_TLS_INSECURE_SKIP_VERIFY

Startup Behaviour

At startup, Marmot checks whether Elasticsearch is reachable. If the cluster is not available, Marmot falls back to PostgreSQL-only search and logs an error. It will not retry connecting to Elasticsearch after startup.

Shards and Replicas

By default Marmot defers to the Elasticsearch cluster settings for shard and replica counts. You can override these per-index if needed:

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

These values are only applied when Marmot creates the index for the first time. Changing them after the index already exists has no effect. To apply new shard counts to an existing cluster you must delete the index and let Marmot recreate it, or use the Elasticsearch split/shrink APIs directly.

Indexing Existing Data

If you enable Elasticsearch on an instance that already has data, set reindex_on_start: true to populate the index from the existing search_index table:

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

You can also manually trigger a reindex from the admin UI under Admin > System > Start Reindex.