(Quick Reference)

2 Configuration - Reference Documentation

Authors: Manuarii Stein, Stephane Maldini, Serge P. Nekoval

Version: 0.18.7.1-SNAPSHOT

2 Configuration

The plugin provide a default configuration, but you may add your own settings in your Config.groovy script.

Client mode

You can set the plugin in 3 different modes, detailled on the official ElasticSearch doc. The mode is defined with the following config key:

elasticSearch.client.mode = '<mode>'

Possible values:

ValueDescription
nodeThe plugin create its own node and join the ElasticSearch cluster as a client node (node.client = true). This setting requires that you have an ElasticSearch instance running and available on your network (use the discovery feature)
localThe plugin create its own local (to the JVM) node. Does not require any running ElasticSearch instance. Useful for development or testing.
transportThe plugin create a transport client that will connect to a remote ElasticSearch instance without joining the cluster.
"Transport" mode needs you to provide the host address and port. You can define one or multiple hosts with the following config key:
elasticSearch.client.hosts = [
       [host:'192.168.0.3', port:9300],
       [host:'228.168.0.4', port:9300]
]
If no host is defined, localhost:9300 will be used by the transport client.

Others properties

  • elasticSearch.client.transport.sniff

Only usable in with a transport client. Allows to sniff the rest of the cluster, and add those into its list of machines to use. In this case, the ip addresses used will be the ones that the other nodes were started with (the “publish” address)

  • elasticSearch.cluster.name

The name of the cluster for the client to join.

  • elasticSearch.date.formats

List of date formats used by the JSON unmarshaller to parse any date field properly. Note : future version of the plugin may change how formats are manipulated.

  • elasticSearch.defaultExcludedProperties

List of domain class properties to automatically ignore (will not be indexed) if their name match one of those. This will only apply to default-mapped domain class, with the static searchable property set to "true", and will not be considered when using closure mapping.

  • elasticSearch.disableAutoIndex

A boolean determining if the plugin should reflect any database save/update/delete automatically on the indices. Default to false.

  • elasticSearch.bulkIndexOnStartup

A boolean determining if the application should launch a bulk index operation upon startup. Default to true.

  • elasticSearch.index.compound_format

Should the compound file format be used (boolean setting). Set to false by default (really applicable for file system based index storage). More details on this setting on the ElasticSearch Documentation.

  • elasticSearch.index.store.type

Determine the way how the indices will be store. More details on the possible values on the ElasticSearch Documentation.

Possible valueDescription
memoryStores the index in memory. Useful for testing.
mmapfsStores the shard index on the file system (maps to Lucene MMapDirectory) using mmap.
niofsStores the shard index on the file system (maps to Lucene NIOFSDirectory) and allows for multiple threads to read from the same file concurrently.
simplefsStores using a plain forward implementation of file system storage (maps to Lucene SimpleFsDirectory) using random access file.
  • elasticSearch.maxBulkRequest

Max number of requests to process at once. Reduce this value if you have memory issue when indexing a big amount of data at once. If this setting is not specified, 500 will be use by default.

  • elasticSearch.path.data

The location of the data files of each index / shard allocated on the node.

Default configuration script

Below is the default configuration loaded by the plugin (any of your settings in the Config.groovy script overwrite those).

elasticSearch {
  /**
   * Date formats used by the unmarshaller of the JSON responses
   */
  date.formats = ["yyyy-MM-dd'T'HH:mm:ss'Z'"]

/** * Hosts for remote ElasticSearch instances. * Will only be used with the "transport" client mode. * If the client mode is set to "transport" and no hosts are defined, ["localhost", 9300] will be used by default. */ client.hosts = [ [host:'localhost', port:9300] ]

/** * Default mapping property exclusions * * No properties matching the given names will be mapped by default * ie, when using "searchable = true" * * This does not apply for classes using mapping by closure */ defaultExcludedProperties = ["password"]

/** * Determines if the plugin should reflect any database save/update/delete automatically * on the ES instance. Default to false. */ disableAutoIndex = false

/** * Should the database be indexed at startup. * * The value may be a boolean true|false. * Indexing is always asynchronous (compared to Searchable plugin) and executed after BootStrap.groovy. */ bulkIndexOnStartup = true

/** * Max number of requests to process at once. Reduce this value if you have memory issue when indexing a big amount of data * at once. If this setting is not specified, 500 will be use by default. */ maxBulkRequest = 500 }

environments { development { /** * Possible values : "local", "node", "transport" * If set to null, "node" mode is used by default. */ elasticSearch.client.mode = 'local' } test { elasticSearch { client.mode = 'local' index.store.type = 'memory' // store local node in memory and not on disk } } production { elasticSearch.client.mode = 'node' } }