Zest™
Introduction
Tutorials
Javadoc
Samples
Core
Libraries
Extensions
Tools
Glossary 

ElasticSearch Index/Query

code

docs

tests

Index/Query services backed by ElasticSearch search engine built on top of Apache Lucene.

Warning

ElasticSearch Index/Query do not support ComplexQueries from the Query API, ie. queries by "example value".

Three modes of operation are supported:

Table 72. Artifact

Group IDArtifact IDVersion

org.apache.zest.extension

org.apache.zest.extension.indexing-elasticsearch

0


Embedded: in Memory or on FileSystem

Both in-memory and on-filesystem assemblies share the same configuration properties, see below.

In Memory Assembly

In-memory ElasticSearch Index/Query service relies on the FileConfig Library to decide where it stores its transaction logs as there’s no in-memory transaction log implementation in ElasticSearch.

Assembly is done using the provided Assembler:

new ESMemoryIndexQueryAssembler().withConfig( configModule, configVisibility ).assemble( module );
On FileSystem Assembly

Filesystem based ElasticSearch Index/Query service relies on the FileConfig Library to decide where it stores its index data, transaction logs etc…

Assembly is done using the provided Assembler:

new ESFilesystemIndexQueryAssembler().withConfig( configModule, configVisibility ).assemble( module );
Configuration

Important

By default queries can only traverse Aggregated Associations, if you want to be able to traverse all Associations set the indexNonAggregatedAssociations configuration property to TRUE.

Here are the configuration properties for both the in-memory and on-filesystem ElasticSearch Index/Query services:

public interface ElasticSearchConfiguration
        extends ConfigurationComposite
{

    /**
     * Cluster name.
     * Defaults to 'zest_cluster'.
     */
    @Optional Property<String> clusterName();

    /**
     * Index name.
     * Defaults to 'zest_index'.
     */
    @Optional Property<String> index();

    /**
     * Set to true to index non aggregated associations as if they were aggregated.
     * WARN: Don't use this if your domain model contains circular dependencies.
     * Defaults to 'FALSE'.
     */
    @UseDefaults Property<Boolean> indexNonAggregatedAssociations();

}

All configuration properties are defaulted meaning that you can use ElasticSearch Index/Query service without configuration.

In an ElasticSearch cluster

Assembly

Assembly is done using the provided Assembler:

new ESClusterIndexQueryAssembler().withConfig( configModule, configVisibility ).assemble( module );
Configuration

Here are the configuration properties for the clustered ElasticSearch Index/Query service. Note that it inherits the properties defined in the in-memory or on-filesystem configuration, see above.

public interface ElasticSearchClusterConfiguration
        extends ElasticSearchConfiguration
{

    /**
     * Coma separated list of nodes host:port.
     * Defaults to '127.0.0.1:9300'.
     */
    @Optional Property<String> nodes();

    /**
     * Allows client to sniff the rest of the cluster, and add those into its list of machines to use.
     * In this case, note that the ip addresses used will be the ones that the other nodes were started
     * with (the “publish” address).
     * Defaults to FALSE.
     */
    @UseDefaults Property<Boolean> clusterSniff();

    /**
     * Set to true to ignore cluster name validation of connected nodes.
     * Defaults to FALSE.
     */
    @UseDefaults Property<Boolean> ignoreClusterName();

    /**
     * The time to wait for a ping response from a node.
     * Defaults to 5s.
     */
    @Optional Property<String> pingTimeout();

    /**
     * How often to sample / ping the nodes listed and connected.
     * Defaults to 5s.
     */
    @Optional Property<String> samplerInterval();

}

Again, all configuration properties are defaulted meaning that you can use ElasticSearch Index/Query service without configuration.