1.8. Search Plugin Installation — Apache CouchDB® 3.5 Documentation

# 1.8. Search Plugin Installation

Added in version 3.0.

CouchDB can build and query full-text search indexes using an external Java service that embeds Apache Lucene. Typically, this service is installed on the same host as CouchDB and communicates with it over the loopback network.

The search plugin is runtime-compatible with Java JDKs 6, 7 and 8. Building a release from source requires JDK 6. It will not work with any newer version of Java. Sorry about that.

## 1.8.1. Installation of Binary Packages

Binary packages that bundle all the necessary dependencies of the search plugin are available on GitHub. The files in each release should be unpacked into a directory on the Java classpath. If you do not have a classpath already set, or you wish to explicitly set the classpath location for Clouseau, then add the line:

    -classpath '/path/to/clouseau/*'

to the server command below. If clouseau is installed in `/opt/clouseau` the line would be:

    -classpath '/opt/clouseau/*'

The service expects to find a couple of configuration files conventionally called `clouseau.ini` and `log4j.properties` with the following content:

clouseau.ini:

    [clouseau]

    ; the name of the Erlang node created by the service, leave this unchanged
    name=clouseau@127.0.0.1

    ; set this to the same distributed Erlang cookie used by the CouchDB nodes
    cookie=brumbrum

    ; the path where you would like to store the search index files
    dir=/path/to/index/storage

    ; the number of search indexes that can be open simultaneously
    max_indexes_open=500

log4j.properties:

    log4j.rootLogger=debug, CONSOLE
    log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
    log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
    log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} %c [%p] %m%n

Once these files are in place the service can be started with an invocation like the following:

    java -server \
         -Xmx2G \
         -Dsun.net.inetaddr.ttl=30 \
         -Dsun.net.inetaddr.negative.ttl=30 \
         -Dlog4j.configuration=file:/path/to/log4j.properties \
         -XX:OnOutOfMemoryError="kill -9 %p" \
         -XX:+UseConcMarkSweepGC \
         -XX:+CMSParallelRemarkEnabled \
         com.cloudant.clouseau.Main \
         /path/to/clouseau.ini

## 1.8.2. Chef

The CouchDB cookbook can build the search plugin from source and install it on a server alongside CouchDB.

## 1.8.3. Kubernetes

Users running CouchDB on Kubernetes via the Helm chart can add the search service to each CouchDB Pod by setting `enableSearch: true` in the chart values.

## 1.8.4. Additional Details

The Search User Guide provides detailed information on creating and querying full-text indexes using this plugin.

The source code for the plugin and additional configuration documentation is available on GitHub at https://github.com/cloudant-labs/clouseau.